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 2017/07/16 16:15:17 UTC
[01/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Repository: oodt
Updated Branches:
refs/heads/master a82ee5db9 -> ad292384e
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlquery/src/main/java/org/apache/oodt/xmlquery/QueryHeader.java
----------------------------------------------------------------------
diff --git a/xmlquery/src/main/java/org/apache/oodt/xmlquery/QueryHeader.java b/xmlquery/src/main/java/org/apache/oodt/xmlquery/QueryHeader.java
deleted file mode 100755
index 7e4cb6b..0000000
--- a/xmlquery/src/main/java/org/apache/oodt/xmlquery/QueryHeader.java
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.xmlquery;
-
-import org.apache.oodt.commons.util.Documentable;
-import org.apache.oodt.commons.util.XML;
-
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-import java.io.Serializable;
-import java.net.URI;
-
-/** Header of a query
- *
- * @author Kelly
- */
-public class QueryHeader implements Serializable, Cloneable, Documentable {
- /** Create a blank query header.
- */
- public QueryHeader() {
- this(/*id*/"UNKNOWN", /*title*/"UNKNOWN", /*desc*/"UNKNOWN", /*type*/"QUERY", /*status*/"ACTIVE",
- /*security*/"UNKNOWN", /*rev*/"1999-12-12 JSH V1.0 Under Development", /*datadict*/"UNKNOWN");
- }
-
- /** Create a query header with the specified values.
- *
- * @param id The identification of this query.
- * @param title The title of this query.
- * @param description A string describing this query.
- * @param type The type of the query, usually QUERY.
- * @param statusID The status of the query.
- * @param securityType The type of security to apply to this query.
- * @param revisionNote A note about the revision history of this query.
- * @param dataDictID The ID of the data dictionary used by this query.
- */
- public QueryHeader(String id, String title, String description, String type, String statusID, String securityType,
- String revisionNote, String dataDictID) {
- this.id = id;
- this.title = title;
- this.description = description;
- this.type = type;
- this.statusID = statusID;
- this.securityType = securityType;
- this.revisionNote = revisionNote;
- this.dataDictID = dataDictID;
- }
-
- /** Create a query header from an XML node.
- *
- * @param node The <queryAttributes> node.
- */
- public QueryHeader(Node node) {
- if (!"queryAttributes".equals(node.getNodeName())) {
- throw new IllegalArgumentException("QueryHeader must be constructed from <queryAttributes> node, not <"
- + node.getNodeName() + ">");
- }
- NodeList children = node.getChildNodes();
- for (int i = 0; i < children.getLength(); ++i) {
- Node child = children.item(i);
- if ("queryId".equals(child.getNodeName())) {
- id = XML.unwrappedText(child);
- } else if ("queryTitle".equals(child.getNodeName())) {
- title = XML.unwrappedText(child);
- } else if ("queryDesc".equals(child.getNodeName())) {
- description = XML.unwrappedText(child);
- } else if ("queryType".equals(child.getNodeName())) {
- type = XML.unwrappedText(child);
- } else if ("queryStatusId".equals(child.getNodeName())) {
- statusID = XML.unwrappedText(child);
- } else if ("querySecurityType".equals(child.getNodeName())) {
- securityType = XML.unwrappedText(child);
- } else if ("queryRevisionNote".equals(child.getNodeName())) {
- revisionNote = XML.unwrappedText(child);
- } else if ("queryDataDictId".equals(child.getNodeName())) {
- dataDictID = XML.unwrappedText(child);
- }
- }
- }
-
- /** Get the identification of this query.
- *
- * @return The identification of this query.
- */
- public String getID() {
- return id;
- }
-
- /**
- * Get the identification of this query as a URI.
- *
- * @return an <code>URI</code> value.
- */
- public URI getURIID() {
- return URI.create(id.startsWith("urn")? id : "urn:oodt:query:" + id);
- }
-
-
- /** Get the title of this query.
- *
- * @return The title of this query.
- */
- public String getTitle() {
- return title;
- }
-
- /** Get a string describing this query.
- *
- * @return A string describing this query.
- */
- public String getDescription() {
- return description;
- }
-
- /** Get the type of the query, usually QUERY.
- *
- * @return The type of the query, usually QUERY.
- */
- public String getType() {
- return type;
- }
-
- /** Get the status of the query.
- *
- * @return The status of the query.
- */
- public String getStatusID() {
- return statusID;
- }
-
- /** Get the type of security to apply to this query.
- *
- * @return The type of security to apply to this query.
- */
- public String getSecurityType() {
- return securityType;
- }
-
- /** Get a note about the revision history of this query.
- *
- * @return A note about the revision history of this query.
- */
- public String getRevisionNote() {
- return revisionNote;
- }
-
- /** Get the ID of the data dictionary used by this query.
- *
- * @return The ID of the data dictionary used by this query.
- */
- public String getDataDictID() {
- return dataDictID;
- }
-
- /** Set the identification of this query.
- *
- * @param id The identification of this query.
- */
- public void setID(String id) {
- this.id = id;
- }
-
- /** Set the title of this query.
- *
- * @param title The title of this query.
- */
- public void setTitle(String title) {
- this.title = title;
- }
-
- /** Set a string describing this query.
- *
- * @param description A string describing this query.
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
- /** Set the type of the query, usually QUERY.
- *
- * @param type The type of the query, usually QUERY.
- */
- public void setType(String type) {
- this.type = type;
- }
-
- /** Set the status of the query.
- *
- * @param statusID The status of the query.
- */
- public void setStatusID(String statusID) {
- this.statusID = statusID;
- }
-
- /** Set the type of security to apply to this query.
- *
- * @param securityType The type of security to apply to this query.
- */
- public void setSecurityType(String securityType) {
- this.securityType = securityType;
- }
-
- /** Set a note about the revision history of this query.
- *
- * @param revisionNote A note about the revision history of this query.
- */
- public void setRevisionNote(String revisionNote) {
- this.revisionNote = revisionNote;
- }
-
- /** Set the ID of the data dictionary used by this query.
- *
- * @param dataDictID The ID of the data dictionary used by this query.
- */
- public void setDataDictID(String dataDictID) {
- this.dataDictID = dataDictID;
- }
-
- public Node toXML(Document doc) throws DOMException {
- Element root = doc.createElement("queryAttributes");
- XML.add(root, "queryId", getID());
- XML.add(root, "queryTitle", getTitle());
- XML.add(root, "queryDesc", getDescription());
- XML.add(root, "queryType", getType());
- XML.add(root, "queryStatusId", getStatusID());
- XML.add(root, "querySecurityType", getSecurityType());
- XML.add(root, "queryRevisionNote", getRevisionNote());
- XML.add(root, "queryDataDictId", getDataDictID());
- return root;
- }
-
- public int hashCode() {
- return getID().hashCode();
- }
-
- public boolean equals(Object rhs) {
- if (rhs == this) {
- return true;
- }
- if (rhs == null || !(rhs instanceof QueryHeader)) {
- return false;
- }
- QueryHeader obj = (QueryHeader) rhs;
- return getID().equals(obj.getID());
- }
-
- public Object clone() {
- Object rc = null;
- try {
- rc = super.clone();
- } catch (CloneNotSupportedException ignored) {}
- return rc;
- }
-
- public String toString() {
- return getClass().getName() + "[id=" + id + "]";
- }
-
- /** The identification of this query. */
- private String id;
-
- /** The title of this query. */
- private String title;
-
- /** A string describing this query. */
- private String description;
-
- /** The type of the query, usually QUERY. */
- private String type;
-
- /** The status of the query. */
- private String statusID;
-
- /** The type of security to apply to this query. */
- private String securityType;
-
- /** A note about the revision history of this query. */
- private String revisionNote;
-
- /** The ID of the data dictionary used by this query. */
- private String dataDictID;
-
- /** Serial version unique ID. */
- static final long serialVersionUID = -8601229234696670816L;
-}
[47/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/GraphView.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/GraphView.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/GraphView.java
deleted file mode 100644
index 64cf0a1..0000000
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/GraphView.java
+++ /dev/null
@@ -1,1140 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.workflow.gui.perspective.view.impl;
-
-//JDK imports
-import org.apache.oodt.cas.workflow.gui.model.ModelGraph;
-import org.apache.oodt.cas.workflow.gui.model.ModelNode;
-import org.apache.oodt.cas.workflow.gui.perspective.view.View;
-import org.apache.oodt.cas.workflow.gui.perspective.view.ViewChange;
-import org.apache.oodt.cas.workflow.gui.perspective.view.ViewState;
-import org.apache.oodt.cas.workflow.gui.util.GuiUtils;
-import org.apache.oodt.cas.workflow.gui.util.IconLoader;
-import org.apache.oodt.cas.workflow.gui.util.Line;
-
-import com.jgraph.layout.JGraphFacade;
-import com.jgraph.layout.hierarchical.JGraphHierarchicalLayout;
-
-import org.jgraph.JGraph;
-import org.jgraph.graph.AttributeMap;
-import org.jgraph.graph.DefaultEdge;
-import org.jgraph.graph.DefaultGraphCell;
-import org.jgraph.graph.GraphConstants;
-
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.Cursor;
-import java.awt.Graphics2D;
-import java.awt.MenuItem;
-import java.awt.Point;
-import java.awt.PopupMenu;
-import java.awt.Rectangle;
-import java.awt.Toolkit;
-import java.awt.datatransfer.DataFlavor;
-import java.awt.datatransfer.Transferable;
-import java.awt.datatransfer.UnsupportedFlavorException;
-import java.awt.dnd.DnDConstants;
-import java.awt.dnd.DragGestureEvent;
-import java.awt.dnd.DragGestureListener;
-import java.awt.dnd.DragSource;
-import java.awt.dnd.DragSourceDragEvent;
-import java.awt.dnd.DragSourceDropEvent;
-import java.awt.dnd.DragSourceEvent;
-import java.awt.dnd.DragSourceListener;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.awt.event.MouseMotionListener;
-import java.awt.event.MouseWheelListener;
-import java.awt.geom.Point2D;
-import java.awt.geom.Rectangle2D;
-import java.awt.image.BufferedImage;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Vector;
-
-import javax.swing.JScrollPane;
-import javax.swing.SwingConstants;
-import javax.swing.border.LineBorder;
-import javax.swing.tree.DefaultMutableTreeNode;
-
-import edu.uci.ics.jung.graph.DirectedSparseGraph;
-import edu.uci.ics.jung.graph.ObservableGraph;
-
-//JGraph imports
-//Jung imports
-//OODT imports
-
-/**
- *
- * This is where the money happens. The Graph visualization of OODT CAS
- * workflows is displayed via this view, which magically integrates JGraph,
- * Jung, and OODT.
- *
- * @author bfoster
- * @author mattmann
- *
- */
-public class GraphView extends DefaultTreeView {
-
- private static final long serialVersionUID = 5935578385254884387L;
-
- private JungJGraphModelAdapter m_jgAdapter;
- private JGraph jgraph;
- private ObservableGraph<ModelNode, IdentifiableEdge> directedGraph;
-
- private MyGraphListener myGraphListener;
-
- private static final String VIEW_REF_WORKFLOW = "View Referrenced";
- private static final String ACTIONS_POP_MENU_NAME = "Actions";
- private static final String NEW_SUB_POP_MENU_NAME = "New";
- private static final String NEW_TASK_ITEM_NAME = "Task";
- private static final String NEW_CONDITION_ITEM_NAME = "Condition";
- private static final String NEW_PARALLEL_ITEM_NAME = "Parallel";
- private static final String NEW_SEQUENTIAL_ITEM_NAME = "Sequential";
- private static final String EDGES_SUB_POP_MENU_NAME = "Edges";
- private static final String TASK_LEVEL = "Task Level";
- private static final String WORKFLOW_LEVEL = "Workflow Level";
- private static final String DELETE_ITEM_NAME = "Delete";
- private static final String FORMAT_ITEM_NAME = "Format";
- private static final String ORDER_SUB_POP_MENU_NAME = "Order";
- private static final String TO_FRONT_ITEM_NAME = "Move To Front";
- private static final String TO_BACK_ITEM_NAME = "Move To Back";
- private static final String FORWARD_ITEM_NAME = "Move Forward";
- private static final String BACKWARDS_ITEM_NAME = "Move Backwards";
-
- private ConcurrentHashMap<String, Pair> edgeMap;
-
- private static final String SCALE = "GraphView/scale";
- private static final String EDGE_DISPLAY_MODE = "GraphView/EdgeDisplay/Mode";
- private static final String TASK_MODE = "Task";
- private static final String WORKFLOW_MODE = "Workflow";
-
- private boolean scrollSelectedToVisible = false;
-
- public GraphView(String name) {
- super(name);
- }
-
- @Override
- public void refreshView(final ViewState state) {
- this.removeAll();
- this.myGraphListener = new MyGraphListener(state);
-
- Rectangle visible = null;
- if (jgraph != null) {
- visible = jgraph.getVisibleRect();
- }
-
- Cursor cursor = null;
- if (jgraph != null) {
- cursor = jgraph.getCursor();
- }
-
- this.edgeMap = new ConcurrentHashMap<String, Pair>();
-
- directedGraph = new ObservableGraph<ModelNode, IdentifiableEdge>(
- new DirectedSparseGraph<ModelNode, IdentifiableEdge>());
- m_jgAdapter = new JungJGraphModelAdapter(directedGraph);
-
- jgraph = new JGraph(m_jgAdapter);
- for (MouseListener ml : jgraph.getMouseListeners()) {
- jgraph.removeMouseListener(ml);
- }
- for (MouseMotionListener ml : jgraph.getMouseMotionListeners()) {
- jgraph.removeMouseMotionListener(ml);
- }
- for (MouseWheelListener ml : jgraph.getMouseWheelListeners()) {
- jgraph.removeMouseWheelListener(ml);
- }
- jgraph.setBackground(Color.white);
- jgraph.setAntiAliased(true);
- jgraph.setMoveable(false);
- String scale = state.getFirstPropertyValue(SCALE);
- if (scale == null) {
- state.setProperty(SCALE, scale = "1.0");
- }
- jgraph.setScale(Double.parseDouble(scale));
-
- DragSource dragSource = DragSource.getDefaultDragSource();
- dragSource.createDefaultDragGestureRecognizer(this.jgraph,
- DnDConstants.ACTION_MOVE, new DragGestureListener() {
-
- DefaultGraphCell moveCell = null;
- ModelGraph moveGraph = null;
-
- public void dragGestureRecognized(final DragGestureEvent dge) {
- if (state.getMode() == View.Mode.MOVE
- || state.getMode() == View.Mode.EDIT) {
- Object moveOverCell = jgraph.getFirstCellForLocation(dge
- .getDragOrigin().getX(), dge.getDragOrigin().getY());
- if (moveOverCell != null) {
- if (moveOverCell instanceof DefaultEdge) {
- moveCell = null;
- } else if (moveOverCell instanceof DefaultGraphCell) {
- moveCell = (DefaultGraphCell) moveOverCell;
- moveGraph = GuiUtils.find(state.getGraphs(),
- ((ModelNode) ((DefaultGraphCell) moveCell)
- .getUserObject()).getId());
-
- if (state.getMode() == View.Mode.MOVE) {
- moveCell = GraphView.this.m_jgAdapter
- .getVertexCell((moveGraph = moveGraph.getRootParent())
- .getModel());
- } else if (GuiUtils.isDummyNode(moveGraph.getModel())) {
- moveCell = GraphView.this.m_jgAdapter
- .getVertexCell((moveGraph = moveGraph.getParent())
- .getModel());
- } else if (moveGraph.getModel().isRef()) {
- while (moveGraph.getParent() != null
- && moveGraph.getParent().getModel().isRef()) {
- moveGraph = moveGraph.getParent();
- }
- moveCell = GraphView.this.m_jgAdapter
- .getVertexCell(moveGraph.getModel());
- }
- final double scale = Double.parseDouble(state
- .getFirstPropertyValue(SCALE));
- final Rectangle2D bounds = (Rectangle2D) GraphView.this.jgraph
- .getAttributes(moveCell).get(GraphConstants.BOUNDS);
- Point offset = new Point(
- (int) (bounds.getX() * scale - dge.getDragOrigin().getX()),
- (int) (bounds.getY() * scale - dge.getDragOrigin().getY()));
- BufferedImage image = new BufferedImage((int) (bounds
- .getWidth() * scale), (int) (bounds.getHeight() * scale),
- BufferedImage.TYPE_INT_ARGB);
- Graphics2D g2d = image.createGraphics();
- g2d.setColor(Color.black);
- g2d.drawRect((int) (2 * scale), (int) (2 * scale),
- (int) ((bounds.getWidth() - 4) * scale),
- (int) ((bounds.getHeight() - 4) * scale));
- dge.startDrag(GraphView.this.getCursor(), image, offset,
- new Transferable() {
-
- public Object getTransferData(DataFlavor flavor)
- throws UnsupportedFlavorException, IOException {
- if (flavor.getHumanPresentableName().equals(
- DefaultGraphCell.class.getSimpleName())) {
- return this;
- } else {
- throw new UnsupportedFlavorException(flavor);
- }
- }
-
- public DataFlavor[] getTransferDataFlavors() {
- return new DataFlavor[] { new DataFlavor(
- DefaultGraphCell.class, DefaultGraphCell.class
- .getSimpleName()) };
- }
-
- public boolean isDataFlavorSupported(DataFlavor flavor) {
- return flavor.getHumanPresentableName().equals(
- DefaultGraphCell.class.getSimpleName());
- }
-
- }, new DragSourceListener() {
-
- private ModelGraph mouseOverGraph;
- private DefaultGraphCell mouseOverCell;
-
- public void dragDropEnd(DragSourceDropEvent dsde) {
- System.out.println("DRAG END!!!!");
- if (moveCell == null) {
- return;
- }
- Point dropPoint = new Point(dsde.getX()
- - jgraph.getLocationOnScreen().x, dsde.getY()
- - jgraph.getLocationOnScreen().y);
- DefaultGraphCell endCell = (DefaultGraphCell) GraphView.this.jgraph
- .getSelectionCell();
- if (endCell != null) {
- ModelGraph endGraph = GuiUtils.find(
- state.getGraphs(),
- ((ModelNode) endCell.getUserObject()).getId());
- if (!endGraph.getModel().isParentType()
- || GuiUtils.isSubGraph(moveGraph, endGraph)) {
- return;
- }
- if (moveGraph.getParent() == null) {
- state.removeGraph(moveGraph);
- } else {
- GuiUtils.removeNode(state.getGraphs(),
- moveGraph.getModel());
- }
- GraphView.this.removeShift(state, moveGraph);
- GuiUtils.addChild(state.getGraphs(), endGraph
- .getModel().getId(), moveGraph);
- GraphView.this.notifyListeners();
- } else {
- if (moveGraph.getParent() != null) {
- GuiUtils.removeNode(state.getGraphs(),
- moveGraph.getModel());
- state.addGraph(moveGraph);
- }
- Point shiftPoint = new Point(
- (int) ((dropPoint.x - (dge.getDragOrigin().x - (bounds
- .getX() * scale))) / scale),
- (int) ((dropPoint.y - (dge.getDragOrigin().y - (bounds
- .getY() * scale))) / scale));
- GraphView.this.setShift(state, moveGraph,
- shiftPoint);
- GraphView.this.notifyListeners();
- }
- }
-
- public void dragEnter(DragSourceDragEvent dsde) {
- mouseOverCell = (DefaultGraphCell) GraphView.this.jgraph
- .getFirstCellForLocation(
- dsde.getX() - jgraph.getLocationOnScreen().x,
- dsde.getY() - jgraph.getLocationOnScreen().y);
- mouseOverGraph = GuiUtils.find(state.getGraphs(),
- ((ModelNode) mouseOverCell.getUserObject())
- .getId());
- }
-
- public void dragExit(DragSourceEvent dse) {
- System.out.println("DRAG EXIT!!!!");
- }
-
- public void dragOver(DragSourceDragEvent dsde) {
- if (state.getMode().equals(Mode.EDIT)) {
- if (mouseOverCell != null) {
- Rectangle2D currentBounds = (Rectangle2D) mouseOverCell
- .getAttributes().get(GraphConstants.BOUNDS);
- Point currentPoint = new Point(dsde.getX()
- - jgraph.getLocationOnScreen().x, dsde.getY()
- - jgraph.getLocationOnScreen().y);
- if (currentBounds.contains(currentPoint)) {
- for (ModelGraph child : mouseOverGraph
- .getChildren()) {
- DefaultGraphCell mouseOverCellLoc = GraphView.this.m_jgAdapter
- .getVertexCell(child.getModel());
- currentBounds = (Rectangle2D) mouseOverCellLoc
- .getAttributes().get(
- GraphConstants.BOUNDS);
- if (currentBounds.contains(currentPoint)) {
- mouseOverCell = mouseOverCellLoc;
- mouseOverGraph = child;
- break;
- }
- }
- } else {
- if (mouseOverGraph.getParent() != null
- && (!mouseOverGraph.isCondition() || (mouseOverGraph
- .isCondition() && mouseOverGraph
- .getParent().isCondition()))) {
- mouseOverCell = GraphView.this.m_jgAdapter
- .getVertexCell((mouseOverGraph = mouseOverGraph
- .getParent()).getModel());
- currentBounds = (Rectangle2D) mouseOverCell
- .getAttributes().get(
- GraphConstants.BOUNDS);
- } else {
- mouseOverCell = null;
- mouseOverGraph = null;
- }
- }
- } else {
- mouseOverCell = (DefaultGraphCell) GraphView.this.jgraph
- .getFirstCellForLocation(
- dsde.getX()
- - jgraph.getLocationOnScreen().x,
- dsde.getY()
- - jgraph.getLocationOnScreen().y);
- if (mouseOverCell != null) {
- mouseOverGraph = GuiUtils.find(state
- .getGraphs(), ((ModelNode) mouseOverCell
- .getUserObject()).getId());
- } else {
- mouseOverGraph = null;
- }
- }
- if (mouseOverGraph != null) {
- if (GuiUtils.isDummyNode(mouseOverGraph
- .getModel())) {
- mouseOverGraph = mouseOverGraph.getParent();
- } else {
- while (mouseOverGraph != null
- && mouseOverGraph.getModel().isRef()) {
- mouseOverGraph = mouseOverGraph.getParent();
- }
- }
- if (mouseOverGraph != null) {
- mouseOverCell = GraphView.this.m_jgAdapter
- .getVertexCell(mouseOverGraph.getModel());
- } else {
- mouseOverCell = null;
- }
- }
- GraphView.this.jgraph
- .setSelectionCells(new Object[] { mouseOverCell });
- }
- }
-
- public void dropActionChanged(DragSourceDragEvent dsde) {
- System.out.println("DRAG CHANGE!!!!");
- }
-
- });
- }
- }
- }
- }
-
- });
-
- List<Line> lines = GuiUtils.findLines(state.getGraphs());
- for (Line line : lines) {
- if (!this.directedGraph.containsVertex(line.getFromModel())) {
- this.directedGraph.addVertex(line.getFromModel());
- }
-
- if (line.getToModel() != null) {
- if (!this.directedGraph.containsVertex(line.getToModel())) {
- this.directedGraph.addVertex(line.getToModel());
- }
- IdentifiableEdge edge = new IdentifiableEdge(line.getFromModel(), line.getToModel());
- directedGraph.addEdge(edge, line.getFromModel(), line.getToModel());
- this.edgeMap.put(edge.id, new Pair(line.getFromModel() != null ? line
- .getFromModel().getId() : null, line.getToModel().getId()));
- }
- }
-
- JGraphFacade facade = new JGraphFacade(jgraph);
- facade.setIgnoresUnconnectedCells(false);
- JGraphHierarchicalLayout layout = new JGraphHierarchicalLayout();
- layout.setOrientation(SwingConstants.WEST);
- layout.setIntraCellSpacing(70.0);
- layout.setLayoutFromSinks(false);
- layout.run(facade);
- Map nested = facade.createNestedMap(true, true);
- if (nested != null) {
- this.hideDummyNodes(nested);
- this.addGroups(state.getGraphs(), nested, state);
- this.ensureNoOverlap(nested, state);
- nested = this.shiftMap(nested, state);
- jgraph.getGraphLayoutCache().edit(nested);
- }
-
- String edgeDisplayMode = state.getFirstPropertyValue(EDGE_DISPLAY_MODE);
- if (edgeDisplayMode == null) {
- state.setProperty(EDGE_DISPLAY_MODE, edgeDisplayMode = WORKFLOW_MODE);
- }
- if (edgeDisplayMode.equals(WORKFLOW_MODE)) {
- this.edgeMap = new ConcurrentHashMap<String, Pair>();
- removeAllEdges(this.directedGraph);
- lines = GuiUtils.findSequentialLines(state.getGraphs());
- for (Line line : lines) {
- IdentifiableEdge edge = new IdentifiableEdge(line.getFromModel(), line.getToModel());
- directedGraph.addEdge(edge, line.getFromModel(), line.getToModel());
- this.edgeMap.put(edge.id, new Pair(line.getFromModel() != null ? line
- .getFromModel().getId() : null, line.getToModel().getId()));
- }
- }
-
- if (state.getSelected() != null) {
- ModelGraph graph = GuiUtils.find(state.getGraphs(), state.getSelected()
- .getModel().getId());
- if (graph != null) {
- DefaultGraphCell cell = this.m_jgAdapter
- .getVertexCell(graph.getModel());
- if (cell != null) {
- this.jgraph.setSelectionCells(new Object[] { cell });
- } else {
- this.jgraph.setSelectionCells(new Object[] {});
- }
- } else {
- this.jgraph.setSelectionCells(new Object[] {});
- }
- } else {
- this.jgraph.setSelectionCells(new Object[] {});
- }
-
- jgraph.addMouseListener(this.myGraphListener);
-
- this.setLayout(new BorderLayout());
- this.add(new JScrollPane(jgraph, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
- JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS), BorderLayout.CENTER);
-
- if (scrollSelectedToVisible && state.getSelected() != null) {
- this.jgraph.scrollCellToVisible(GraphView.this.m_jgAdapter
- .getVertexCell(state.getSelected().getModel()));
- scrollSelectedToVisible = false;
- } else if (visible != null) {
- this.jgraph.scrollRectToVisible(visible);
- }
-
- if (cursor != null) {
- this.jgraph.setCursor(cursor);
- }
-
- this.revalidate();
- }
-
- private void hideDummyNodes(Map nested) {
- for (Object cell : nested.keySet()) {
- if (cell instanceof DefaultEdge) {
- // do nothing
- } else if (cell instanceof DefaultGraphCell) {
- if (GuiUtils.isDummyNode((ModelNode) ((DefaultGraphCell) cell)
- .getUserObject())) {
- ((Map<Object, Object>) nested.get(cell)).put("opaque", false);
- ((Map<Object, Object>) nested.get(cell)).put("backgroundColor",
- Color.white);
- }
- }
- }
- }
-
- private Map shiftMap(Map nested, ViewState state) {
- Map shiftedNested = new Hashtable(nested);
- for (Object obj : shiftedNested.entrySet()) {
- Entry entry = (Entry) obj;
- if (entry.getKey() instanceof DefaultEdge) {
- ArrayList<Point2D.Double> points = (ArrayList<Point2D.Double>) ((Map<Object, Object>) entry
- .getValue()).get("points");
- ArrayList<Point2D.Double> newPoints = new ArrayList<Point2D.Double>();
- Point shift = this.getShift(state, (DefaultGraphCell) entry.getKey(),
- nested);
- for (Point2D.Double point : points) {
- newPoints
- .add(new Point2D.Double(point.x + shift.x, point.y + shift.y));
- }
- ((Map<Object, Object>) entry.getValue()).put("points", newPoints);
- } else if (entry.getKey() instanceof DefaultGraphCell) {
- DefaultGraphCell cell = (DefaultGraphCell) entry.getKey();
- Rectangle2D bounds = (Rectangle2D) ((Map<Object, Object>) entry
- .getValue()).get("bounds");
- Point shift = this.getShift(state, cell, nested);
- AttributeMap.SerializableRectangle2D newBounds = new AttributeMap.SerializableRectangle2D(
- bounds.getX() + shift.x, bounds.getY() + shift.y,
- bounds.getWidth(), bounds.getHeight());
- Map<Object, Object> newMap = new Hashtable<Object, Object>(
- (Map<Object, Object>) entry.getValue());
- newMap.put("bounds", newBounds);
- shiftedNested.put(cell, newMap);
- }
- }
- return shiftedNested;
- }
-
- private void ensureNoOverlap(Map nested, ViewState state) {
- boolean changed;
- do {
- changed = false;
- for (int i = 0; i < state.getGraphs().size(); i++) {
- ModelGraph currentGraph = state.getGraphs().get(i);
- if (this.ensureNoInternalOverlap(currentGraph, nested)) {
- changed = true;
- }
- DefaultGraphCell currentCell = this.m_jgAdapter
- .getVertexCell(currentGraph.getModel());
- Rectangle2D currentBounds = (Rectangle2D) ((Map) nested
- .get(currentCell)).get(GraphConstants.BOUNDS);
- Point currentShift = this.getShift(state, currentCell, nested);
- Rectangle currentShiftBounds = new Rectangle(
- (int) (currentBounds.getX() + currentShift.getX()),
- (int) (currentBounds.getY() + currentShift.getY()),
- (int) currentBounds.getWidth(), (int) currentBounds.getHeight());
- for (int j = 0; j < state.getGraphs().size(); j++) {
- if (i == j) {
- continue;
- }
- ModelGraph graph = state.getGraphs().get(j);
- DefaultGraphCell cell = this.m_jgAdapter.getVertexCell(graph
- .getModel());
- Rectangle2D bounds = (Rectangle2D) ((Map) nested.get(cell))
- .get(GraphConstants.BOUNDS);
- Point shift = this.getShift(state, cell, nested);
- Rectangle shiftBounds = new Rectangle(
- (int) (bounds.getX() + shift.getX()),
- (int) (bounds.getY() + shift.getY()), (int) bounds.getWidth(),
- (int) bounds.getHeight());
- if (currentShiftBounds.intersects(shiftBounds)) {
- changed = true;
- if (currentShiftBounds.getY() < shiftBounds.getY()) {
- Rectangle intersection = currentShiftBounds
- .intersection(shiftBounds);
- if (currentShiftBounds.getY() + currentShiftBounds.getHeight() > shiftBounds
- .getY() + shiftBounds.getHeight()) {
- this.setShift(state, graph,
- new Point((int) (currentShiftBounds.getX()
- + currentShiftBounds.getWidth() + 20.0),
- (int) shiftBounds.getY()));
- } else {
- this.setShift(
- state,
- graph,
- new Point((int) shiftBounds.getX(), (int) (shiftBounds
- .getY() + intersection.getHeight() + 20.0)));
- }
- } else {
- Rectangle intersection = shiftBounds
- .intersection(currentShiftBounds);
- if (shiftBounds.getY() + shiftBounds.getHeight() > currentShiftBounds
- .getY() + currentShiftBounds.getHeight()) {
- this.setShift(
- state,
- currentGraph,
- new Point((int) (shiftBounds.getX()
- + shiftBounds.getWidth() + 20.0),
- (int) currentShiftBounds.getY()));
- } else {
- this.setShift(
- state,
- currentGraph,
- new Point((int) currentShiftBounds.getX(),
- (int) (currentShiftBounds.getY()
- + intersection.getHeight() + 20.0)));
- }
-
- currentShift = this.getShift(state, currentCell, nested);
- currentShiftBounds = new Rectangle(
- (int) (currentBounds.getX() + currentShift.getX()),
- (int) (currentBounds.getY() + currentShift.getY()),
- (int) currentBounds.getWidth(),
- (int) currentBounds.getHeight());
- }
- }
- }
- }
- } while (changed);
- }
-
- private boolean ensureNoInternalOverlap(final ModelGraph graph,
- final Map nested) {
- boolean changed = false;
- if (graph.getChildren().size() > 1) {
- List<ModelGraph> sortedChildren = new Vector<ModelGraph>(
- graph.getChildren());
- Collections.sort(sortedChildren, new Comparator<ModelGraph>() {
-
- public int compare(ModelGraph o1, ModelGraph o2) {
- DefaultGraphCell child1Cell = GraphView.this.m_jgAdapter
- .getVertexCell(o1.getModel());
- DefaultGraphCell child2Cell = GraphView.this.m_jgAdapter
- .getVertexCell(o2.getModel());
- Rectangle2D child1Bounds = (Rectangle2D) ((Map) nested
- .get(child1Cell)).get(GraphConstants.BOUNDS);
- Rectangle2D child2Bounds = (Rectangle2D) ((Map) nested
- .get(child2Cell)).get(GraphConstants.BOUNDS);
- if (graph.getModel().getExecutionType().equals("parallel")) {
- return Double.compare(child1Bounds.getMaxY(),
- child2Bounds.getMaxY());
- } else {
- return Double.compare(child1Bounds.getX(), child2Bounds.getX());
- }
- }
-
- });
- changed = ensureNoInternalOverlap(sortedChildren.get(0), nested);
- Rectangle2D graphRectangle = (Rectangle2D) ((Map) nested
- .get(this.m_jgAdapter.getVertexCell(sortedChildren.get(0).getModel())))
- .get(GraphConstants.BOUNDS);
- for (int i = 1; i < sortedChildren.size(); i++) {
- ModelGraph child2 = sortedChildren.get(i);
- if (ensureNoInternalOverlap(child2, nested)) {
- changed = true;
- }
- DefaultGraphCell child2Cell = this.m_jgAdapter.getVertexCell(child2
- .getModel());
- for (int j = i - 1; j >= 0; j--) {
- ModelGraph child1 = sortedChildren.get(j);
- DefaultGraphCell child1Cell = this.m_jgAdapter.getVertexCell(child1
- .getModel());
- Rectangle2D child1Bounds = (Rectangle2D) ((Map) nested
- .get(child1Cell)).get(GraphConstants.BOUNDS);
- Rectangle2D child2Bounds = (Rectangle2D) ((Map) nested
- .get(child2Cell)).get(GraphConstants.BOUNDS);
- if (child1Bounds.intersects(child2Bounds)) {
- changed = true;
- if (graph.getModel().getExecutionType().equals("parallel")) {
- ((Map) nested.get(child2Cell)).put(GraphConstants.BOUNDS,
- new AttributeMap.SerializableRectangle2D(child2Bounds.getX(),
- child1Bounds.getMaxY() + 20.0, child2Bounds.getWidth(),
- child2Bounds.getHeight()));
- this.shift(child2.getChildren(), nested, 0,
- child1Bounds.getMaxY() + 20.0 - child2Bounds.getY());
- } else {
- ((Map) nested.get(child2Cell)).put(
- GraphConstants.BOUNDS,
- new AttributeMap.SerializableRectangle2D(child1Bounds
- .getMaxX() + 20.0, child2Bounds.getY(), child2Bounds
- .getWidth(), child2Bounds.getHeight()));
- this.shift(child2.getChildren(), nested, child1Bounds.getMaxX()
- + 20.0 - child2Bounds.getX(), 0);
- }
- }
- }
- graphRectangle = graphRectangle.createUnion((Rectangle2D) ((Map) nested
- .get(child2Cell)).get(GraphConstants.BOUNDS));
- }
- ((Map) nested.get(this.m_jgAdapter.getVertexCell(graph.getModel()))).put(
- GraphConstants.BOUNDS, new AttributeMap.SerializableRectangle2D(
- graphRectangle.getX() - 5, graphRectangle.getY() - 20,
- graphRectangle.getWidth() + 10, graphRectangle.getHeight() + 25));
- }
- return changed;
- }
-
- private void shift(List<ModelGraph> graphs, Map nested, double x, double y) {
- for (ModelGraph graph : graphs) {
- DefaultGraphCell cell = this.m_jgAdapter.getVertexCell(graph.getModel());
- Rectangle2D bounds = (Rectangle2D) ((Map) nested.get(cell))
- .get(GraphConstants.BOUNDS);
- ((Map) nested.get(cell)).put(
- GraphConstants.BOUNDS,
- new AttributeMap.SerializableRectangle2D(bounds.getX() + x, bounds
- .getY() + y, bounds.getWidth(),
- bounds.getHeight()));
- this.shift(graph.getChildren(), nested, x, y);
- }
- }
-
- private void addGroups(List<ModelGraph> modelGraphs, Map nested,
- ViewState state) {
- for (ModelGraph modelGraph : modelGraphs) {
- this.addGroups(modelGraph, nested, state);
- }
- }
-
- private DefaultGraphCell addGroups(ModelGraph modelGraph, Map nested,
- ViewState state) {
- if (modelGraph.getModel().isParentType()) {
- double top_x = Double.MAX_VALUE, top_y = Double.MAX_VALUE, bottom_x = 0.0, bottom_y = 0.0;
- this.directedGraph.addVertex(modelGraph.getModel());
- DefaultGraphCell modelCell = this.m_jgAdapter.getVertexCell(modelGraph
- .getModel());
-
-
- ConcurrentHashMap<Object, Object> map = new ConcurrentHashMap<Object, Object>();
- for (int i = 0; i < modelGraph.getChildren().size(); i++) {
- ModelGraph child = modelGraph.getChildren().get(i);
- DefaultGraphCell curCell = addGroups(child, nested, state);
- Rectangle2D bounds = (Rectangle2D) ((Map<Object, Object>) nested
- .get(curCell)).get("bounds");
- if (bounds.getX() < top_x) {
- top_x = bounds.getX();
- }
- if (bounds.getY() < top_y) {
- top_y = bounds.getY();
- }
- if (bounds.getMaxX() > bottom_x) {
- bottom_x = bounds.getMaxX();
- }
- if (bounds.getMaxY() > bottom_y) {
- bottom_y = bounds.getMaxY();
- }
- }
-
- map.put(GraphConstants.BOUNDS, new AttributeMap.SerializableRectangle2D(
- top_x - 5, top_y - 20, bottom_x - top_x + 10, bottom_y - top_y + 25));
- map.put(GraphConstants.FOREGROUND, Color.black);
- if (modelGraph.getModel().isRef()) {
- map.put(GraphConstants.BACKGROUND, Color.lightGray);
- } else {
- map.put(GraphConstants.BACKGROUND, Color.white);
- }
- if (modelGraph.isExcused()) {
- map.put(GraphConstants.GRADIENTCOLOR, Color.gray);
- }
- map.put(GraphConstants.HORIZONTAL_ALIGNMENT, SwingConstants.LEFT);
- map.put(GraphConstants.VERTICAL_ALIGNMENT, SwingConstants.TOP);
- map.put(GraphConstants.BORDER, new LineBorder(modelGraph.getModel()
- .getColor(), 1));
- jgraph.getGraphLayoutCache().toBack(new Object[] { modelCell });
- nested.put(modelCell, map);
- return modelCell;
- }
- DefaultGraphCell cell = this.m_jgAdapter.getVertexCell(modelGraph
- .getModel());
- ((Map<Object, Object>) nested.get(cell)).put(GraphConstants.FOREGROUND,
- Color.black);
- if (modelGraph.isExcused()) {
- ((Map<Object, Object>) nested.get(cell)).put(
- GraphConstants.GRADIENTCOLOR, Color.gray);
- } else {
- ((Map<Object, Object>) nested.get(cell)).put(
- GraphConstants.GRADIENTCOLOR, Color.white);
- }
- if (!((ModelNode) ((DefaultGraphCell) cell).getUserObject()).isRef()) {
- ((Map<Object, Object>) nested.get(cell)).put(GraphConstants.BACKGROUND,
- modelGraph.getModel().getColor());
- } else {
- ((Map<Object, Object>) nested.get(cell)).put(GraphConstants.BACKGROUND,
- Color.lightGray);
- }
- return cell;
- }
-
- private void removeAllEdges(ObservableGraph<ModelNode, IdentifiableEdge> graph){
- List<IdentifiableEdge> edges = new Vector<IdentifiableEdge>();
-
- for(IdentifiableEdge edge: graph.getEdges()){
- edges.add(edge);
- }
-
- for(IdentifiableEdge edge: edges){
- graph.removeEdge(edge);
- }
- }
-
-
- private class Pair {
- String first, second;
-
- public Pair(String first, String second) {
- this.first = first;
- this.second = second;
- }
-
- public String getFirst() {
- return this.first;
- }
-
- public String getSecond() {
- return this.second;
- }
- }
-
- public class MyGraphListener implements MouseListener, ActionListener {
-
- private Point curPoint;
- private ViewState state;
-
- public MyGraphListener(ViewState state) {
- this.state = state;
- }
-
- public void mouseClicked(MouseEvent e) {
- curPoint = e.getPoint();
- if (e.getButton() == MouseEvent.BUTTON3) {
- Object mouseOverCell = GraphView.this.jgraph.getFirstCellForLocation(
- e.getX(), e.getY());
- ModelGraph mouseOverGraph;
- if (mouseOverCell != null) {
- mouseOverGraph = (GuiUtils.find(state.getGraphs(),
- ((ModelNode) ((DefaultMutableTreeNode) mouseOverCell)
- .getUserObject()).getId()));
- if (mouseOverGraph != null) {
- if (GuiUtils.isDummyNode(mouseOverGraph.getModel())) {
- mouseOverGraph = mouseOverGraph.getParent();
- } else {
- while (mouseOverGraph != null
- && mouseOverGraph.getParent() != null
- && mouseOverGraph.getParent().getModel().isRef()) {
- mouseOverGraph = mouseOverGraph.getParent();
- }
- }
- if (mouseOverGraph != null) {
- mouseOverCell = GraphView.this.m_jgAdapter
- .getVertexCell(mouseOverGraph.getModel());
- }
- }
- state.setSelected(mouseOverGraph);
- } else {
- state.setSelected(null);
- }
- PopupMenu actionsMenu = createActionMenu(state);
- GraphView.this.notifyListeners();
- GraphView.this.jgraph.add(actionsMenu);
- actionsMenu.show(GraphView.this.jgraph, e.getPoint().x, e.getPoint().y);
- } else if (e.getButton() == MouseEvent.BUTTON1) {
- if (state.getMode() == View.Mode.ZOOM_IN) {
- state.setProperty(SCALE, Double.toString(Double.parseDouble(state
- .getFirstPropertyValue(SCALE)) + 0.1));
- state.setSelected(null);
- GraphView.this.notifyListeners();
- } else if (state.getMode() == View.Mode.ZOOM_OUT) {
- state.setProperty(SCALE, Double.toString(Double.parseDouble(state
- .getFirstPropertyValue(SCALE)) - 0.1));
- state.setSelected(null);
- GraphView.this.notifyListeners();
- } else if (state.getMode() == View.Mode.EDIT) {
- Object cell = GraphView.this.jgraph.getFirstCellForLocation(e.getX(),
- e.getY());
- if (cell != null) {
- if (cell instanceof DefaultEdge) {
- } else if (cell instanceof DefaultGraphCell) {
- ModelGraph graph = GuiUtils.find(state.getGraphs(),
- ((ModelNode) ((DefaultGraphCell) cell).getUserObject())
- .getId());
- if (graph.getModel().isRef()) {
- while (graph.getParent() != null
- && graph.getParent().getModel().isRef()) {
- graph = graph.getParent();
- }
- }
- if (GuiUtils.isDummyNode(graph.getModel())) {
- graph = graph.getParent();
- }
- state.setSelected(graph);
- GraphView.this.notifyListeners();
- }
- } else if (cell == null && state.getSelected() != null) {
- state.setSelected(null);
- GraphView.this.notifyListeners();
- }
- } else if (state.getMode() == View.Mode.DELETE
- && e.getClickCount() == 2) {
- Object cell = GraphView.this.jgraph.getFirstCellForLocation(e.getX(),
- e.getY());
- if (cell != null) {
- if (cell instanceof DefaultEdge) {
- // do nothing
- } else if (cell instanceof DefaultGraphCell) {
- ModelGraph graph = GuiUtils.removeNode(state.getGraphs(),
- (ModelNode) ((DefaultGraphCell) cell).getUserObject());
- GraphView.this.notifyListeners();
- }
- }
- }
- }
- }
-
- public void mouseEntered(MouseEvent e) {
- if (state.getMode() == View.Mode.ZOOM_IN
- || state.getMode() == View.Mode.ZOOM_OUT) {
- Toolkit toolkit = Toolkit.getDefaultToolkit();
- try {
- GraphView.this.jgraph.setCursor(toolkit.createCustomCursor(
- IconLoader.getIcon(IconLoader.ZOOM_CURSOR), new Point(0, 0),
- "img"));
- } catch (Exception e1) {
- e1.printStackTrace();
- }
- } else if (state.getMode() == Mode.MOVE) {
- GraphView.this.jgraph.setCursor(new Cursor(Cursor.HAND_CURSOR));
- } else {
- GraphView.this.jgraph.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
- }
- }
-
- public void mouseExited(MouseEvent e) {
- }
-
- public void mousePressed(MouseEvent e) {
- }
-
- public void mouseReleased(MouseEvent e) {
- }
-
- public void actionPerformed(ActionEvent e) {
- this.createNewGraph(e.getActionCommand());
- }
-
- private void createNewGraph(String actionCommand) {
- ModelGraph newGraph;
- if (actionCommand.equals(NEW_TASK_ITEM_NAME)) {
- newGraph = new ModelGraph(new ModelNode(state.getFile(),
- GuiUtils.createUniqueName()));
- } else if (actionCommand.equals(NEW_PARALLEL_ITEM_NAME)) {
- ModelNode node = new ModelNode(state.getFile(),
- GuiUtils.createUniqueName());
- node.setExecutionType("parallel");
- newGraph = new ModelGraph(node);
- } else if (actionCommand.equals(NEW_SEQUENTIAL_ITEM_NAME)) {
- ModelNode node = new ModelNode(state.getFile(),
- GuiUtils.createUniqueName());
- node.setExecutionType("sequential");
- newGraph = new ModelGraph(node);
- } else {
- return;
- }
- Object cell = GraphView.this.jgraph.getSelectionCell();
- if (cell != null) {
- if (cell instanceof DefaultGraphCell) {
- ModelGraph graph = GuiUtils.find(state.getGraphs(),
- ((ModelNode) ((DefaultGraphCell) cell).getUserObject()).getId());
- if (graph != null) {
- graph.addChild(newGraph);
- }
- }
- } else {
- state.addGraph(newGraph);
- GraphView.this.setShift(state, newGraph, curPoint);
- }
- GraphView.this.notifyListeners();
- }
-
- }
-
- public void setShift(ViewState state, ModelGraph modelGraph, Point point) {
- state.setProperty(modelGraph.getModel().getId() + "/Shift/x",
- Integer.toString(point.x));
- state.setProperty(modelGraph.getModel().getId() + "/Shift/y",
- Integer.toString(point.y));
- }
-
- public void removeShift(ViewState state, ModelGraph modelGraph) {
- state.removeProperty(modelGraph.getModel().getId() + "/Shift");
- }
-
- public Point getShift(ViewState state, DefaultGraphCell cell, Map nested) {
- ModelGraph graph;
- if (cell instanceof DefaultEdge) {
- IdentifiableEdge edge = (IdentifiableEdge) cell.getUserObject();
- Pair pair = GraphView.this.edgeMap.get(edge.id);
- graph = GuiUtils.find(state.getGraphs(), pair.getFirst());
- } else {
- graph = GuiUtils.find(state.getGraphs(),
- ((ModelNode) cell.getUserObject()).getId());
- }
- ModelGraph parent = GuiUtils.findRoot(state.getGraphs(), graph);
- Point shiftPoint = null;
- if (state.containsProperty(parent.getModel().getId() + "/Shift")) {
- shiftPoint = new Point(Integer.parseInt(state
- .getFirstPropertyValue(parent.getModel().getId() + "/Shift/x")),
- Integer.parseInt(state.getFirstPropertyValue(parent.getModel()
- .getId() + "/Shift/y")));
- }
- if (shiftPoint == null) {
- shiftPoint = new Point(100, 100);
- this.setShift(state, parent, shiftPoint);
- return shiftPoint;
- } else {
- Rectangle2D bounds = (Rectangle2D) ((Map<Object, Object>) nested
- .get(GraphView.this.m_jgAdapter.getVertexCell(parent.getModel())))
- .get(GraphConstants.BOUNDS);
- return new Point(shiftPoint.x - (int) bounds.getX(), shiftPoint.y
- - (int) bounds.getY());
- }
- }
-
-
- private PopupMenu createActionMenu(final ViewState state) {
- PopupMenu actionsMenu = new PopupMenu(ACTIONS_POP_MENU_NAME);
- PopupMenu newSubMenu = new PopupMenu(NEW_SUB_POP_MENU_NAME);
- MenuItem taskItem = new MenuItem(NEW_TASK_ITEM_NAME);
- MenuItem condItem = new MenuItem(NEW_CONDITION_ITEM_NAME);
- newSubMenu.add(taskItem);
- newSubMenu.add(condItem);
- newSubMenu.add(new MenuItem(NEW_PARALLEL_ITEM_NAME));
- newSubMenu.add(new MenuItem(NEW_SEQUENTIAL_ITEM_NAME));
- newSubMenu.addActionListener(this.myGraphListener);
- actionsMenu.add(newSubMenu);
- MenuItem viewReferrencedWorkflow = new MenuItem(VIEW_REF_WORKFLOW);
- actionsMenu.add(viewReferrencedWorkflow);
- MenuItem deleteItem = new MenuItem(DELETE_ITEM_NAME);
- actionsMenu.add(deleteItem);
- MenuItem formatItem = new MenuItem(FORMAT_ITEM_NAME);
- actionsMenu.add(formatItem);
-
- PopupMenu orderSubMenu = new PopupMenu(ORDER_SUB_POP_MENU_NAME);
-
- ModelGraph modelGraph = state.getSelected();
- newSubMenu.setEnabled(modelGraph == null
- || modelGraph.getModel().isParentType());
- deleteItem.setEnabled(modelGraph != null);
- formatItem.setEnabled(true);
- if (modelGraph != null) {
- viewReferrencedWorkflow.setEnabled(modelGraph.getModel().isRef());
- taskItem.setEnabled(!modelGraph.isCondition());
- condItem.setEnabled(modelGraph.isCondition());
- orderSubMenu.setEnabled(modelGraph.getParent() != null
- && !(modelGraph.isCondition() && !modelGraph.getParent()
- .isCondition()));
- } else {
- boolean isCondition = false;
- if (state.getGraphs().size() > 0) {
- isCondition = state.getGraphs().get(0).isCondition();
- }
- viewReferrencedWorkflow.setEnabled(false);
- taskItem.setEnabled(!isCondition);
- condItem.setEnabled(isCondition);
- }
-
- actionsMenu.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- if (e.getActionCommand().equals(DELETE_ITEM_NAME)) {
- GuiUtils.removeNode(state.getGraphs(), state.getSelected().getModel());
- state.setSelected(null);
- GraphView.this.notifyListeners();
- } else if (e.getActionCommand().equals(FORMAT_ITEM_NAME)) {
- GraphView.this.refreshView(state);
- } else if (e.getActionCommand().equals(VIEW_REF_WORKFLOW)) {
- scrollSelectedToVisible = true;
- GraphView.this.notifyListeners(new ViewChange.VIEW_MODEL(state
- .getSelected().getModel().getModelId(), GraphView.this));
- }
- }
- });
- PopupMenu edgesSubMenu = new PopupMenu(EDGES_SUB_POP_MENU_NAME);
- edgesSubMenu.add(new MenuItem(TASK_LEVEL));
- edgesSubMenu.add(new MenuItem(WORKFLOW_LEVEL));
- actionsMenu.add(edgesSubMenu);
- edgesSubMenu.addActionListener(new ActionListener() {
-
- public void actionPerformed(ActionEvent e) {
- if (e.getActionCommand().equals(TASK_LEVEL)) {
- state.setProperty(EDGE_DISPLAY_MODE, TASK_MODE);
- } else if (e.getActionCommand().equals(WORKFLOW_LEVEL)) {
- state.setProperty(EDGE_DISPLAY_MODE, WORKFLOW_MODE);
- }
- GraphView.this.refreshView(state);
- }
-
- });
- actionsMenu.add(orderSubMenu);
- orderSubMenu.add(new MenuItem(TO_FRONT_ITEM_NAME));
- orderSubMenu.add(new MenuItem(TO_BACK_ITEM_NAME));
- orderSubMenu.add(new MenuItem(FORWARD_ITEM_NAME));
- orderSubMenu.add(new MenuItem(BACKWARDS_ITEM_NAME));
- orderSubMenu.addActionListener(new ActionListener() {
-
- public void actionPerformed(ActionEvent e) {
- ModelGraph graph = state.getSelected();
- ModelGraph parent = graph.getParent();
- if (e.getActionCommand().equals(TO_FRONT_ITEM_NAME)) {
- if (parent.getChildren().remove(graph)) {
- parent.getChildren().add(0, graph);
- }
- } else if (e.getActionCommand().equals(TO_BACK_ITEM_NAME)) {
- if (parent.getChildren().remove(graph)) {
- parent.getChildren().add(graph);
- }
- } else if (e.getActionCommand().equals(FORWARD_ITEM_NAME)) {
- int index = parent.getChildren().indexOf(graph);
- if (index != -1) {
- parent.getChildren().remove(index);
- parent.getChildren().add(
- Math.min(parent.getChildren().size(), index + 1), graph);
- }
- } else if (e.getActionCommand().equals(BACKWARDS_ITEM_NAME)) {
- int index = parent.getChildren().indexOf(graph);
- if (index != -1) {
- parent.getChildren().remove(index);
- parent.getChildren().add(Math.max(0, index - 1), graph);
- }
- }
- GraphView.this.notifyListeners();
- }
-
- });
- return actionsMenu;
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/IdentifiableEdge.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/IdentifiableEdge.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/IdentifiableEdge.java
deleted file mode 100644
index c14175b..0000000
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/IdentifiableEdge.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.workflow.gui.perspective.view.impl;
-
-//JDK imports
-import java.util.UUID;
-
-import org.apache.oodt.cas.workflow.gui.model.ModelNode;
-
-/**
- *
- * An ID'ed edge identified by {@link UUID#randomUUID()}.
- *
- * @author bfoster
- * @author mattmann
- *
- */
-public class IdentifiableEdge {
-
- String id;
-
- ModelNode from;
-
- ModelNode to;
-
- public IdentifiableEdge(ModelNode from, ModelNode to) {
- id = UUID.randomUUID().toString();
- this.from = from;
- this.to = to;
- }
-
- public String toString() {
- return "";
- }
-
- /**
- * @return the id
- */
- public String getId() {
- return id;
- }
-
- /**
- * @param id the id to set
- */
- public void setId(String id) {
- this.id = id;
- }
-
- /**
- * @return the from
- */
- public ModelNode getFrom() {
- return from;
- }
-
- /**
- * @param from the from to set
- */
- public void setFrom(ModelNode from) {
- this.from = from;
- }
-
- /**
- * @return the to
- */
- public ModelNode getTo() {
- return to;
- }
-
- /**
- * @param to the to to set
- */
- public void setTo(ModelNode to) {
- this.to = to;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/JungJGraphModelAdapter.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/JungJGraphModelAdapter.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/JungJGraphModelAdapter.java
deleted file mode 100644
index 71a6cf5..0000000
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/JungJGraphModelAdapter.java
+++ /dev/null
@@ -1,246 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.workflow.gui.perspective.view.impl;
-
-//JDK imports
-import java.awt.Color;
-import java.awt.Font;
-import java.awt.geom.Rectangle2D;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.swing.BorderFactory;
-
-//OODT imports
-import org.apache.oodt.cas.workflow.gui.model.ModelNode;
-
-//JGraph imports
-import org.jgraph.event.GraphModelEvent;
-import org.jgraph.event.GraphModelListener;
-import org.jgraph.graph.AttributeMap;
-import org.jgraph.graph.ConnectionSet;
-import org.jgraph.graph.DefaultEdge;
-import org.jgraph.graph.DefaultGraphCell;
-import org.jgraph.graph.DefaultGraphModel;
-import org.jgraph.graph.DefaultPort;
-import org.jgraph.graph.GraphConstants;
-
-//Jung imports
-import edu.uci.ics.jung.graph.ObservableGraph;
-import edu.uci.ics.jung.graph.event.GraphEvent;
-import edu.uci.ics.jung.graph.event.GraphEventListener;
-
-/**
- *
- * This class integrates OODT, Jung and JGraph.
- *
- * Not necessarily in that order. It acts as a facade, wrapping a Jung graph
- * (and its modifications) and then using that to update the current state of
- * the associated JGraph model.
- *
- * @author mattmann
- *
- */
-public class JungJGraphModelAdapter extends DefaultGraphModel {
-
- private static final long serialVersionUID = 205647349848965651L;
-
- private ObservableGraph<ModelNode, IdentifiableEdge> jungGraph;
-
- private Map<String, DefaultGraphCell> cellMap;
-
- private static final Logger LOG = Logger
- .getLogger(JungJGraphModelAdapter.class.getName());
-
- public JungJGraphModelAdapter(
- final ObservableGraph<ModelNode, IdentifiableEdge> jungGraph) {
- this.jungGraph = jungGraph;
- this.jungGraph.addGraphEventListener(new WorkflowChangeListener(this));
- this.cellMap = new ConcurrentHashMap<String, DefaultGraphCell>();
- this.addGraphModelListener(new GraphModelListener() {
-
- @Override
- public void graphChanged(GraphModelEvent e) {
- Object[] added = e.getChange().getInserted();
- Object[] removed = e.getChange().getRemoved();
- Object[] changed = e.getChange().getChanged();
-
- if (added != null && added.length > 0) {
- for (Object a : added) {
- LOG.log(Level.FINE, "Jgraph notification of object added: ["
- + a.getClass().getName() + "]");
-
- if (a instanceof org.jgraph.graph.DefaultEdge) {
- LOG.log(Level.FINE, "Edge added to jgraph");
- org.jgraph.graph.DefaultEdge edge = (org.jgraph.graph.DefaultEdge) a;
- if (!jungGraph.getEdges().contains(edge.getUserObject())) {
- jungGraph.addEdge(
- new IdentifiableEdge((ModelNode) edge.getSource(),
- (ModelNode) edge.getTarget()), (ModelNode) edge
- .getSource(), (ModelNode) edge.getTarget());
- }
- } else if (a instanceof org.jgraph.graph.DefaultGraphCell) {
- LOG.log(Level.FINE, "Vertex added to jgraph");
- org.jgraph.graph.DefaultGraphCell cell = (org.jgraph.graph.DefaultGraphCell) a;
-
- if (!jungGraph.getVertices().contains(cell.getUserObject())) {
- jungGraph.addVertex((ModelNode) cell.getUserObject());
- }
- }
- }
- }
-
- if (removed != null && removed.length > 0) {
- for (Object r : removed) {
- LOG.log(Level.FINE, "Jgraph notification of object removed: ["
- + r.getClass().getName() + "]");
-
- if (r instanceof org.jgraph.graph.DefaultEdge) {
- LOG.log(Level.FINE, "Edge removed from jgraph");
- org.jgraph.graph.DefaultEdge edge = (org.jgraph.graph.DefaultEdge) r;
- if (jungGraph.getEdges().contains(edge.getUserObject())) {
- jungGraph.removeEdge((IdentifiableEdge) edge.getUserObject());
- }
- } else if (r instanceof org.jgraph.graph.DefaultGraphCell) {
- LOG.log(Level.FINE, "Vertex removed from jgraph");
- org.jgraph.graph.DefaultGraphCell cell = (org.jgraph.graph.DefaultGraphCell) r;
-
- if (jungGraph.getVertices().contains(cell.getUserObject())) {
- jungGraph.removeVertex((ModelNode) cell.getUserObject());
- }
- }
- }
- }
-
- }
- });
-
- }
-
- public DefaultGraphCell getVertexCell(ModelNode node) {
- if (cellMap.get(node.getId()) != null) {
- return cellMap.get(node.getId());
- }
-
- DefaultGraphCell cell = new DefaultGraphCell(node);
- cell.add(new DefaultPort());
- return cell;
- }
-
- private AttributeMap getEdgeAttributes(DefaultEdge edge) {
- AttributeMap eMap = new AttributeMap();
- GraphConstants.setLineEnd(eMap, GraphConstants.ARROW_TECHNICAL);
- GraphConstants.setEndFill(eMap, true);
- GraphConstants.setEndSize(eMap, 10);
- GraphConstants.setForeground(eMap, Color.decode("#25507C"));
- GraphConstants.setFont(eMap,
- GraphConstants.DEFAULTFONT.deriveFont(Font.BOLD, 12));
- GraphConstants.setLineColor(eMap, Color.decode("#7AA1E6"));
- AttributeMap map = new AttributeMap();
- map.put(edge, eMap);
- return map;
- }
-
- private AttributeMap getVertexAttributes(DefaultGraphCell cell) {
- AttributeMap vMap = new AttributeMap();
-
- Color c = Color.decode("#FF9900");
- GraphConstants.setBounds(vMap, new Rectangle2D.Double(50, 50, 90, 30));
- GraphConstants.setBorder(vMap, BorderFactory.createRaisedBevelBorder());
- GraphConstants.setBackground(vMap, c);
- GraphConstants.setForeground(vMap, Color.white);
- GraphConstants.setFont(vMap,
- GraphConstants.DEFAULTFONT.deriveFont(Font.BOLD, 12));
- GraphConstants.setOpaque(vMap, true);
-
- AttributeMap map = new AttributeMap();
- map.put(cell, vMap);
- return map;
- }
-
- private class WorkflowChangeListener implements
- GraphEventListener<ModelNode, IdentifiableEdge> {
-
- private JungJGraphModelAdapter adapter;
-
- public WorkflowChangeListener(JungJGraphModelAdapter adapter) {
- this.adapter = adapter;
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * edu.uci.ics.jung.graph.event.GraphEventListener#handleGraphEvent(edu.
- * uci.ics.jung.graph.event.GraphEvent)
- */
- @Override
- public void handleGraphEvent(GraphEvent<ModelNode, IdentifiableEdge> e) {
- if (e.getType().equals(GraphEvent.Type.EDGE_ADDED)) {
- LOG.log(Level.FINE, "EDGE ADDED!");
- GraphEvent.Edge<ModelNode, IdentifiableEdge> event = (GraphEvent.Edge<ModelNode, IdentifiableEdge>) e;
- addJGraphEdge(event.getEdge());
- } else if (e.getType().equals(GraphEvent.Type.EDGE_REMOVED)) {
- LOG.log(Level.FINE, "EDGE REMOVED!");
- } else if (e.getType().equals(GraphEvent.Type.VERTEX_ADDED)) {
- LOG.log(Level.FINE, "VERTEX ADDED!");
- GraphEvent.Vertex<ModelNode, IdentifiableEdge> event = (GraphEvent.Vertex<ModelNode, IdentifiableEdge>) e;
- addJGraphVertex(event.getVertex());
- } else if (e.getType().equals(GraphEvent.Type.VERTEX_REMOVED)) {
- LOG.log(Level.FINE, "VERTEX REMOVED!");
- }
-
- }
-
- }
-
- private void addJGraphVertex(ModelNode node) {
- DefaultGraphCell cell = new DefaultGraphCell(node);
- cell.add(new DefaultPort());
- insert(new Object[] { cell }, getVertexAttributes(cell), null, null, null);
- cellMap.put(node.getId(), cell);
- }
-
- private void addJGraphEdge(IdentifiableEdge e) {
- ConnectionSet set = new ConnectionSet();
- DefaultEdge theEdge = new DefaultEdge(e);
- DefaultGraphCell from;
- DefaultGraphCell to;
- String fromVertexId = e.getFrom().getId();
- String toVertexId = e.getTo().getId();
- if (!cellMap.containsKey(fromVertexId)) {
- addJGraphVertex(e.getFrom());
- }
- from = cellMap.get(fromVertexId);
-
- if (!cellMap.containsKey(toVertexId)) {
- addJGraphVertex(e.getTo());
- }
-
- to = cellMap.get(toVertexId);
-
- set.connect(theEdge, (DefaultPort) from.getChildAt(0),
- (DefaultPort) to.getChildAt(0));
- insert(new Object[] { theEdge }, getEdgeAttributes(theEdge), set, null,
- null);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/TreeProjectView.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/TreeProjectView.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/TreeProjectView.java
deleted file mode 100644
index 3f7bd5f..0000000
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/TreeProjectView.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.workflow.gui.perspective.view.impl;
-
-//JDK imports
-import java.awt.BorderLayout;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.util.List;
-import javax.swing.JLabel;
-import javax.swing.JScrollPane;
-import javax.swing.JTree;
-import javax.swing.border.EtchedBorder;
-import javax.swing.event.TreeModelEvent;
-import javax.swing.event.TreeModelListener;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.TreePath;
-
-//OODT imports
-import org.apache.oodt.cas.workflow.gui.perspective.view.MultiStateView;
-import org.apache.oodt.cas.workflow.gui.perspective.view.ViewChange;
-import org.apache.oodt.cas.workflow.gui.perspective.view.ViewState;
-
-/**
- *
- *
- * Shows the files/workflows associated with a project in the Workflow Editor
- * GUI.
- *
- * @author bfoster
- * @author mattmann
- *
- */
-public class TreeProjectView extends MultiStateView {
-
- private static final long serialVersionUID = 1867428699533484861L;
-
- private JTree tree;
-
- private ViewState selectedState;
-
- public TreeProjectView(String name) {
- super(name);
- this.setLayout(new BorderLayout());
- }
-
- @Override
- public void refreshView(final ViewState activeState,
- final List<ViewState> states) {
- this.removeAll();
- this.selectedState = activeState;
- DefaultMutableTreeNode selected = null;
- DefaultMutableTreeNode root = new DefaultMutableTreeNode("Projects");
- for (ViewState state : states) {
- if (selectedState != null
- && state.getFile().equals(selectedState.getFile())) {
- root.add(selected = new DefaultMutableTreeNode(state.getFile()
- .getName()));
- } else {
- root.add(new DefaultMutableTreeNode(state.getFile().getName()));
- }
- }
-
- tree = new JTree(root);
- tree.setEditable(true);
- tree.getModel().addTreeModelListener(new TreeModelListener() {
-
- public void treeNodesChanged(TreeModelEvent e) {
- //TODO: something with the view nodes here
- }
-
- public void treeNodesInserted(TreeModelEvent e) {
- }
-
- public void treeNodesRemoved(TreeModelEvent e) {
- }
-
- public void treeStructureChanged(TreeModelEvent e) {
- }
-
- });
- tree.addMouseListener(new MouseListener() {
-
- public void mouseClicked(MouseEvent e) {
- if (e.getButton() == MouseEvent.BUTTON1) {
- if (tree.getSelectionPath() != null) {
- DefaultMutableTreeNode selectedComp = (DefaultMutableTreeNode) tree
- .getSelectionPath().getLastPathComponent();
- String stateName = (String) ((DefaultMutableTreeNode) selectedComp)
- .getUserObject();
- for (ViewState state : states) {
- if (state.getFile().getName().equals(stateName)) {
- selectedState = state;
- if (e.getClickCount() == 2) {
- TreeProjectView.this
- .notifyListeners(new ViewChange.NEW_ACTIVE_STATE(
- selectedState, TreeProjectView.this));
- }
- break;
- }
- }
- }
- }
- }
-
- public void mouseEntered(MouseEvent e) {
- }
-
- public void mouseExited(MouseEvent e) {
- }
-
- public void mousePressed(MouseEvent e) {
- }
-
- public void mouseReleased(MouseEvent e) {
- }
-
- });
- if (selected != null) {
- tree.setSelectionPath(new TreePath(new DefaultMutableTreeNode[] { root,
- selected }));
- } else if (states.size() > 0) {
- tree.setSelectionPath(new TreePath(new DefaultMutableTreeNode[] { root,
- (DefaultMutableTreeNode) root.getChildAt(0) }));
- }
-
- tree.setRootVisible(false);
- this.setBorder(new EtchedBorder());
- JLabel panelName = new JLabel("Workspace Explorer");
- panelName.setBorder(new EtchedBorder());
- this.add(panelName, BorderLayout.NORTH);
- JScrollPane scrollPane = new JScrollPane(tree,
- JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
- JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
- this.add(scrollPane, BorderLayout.CENTER);
-
- this.revalidate();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/toolbox/Tool.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/toolbox/Tool.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/toolbox/Tool.java
deleted file mode 100644
index 4e471bf..0000000
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/toolbox/Tool.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.workflow.gui.toolbox;
-
-//JDK imports
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.Image;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import javax.swing.ImageIcon;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-
-/**
- *
- *
- * One of the tool buttons at the top of the Workflow Editor GUI.
- *
- * @author bfoster
- * @author mattmann
- *
- */
-public abstract class Tool extends JPanel {
-
- private static final long serialVersionUID = -373351385009724404L;
-
- private Image image, selectedImage;
- private boolean selected = false;
- private ToolBox toolBox;
-
- public Tool() {
- this("?");
- }
-
- public Tool(String text) {
- super();
- this.setLayout(new BorderLayout());
- this.add(new JLabel(text), BorderLayout.CENTER);
- this.setup();
- }
-
- public Tool(Image image, Image selectedImage) {
- super();
- this.setLayout(new BorderLayout());
- this.add(new JLabel(new ImageIcon(image)), BorderLayout.CENTER);
- this.image = image;
- this.selectedImage = selectedImage;
- this.setup();
- }
-
- public void setToolBox(ToolBox toolBox) {
- this.toolBox = toolBox;
- }
-
- public boolean isSelected() {
- return this.selected;
- }
-
- public void setSelected(boolean selected) {
- if (image != null) {
- Tool.this.removeAll();
- if (this.selected = selected) {
- Tool.this.add(new JLabel(new ImageIcon(selectedImage)),
- BorderLayout.CENTER);
- } else {
- Tool.this.add(new JLabel(new ImageIcon(image)), BorderLayout.CENTER);
- }
- Tool.this.revalidate();
- }
- }
-
- private void setup() {
- this.setPreferredSize(new Dimension(30, 30));
- this.addMouseListener(new MouseListener() {
-
- public void mouseClicked(MouseEvent e) {
- Tool.this.onClick();
- Tool.this.toolBox.setSelected(Tool.this);
- }
-
- public void mouseEntered(MouseEvent e) {
- if (!selected && selectedImage != null) {
- Tool.this.removeAll();
- Tool.this.add(new JLabel(new ImageIcon(selectedImage)),
- BorderLayout.CENTER);
- Tool.this.revalidate();
- }
- }
-
- public void mouseExited(MouseEvent e) {
- if (!selected && image != null) {
- Tool.this.removeAll();
- Tool.this.add(new JLabel(new ImageIcon(image)), BorderLayout.CENTER);
- Tool.this.revalidate();
- }
- }
-
- public void mousePressed(MouseEvent e) {
- }
-
- public void mouseReleased(MouseEvent e) {
- }
-
- });
- }
-
- public abstract void onClick();
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/toolbox/ToolBox.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/toolbox/ToolBox.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/toolbox/ToolBox.java
deleted file mode 100644
index 1f0d943..0000000
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/toolbox/ToolBox.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.workflow.gui.toolbox;
-
-//JDK imports
-import java.awt.FlowLayout;
-import java.util.List;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.border.EtchedBorder;
-
-/**
- *
- *
- * The box button and its panel that wrap the {@link Tool}.
- *
- * @author bfoster
- * @author mattmann
- *
- */
-public class ToolBox extends JPanel {
-
- private static final long serialVersionUID = -2671454524968238519L;
-
- private JPanel titlePanel;
- private JPanel boxPanel;
- private List<Tool> tools;
- private Tool selectedTool;
-
- public ToolBox(List<Tool> tools) {
- super();
- this.tools = tools;
- this.titlePanel = new JPanel();
- this.titlePanel.setBorder(new EtchedBorder());
- this.titlePanel.add(new JLabel("Toolbox"));
-
- this.boxPanel = new JPanel();
- this.boxPanel.setBorder(new EtchedBorder());
- this.boxPanel.setLayout(new FlowLayout(FlowLayout.LEADING));
- for (Tool tool : tools) {
- tool.setToolBox(this);
- this.boxPanel.add(tool);
- }
- this.add(this.boxPanel);
- }
-
- public void setSelected(Tool selectedTool) {
- this.selectedTool = selectedTool;
- this.selectedTool.setSelected(true);
- for (Tool tool : tools) {
- if (!this.selectedTool.equals(tool)) {
- tool.setSelected(false);
- }
- }
- }
-
- public Tool getSelected() {
- return this.selectedTool;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/GuiUtils.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/GuiUtils.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/GuiUtils.java
deleted file mode 100644
index 2faffb3..0000000
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/GuiUtils.java
+++ /dev/null
@@ -1,377 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.workflow.gui.util;
-
-//OODT imports
-import org.apache.oodt.cas.workflow.gui.model.ModelGraph;
-import org.apache.oodt.cas.workflow.gui.model.ModelNode;
-import org.apache.oodt.cas.workflow.gui.perspective.view.ViewState;
-
-//JDK imports
-import java.io.File;
-import java.util.List;
-import java.util.Set;
-import java.util.Stack;
-import java.util.Vector;
-import java.util.concurrent.atomic.AtomicInteger;
-
-/**
- *
- *
- * Generic utility functions helpful for the Workflow Editor GUI.
- *
- * @author bfoster
- * @author mattmann
- *
- */
-public class GuiUtils {
-
- protected static AtomicInteger untitledIter = new AtomicInteger(0);
- protected static AtomicInteger dummyUntitledIter = new AtomicInteger(0);
-
- public static boolean isSubGraph(ModelGraph graph, ModelGraph subGraph) {
- if (graph.equals(subGraph)) {
- return true;
- }
- for (ModelGraph child : graph.getChildren()) {
- if (isSubGraph(child, subGraph)) {
- return true;
- }
- }
- if (graph.getPreConditions() != null) {
- if (isSubGraph(graph.getPreConditions(), subGraph)) {
- return true;
- }
- }
- if (graph.getPostConditions() != null) {
- if (isSubGraph(graph.getPostConditions(), subGraph)) {
- return true;
- }
- }
- return false;
- }
-
- public static void updateGraphModelId(ViewState state, String id,
- String newModelId) {
- ModelGraph graph = find(state.getGraphs(), id);
- if (graph.getParent() != null
- && graph.getParent().getModel().getExcusedSubProcessorIds()
- .contains(graph.getModel().getModelId())) {
- graph.getParent().getModel().getExcusedSubProcessorIds()
- .remove(graph.getModel().getModelId());
- graph.getParent().getModel().getExcusedSubProcessorIds().add(newModelId);
- }
- graph.getModel().setModelId(newModelId);
- }
-
- public static void addChild(List<ModelGraph> graphs, String parentId,
- ModelGraph child) {
- ModelGraph parent = find(graphs, parentId);
- if (parent != null) {
- parent.addChild(child);
- }
- }
-
- public static List<ModelGraph> findRootGraphs(List<ModelGraph> graphs) {
- List<ModelGraph> rootGraphs = new Vector<ModelGraph>();
- for (ModelGraph graph : graphs) {
- if (rootGraphs.size() == 0) {
- rootGraphs.add(graph);
- } else {
- if (find(rootGraphs, graph.getModel().getModelId()) == null) {
- rootGraphs.add(graph);
- }
- }
- }
- for (int i = 0; i < rootGraphs.size(); i++) {
- ModelGraph rootGraph = rootGraphs.get(i);
- for (int j = 0; j < rootGraphs.size(); j++) {
- if (i != j
- && rootGraphs.get(j).recursiveFind(
- rootGraph.getModel().getModelId()) != null) {
- rootGraphs.remove(i--);
- break;
- }
- }
-
- }
- return rootGraphs;
- }
-
- public static ModelGraph findRoot(List<ModelGraph> rootGraphs,
- ModelGraph graph) {
- for (ModelGraph rootGraph : rootGraphs) {
- if (graph.equals(rootGraph)) {
- return rootGraph;
- } else if (graph.getParent() != null) {
- ModelGraph root = findRoot(rootGraphs, graph.getParent());
- if (root != null) {
- return root;
- }
- }
- }
- return null;
- }
-
- public static List<ModelGraph> find(List<ModelGraph> graphs, Set<String> ids) {
- Vector<ModelGraph> foundGraphs = new Vector<ModelGraph>();
- for (String id : ids) {
- ModelGraph graph = find(graphs, id);
- if (graph != null) {
- foundGraphs.add(graph);
- }
- }
- return foundGraphs;
- }
-
- public static ModelGraph find(List<ModelGraph> graphs, String id) {
- for (ModelGraph graph : graphs) {
- ModelGraph found = graph.recursiveFind(id);
- if (found != null) {
- return found;
- }
- }
- return null;
- }
-
- public static ModelGraph removeNode(List<ModelGraph> graphs, ModelNode node) {
- for (int i = 0; i < graphs.size(); i++) {
- if (graphs.get(i).getModel().equals(node)) {
- return graphs.remove(i);
- } else {
- ModelGraph graph = removeNode(graphs.get(i), node);
- if (graph != null) {
- return graph;
- }
- }
- }
- return null;
- }
-
- public static ModelGraph removeNode(ModelGraph graph, ModelNode node) {
- Stack<ModelGraph> stack = new Stack<ModelGraph>();
- stack.add(graph);
- while (!stack.empty()) {
- ModelGraph curGraph = stack.pop();
- if (curGraph.getModel().equals(node)) {
- curGraph.setParent(null);
- return curGraph;
- } else {
- stack.addAll(curGraph.getChildren());
- if (curGraph.getPreConditions() != null) {
- stack.add(curGraph.getPreConditions());
- }
- if (curGraph.getPostConditions() != null) {
- stack.add(curGraph.getPostConditions());
- }
- }
- }
- return null;
- }
-
- public static List<Line> findSequentialLines(List<ModelGraph> graphs) {
- Vector<Line> lines = new Vector<Line>();
- for (ModelGraph graph : graphs) {
- lines.addAll(findSequentialLines(graph));
- }
- return lines;
- }
-
- public static List<Line> findSequentialLines(final ModelGraph graph) {
- Vector<Line> lines = new Vector<Line>();
- if (graph.getChildren().size() > 0) {
- Stack<ModelGraph> stack = new Stack<ModelGraph>();
- stack.add(graph);
- while (!stack.empty()) {
- ModelGraph curGraph = stack.pop();
- if (curGraph.getModel().getExecutionType().equals("sequential")) {
- for (int i = 0; i < curGraph.getChildren().size() - 1; i++) {
- lines.add(new Line(curGraph.getChildren().get(i).getModel(),
- curGraph.getChildren().get(i + 1).getModel()));
- }
- }
- stack.addAll(curGraph.getChildren());
- }
- }
- return lines;
- }
-
- public static List<Line> findLines(final List<ModelGraph> graphs) {
- Vector<Line> lines = new Vector<Line>();
- for (ModelGraph graph : graphs) {
- lines.addAll(findLines(graph));
- }
- return lines;
- }
-
- public static List<Line> findLines(final ModelGraph graph) {
- Vector<Line> lines = new Vector<Line>();
- if (graph.getChildren().size() > 0) {
- Stack<ModelGraph> graphs = new Stack<ModelGraph>();
- graphs.add(graph);
- while (!graphs.empty()) {
- ModelGraph curGraph = graphs.pop();
- if (curGraph.getModel().isParentType()) {
-
- if (curGraph.getChildren().size() == 0) {
- curGraph.addChild(new ModelGraph(createDummyNode()));
- }
-
- List<Line> relaventLines = getRelaventLines(lines, curGraph
- .getModel().getId());
- for (Line relaventLine : relaventLines) {
- int index = lines.indexOf(relaventLine);
- if (curGraph.getModel().getExecutionType().toLowerCase()
- .equals("sequential")) {
- lines.remove(index);
- if (curGraph.getChildren().size() > 0) {
- if (relaventLine.getFromModel().equals(curGraph.getModel())) {
- lines.add(new Line(curGraph.getChildren()
- .get(curGraph.getChildren().size() - 1).getModel(),
- relaventLine.getToModel()));
- } else {
- lines.add(new Line(relaventLine.getFromModel(), curGraph
- .getChildren().get(0).getModel()));
- }
- }
- } else if (curGraph.getModel().getExecutionType().toLowerCase()
- .equals("parallel")) {
- lines.remove(index);
- if (relaventLine.getFromModel().equals(curGraph.getModel())) {
- for (ModelGraph child : curGraph.getChildren()) {
- lines.add(new Line(child.getModel(), relaventLine
- .getToModel()));
- }
- } else {
- for (ModelGraph child : curGraph.getChildren()) {
- lines.add(new Line(relaventLine.getFromModel(), child
- .getModel()));
- }
- }
- }
- }
-
- if (curGraph.getModel().getExecutionType().toLowerCase()
- .equals("sequential")) {
- for (int i = 0; i < curGraph.getChildren().size(); i++) {
- if (i == curGraph.getChildren().size() - 1) {
- lines.add(new Line(curGraph.getChildren().get(i).getModel(),
- null));
- } else {
- lines.add(new Line(curGraph.getChildren().get(i).getModel(),
- curGraph.getChildren().get(i + 1).getModel()));
- }
- }
- } else if (curGraph.getModel().getExecutionType().toLowerCase()
- .equals("parallel")) {
- for (int i = 0; i < curGraph.getChildren().size(); i++) {
- lines
- .add(new Line(curGraph.getChildren().get(i).getModel(), null));
- }
- }
- graphs.addAll(curGraph.getChildren());
- }
- }
- } else {
- lines.add(new Line(graph.getModel(), null));
- }
- return lines;
- }
-
- public static boolean isDummyNode(ModelNode node) {
- return node.getModelId().startsWith("DUMMY-");
- }
-
- public static ModelNode createDummyNode() {
- ModelNode dummy = new ModelNode(null, "DUMMY-"
- + dummyUntitledIter.getAndIncrement());
- dummy.setTextVisible(false);
- return dummy;
- }
-
- public static List<ModelGraph> getGraphsInFile(File file,
- List<ModelGraph> graphs) {
- List<ModelGraph> graphsInFile = new Vector<ModelGraph>();
- for (ModelGraph graph : graphs) {
- if (graph.getModel().getFile().equals(file)) {
- graphsInFile.add(graph);
- } else {
- graphsInFile.addAll(getGraphsInFile(file, graph.getChildren()));
- }
- }
- return graphsInFile;
- }
-
- public static String createUniqueName() {
- return "Untitled-" + untitledIter.getAndIncrement();
- }
-
- public static Line getLine(List<Line> lines, ModelNode fromModel,
- ModelNode toModel) {
- for (Line line : lines) {
- if (line.getFromModel().equals(fromModel)
- && line.getToModel().equals(toModel)) {
- return line;
- }
- }
- return null;
- }
-
- public static List<Line> getRelaventLines(List<Line> lines, String id) {
- List<Line> relaventLines = new Vector<Line>();
- for (Line line : lines) {
- if ((line.getFromModel() != null && line.getFromModel().getId()
- .equals(id))
- || (line.getToModel() != null && line.getToModel().getId().equals(id))) {
- relaventLines.add(line);
- }
- }
- return relaventLines;
- }
-
- public static List<Line> getChildrenLines(List<Line> lines, String id) {
- List<Line> relaventLines = new Vector<Line>();
- for (Line line : lines) {
- if (line.getFromModel().getId().equals(id)) {
- relaventLines.add(line);
- }
- }
- return relaventLines;
- }
-
- public static List<Line> getParentLines(List<Line> lines, String id) {
- List<Line> relaventLines = new Vector<Line>();
- for (Line line : lines) {
- if (line.getToModel().getId().equals(id)) {
- relaventLines.add(line);
- }
- }
- return relaventLines;
- }
-
- public static List<Line> getStartingLines(List<Line> lines) {
- Vector<Line> startingLines = new Vector<Line>();
- for (Line line : lines) {
- if (getParentLines(lines, line.getFromModel().getId()).size() == 0) {
- startingLines.add(line);
- }
- }
- return startingLines;
- }
-
-}
[51/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
Record change for OODT-836, OODT-837.
Project: http://git-wip-us.apache.org/repos/asf/oodt/repo
Commit: http://git-wip-us.apache.org/repos/asf/oodt/commit/098cc4fa
Tree: http://git-wip-us.apache.org/repos/asf/oodt/tree/098cc4fa
Diff: http://git-wip-us.apache.org/repos/asf/oodt/diff/098cc4fa
Branch: refs/heads/master
Commit: 098cc4fa63e6a1febd5a620f6a6b881cd4d48073
Parents: a82ee5d
Author: Chris Mattmann <ma...@apache.org>
Authored: Sun Jul 16 09:05:36 2017 -0700
Committer: Chris Mattmann <ma...@apache.org>
Committed: Sun Jul 16 09:05:36 2017 -0700
----------------------------------------------------------------------
app/fmbrowser/pom.xml | 81 -
app/fmbrowser/src/main/bin/filemgr-browser | 37 -
.../browser/controller/TableListener.java | 172 -
.../browser/controller/WindowListener.java | 166 -
.../oodt/cas/filemgr/browser/model/CasDB.java | 187 --
.../cas/filemgr/browser/model/QueryBuilder.java | 102 -
.../oodt/cas/filemgr/browser/model/Results.java | 68 -
.../browser/system/XmlRpcFilemgrBrowser.java | 35 -
.../cas/filemgr/browser/view/GuiParams.java | 28 -
.../cas/filemgr/browser/view/MainWindow.java | 70 -
.../cas/filemgr/browser/view/menus/MenuBar.java | 98 -
.../browser/view/menus/RightClickMenu.java | 51 -
.../filemgr/browser/view/panels/BottomPane.java | 64 -
.../cas/filemgr/browser/view/panels/Cell.java | 73 -
.../filemgr/browser/view/panels/HeaderCell.java | 49 -
.../filemgr/browser/view/panels/HeaderRow.java | 99 -
.../browser/view/panels/HeaderSpacer.java | 48 -
.../filemgr/browser/view/panels/MiddlePane.java | 52 -
.../filemgr/browser/view/panels/QueryField.java | 97 -
.../filemgr/browser/view/panels/QueryPane.java | 69 -
.../cas/filemgr/browser/view/panels/Row.java | 83 -
.../filemgr/browser/view/panels/TablePane.java | 150 -
.../browser/view/prompts/ConnectPrompt.java | 105 -
.../view/prompts/QueryBuilderPrompt.java | 444 ---
.../browser/view/prompts/SortPrompt.java | 153 -
app/weditor/.gitignore | 1 -
app/weditor/pom.xml | 110 -
app/weditor/src/main/assembly/assembly.xml | 72 -
app/weditor/src/main/bin/weditor | 22 -
.../oodt/cas/workflow/gui/WorkflowGUI.java | 325 --
.../oodt/cas/workflow/gui/menu/EditMenu.java | 48 -
.../oodt/cas/workflow/gui/menu/FileMenu.java | 82 -
.../oodt/cas/workflow/gui/model/ModelGraph.java | 307 --
.../oodt/cas/workflow/gui/model/ModelNode.java | 375 ---
.../model/repo/XmlWorkflowModelRepository.java | 614 ----
.../repo/XmlWorkflowModelRepositoryFactory.java | 49 -
.../gui/perspective/MultiStatePerspective.java | 103 -
.../workflow/gui/perspective/Perspective.java | 87 -
.../gui/perspective/build/BuildPerspective.java | 436 ---
.../gui/perspective/view/MultiStateView.java | 46 -
.../cas/workflow/gui/perspective/view/View.java | 97 -
.../gui/perspective/view/ViewChange.java | 97 -
.../gui/perspective/view/ViewListener.java | 32 -
.../gui/perspective/view/ViewState.java | 271 --
.../perspective/view/impl/DefaultPropView.java | 862 -----
.../perspective/view/impl/DefaultTreeView.java | 496 ---
.../perspective/view/impl/GlobalConfigView.java | 270 --
.../gui/perspective/view/impl/GraphView.java | 1140 -------
.../perspective/view/impl/IdentifiableEdge.java | 92 -
.../view/impl/JungJGraphModelAdapter.java | 246 --
.../perspective/view/impl/TreeProjectView.java | 155 -
.../oodt/cas/workflow/gui/toolbox/Tool.java | 125 -
.../oodt/cas/workflow/gui/toolbox/ToolBox.java | 76 -
.../oodt/cas/workflow/gui/util/GuiUtils.java | 377 ---
.../oodt/cas/workflow/gui/util/IconLoader.java | 83 -
.../apache/oodt/cas/workflow/gui/util/Line.java | 79 -
.../gui/util/exceptions/WorkflowException.java | 27 -
app/weditor/src/main/resources/REMOVE.log | 18 -
.../src/main/resources/examples/GranuleMaps.xml | 238 --
.../main/resources/examples/mspi-workflow.xml | 124 -
.../resources/examples/shared-properties.xml | 85 -
.../src/main/resources/examples/test.xml | 78 -
.../src/main/resources/icons/cursor-zoom.png | Bin 2967 -> 0 bytes
.../src/main/resources/icons/delete-sel.jpg | Bin 2686 -> 0 bytes
app/weditor/src/main/resources/icons/delete.jpg | Bin 2219 -> 0 bytes
.../src/main/resources/icons/edit-sel.jpg | Bin 2276 -> 0 bytes
app/weditor/src/main/resources/icons/edit.jpg | Bin 2375 -> 0 bytes
.../src/main/resources/icons/move-sel.jpg | Bin 1924 -> 0 bytes
app/weditor/src/main/resources/icons/move.jpg | Bin 2021 -> 0 bytes
.../src/main/resources/icons/zoom-in-sel.jpg | Bin 2438 -> 0 bytes
.../src/main/resources/icons/zoom-in.jpg | Bin 2192 -> 0 bytes
.../src/main/resources/icons/zoom-out-sel.jpg | Bin 2356 -> 0 bytes
.../src/main/resources/icons/zoom-out.jpg | Bin 2137 -> 0 bytes
.../src/main/resources/logging.properties | 40 -
balance/etc/skel/.htaccess | 45 -
balance/etc/skel/README.txt | 90 -
balance/etc/skel/config.ini | 82 -
balance/etc/skel/hooks.php | 98 -
balance/etc/skel/index.php | 48 -
.../skel/scripts/widgets/BreadcrumbsWidget.php | 101 -
balance/etc/skel/static/css/balance/balance.css | 119 -
balance/etc/skel/static/css/site.css | 19 -
balance/etc/skel/views/common/footer.php | 38 -
balance/etc/skel/views/common/header.php | 56 -
balance/etc/skel/views/errors/403.php | 30 -
balance/etc/skel/views/errors/404.php | 29 -
balance/etc/skel/views/index.php | 35 -
balance/lib/pear/Boot/bootstrap.php | 59 -
balance/lib/pear/Core/Application.class.php | 427 ---
.../pear/Core/ApplicationDataResponse.class.php | 81 -
.../lib/pear/Core/ApplicationRequest.class.php | 171 -
.../lib/pear/Core/ApplicationResponse.class.php | 311 --
.../IApplicationAuthenticationProvider.php | 162 -
.../IApplicationAuthorizationProvider.php | 62 -
.../Interfaces/IApplicationDataProvider.php | 125 -
.../Interfaces/IApplicationErrorProvider.php | 39 -
.../lib/pear/Interfaces/IApplicationWidget.php | 67 -
.../LDAPAuthenticationProvider.class.php | 170 -
.../LDAPAuthorizationProvider.class.php | 109 -
.../Providers/Data/MDB2DataProvider.class.php | 137 -
.../Providers/Data/MySqlDataProvider.class.php | 128 -
.../Providers/Data/PDODataProvider.class.php | 142 -
.../Error/DefaultErrorProvider.class.php | 38 -
balance/lib/pear/README | 34 -
balance/lib/pear/package.xml | 136 -
.../cas-browser/classes/CasBrowser.class.php | 455 ---
.../modules/cas-browser/classes/Utils.class.php | 388 ---
balance/modules/cas-browser/config.ini | 121 -
.../modules/cas-browser/element-ordering.ini | 64 -
.../modules/cas-browser/element-visibility.ini | 49 -
balance/modules/cas-browser/hooks.php | 74 -
.../cas-browser/scripts/allTypeScript.php | 64 -
.../scripts/crossTypeQueryScript.php | 246 --
.../modules/cas-browser/scripts/pageScript.php | 102 -
.../cas-browser/scripts/productTypeFilter.php | 70 -
.../modules/cas-browser/scripts/queryScript.php | 155 -
.../scripts/widgets/BasicSearchWidget.php | 42 -
.../scripts/widgets/CrossTypeSearchWidget.php | 125 -
.../scripts/widgets/CustomSearchWidget.php | 178 --
.../scripts/widgets/FilterWidget.php | 136 -
.../scripts/widgets/MetadataDisplayWidget.php | 90 -
.../scripts/widgets/ProductDownloadWidget.php | 96 -
.../scripts/widgets/ProductPageWidget.php | 133 -
.../scripts/widgets/ProductTypeListWidget.php | 92 -
.../cas-browser/static/css/cas-browser.css | 289 --
.../cas-browser/static/css/dataTables.css | 469 ---
.../static/img/dataTables/Sorting icons.psd | Bin 27490 -> 0 bytes
.../static/img/dataTables/back_disabled.png | Bin 1361 -> 0 bytes
.../static/img/dataTables/back_enabled.png | Bin 1379 -> 0 bytes
.../img/dataTables/back_enabled_hover.png | Bin 1375 -> 0 bytes
.../static/img/dataTables/favicon.ico | Bin 894 -> 0 bytes
.../static/img/dataTables/forward_disabled.png | Bin 1363 -> 0 bytes
.../static/img/dataTables/forward_enabled.png | Bin 1380 -> 0 bytes
.../img/dataTables/forward_enabled_hover.png | Bin 1379 -> 0 bytes
.../static/img/dataTables/sort_asc.png | Bin 1118 -> 0 bytes
.../static/img/dataTables/sort_asc_disabled.png | Bin 1050 -> 0 bytes
.../static/img/dataTables/sort_both.png | Bin 1136 -> 0 bytes
.../static/img/dataTables/sort_desc.png | Bin 1127 -> 0 bytes
.../img/dataTables/sort_desc_disabled.png | Bin 1045 -> 0 bytes
.../cas-browser/static/img/download-icon.gif | Bin 556 -> 0 bytes
.../modules/cas-browser/static/img/loading.gif | Bin 7247 -> 0 bytes
.../cas-browser/static/img/zip-icon-smaller.gif | Bin 1877 -> 0 bytes
.../modules/cas-browser/static/img/zip-icon.gif | Bin 3476 -> 0 bytes
.../static/js/crosstypesearchwidget.js | 106 -
.../cas-browser/static/js/customsearchwidget.js | 78 -
.../cas-browser/static/js/filterwidget.js | 98 -
.../cas-browser/static/js/jcorner.jquery.js | 247 --
.../cas-browser/static/js/jquery-1.4.2-min.js | 154 -
.../static/js/jquery.dataTables.min.js | 388 ---
.../cas-browser/static/js/querywidget.js | 314 --
balance/modules/cas-browser/views/dataset.php | 100 -
balance/modules/cas-browser/views/index.php | 87 -
balance/modules/cas-browser/views/product.php | 84 -
balance/modules/cas-browser/views/products.php | 156 -
balance/modules/cas-browser/views/search.php | 89 -
.../modules/cas-browser/views/typesearch.php | 121 -
balance/modules/profile/README.txt | 88 -
.../LDAPAuthenticationProvider.class.php | 263 --
.../classes/LDAPAuthorizationProvider.class.php | 113 -
.../NullAuthenticationProvider.class.php | 96 -
.../classes/NullAuthorizationProvider.class.php | 45 -
balance/modules/profile/config.ini | 180 --
balance/modules/profile/hooks.php | 91 -
balance/modules/profile/scripts/access.php | 107 -
balance/modules/profile/scripts/changePwd.php | 69 -
balance/modules/profile/scripts/login.php | 46 -
balance/modules/profile/scripts/logout.php | 36 -
balance/modules/profile/scripts/manage.php | 59 -
.../scripts/widgets/UserStatusWidget.php | 91 -
balance/modules/profile/static/css/profile.css | 150 -
.../profile/static/js/additional-methods.js | 259 --
.../profile/static/js/jquery.validate.min.js | 16 -
.../profile/static/js/jquery.validate.pack.js | 15 -
balance/modules/profile/views/changePwd.php | 76 -
balance/modules/profile/views/createUser.php | 184 --
balance/modules/profile/views/groups.php | 82 -
balance/modules/profile/views/index.php | 81 -
balance/modules/profile/views/login.php | 71 -
balance/modules/profile/views/manage.php | 87 -
.../profile/views/passwordChangeConfirmed.php | 44 -
balance/modules/puny/README.txt | 115 -
balance/modules/puny/classes/Puny.class.php | 166 -
.../puny/classes/Puny_Container.class.php | 85 -
.../puny/classes/Puny_Resource.class.php | 163 -
.../puny/classes/data/Puny_DataStore.class.php | 69 -
.../data/Puny_LocalFileDataStore.class.php | 79 -
.../classes/data/Puny_MongoDataStore.class.php | 75 -
.../classes/data/Puny_PdoDataStore.class.php | 111 -
.../parsers/Puny_MarkdownParser.class.php | 36 -
.../puny/classes/parsers/Puny_Parser.class.php | 40 -
balance/modules/puny/config.ini | 75 -
balance/modules/puny/hooks.php | 17 -
balance/modules/puny/libs/markdown.php | 2949 ------------------
balance/modules/puny/schemas/schema.pdo.mysql | 26 -
balance/modules/puny/scripts/login.php | 52 -
balance/modules/puny/scripts/logout.php | 32 -
balance/modules/puny/scripts/store.php | 40 -
balance/modules/puny/static/css/defaults.css | 39 -
balance/modules/puny/static/css/dialog.css | 157 -
balance/modules/puny/static/css/editor.css | 567 ----
balance/modules/puny/static/css/github.css | 677 ----
balance/modules/puny/static/css/puny.css | 32 -
balance/modules/puny/static/img/icon-sprite.png | Bin 9542 -> 0 bytes
balance/modules/puny/static/js/editable.js | 1090 -------
.../puny/static/js/editor/gollum.editor.js | 1090 -------
.../puny/static/js/editor/langs/markdown.js | 228 --
balance/modules/puny/static/js/gollum.dialog.js | 279 --
balance/modules/puny/static/js/gollum.js | 178 --
.../puny/static/js/gollum.placeholder.js | 71 -
.../modules/puny/static/js/jquery-1.7.2.min.js | 4 -
balance/modules/puny/static/js/puny.js | 56 -
balance/modules/puny/views/edit.php | 141 -
balance/modules/puny/views/error.php | 31 -
balance/modules/puny/views/login.php | 61 -
balance/modules/puny/views/logout.php | 32 -
balance/modules/puny/views/preview.php | 36 -
catalog/.gitignore | 1 -
catalog/pom.xml | 236 --
catalog/src/main/assembly/assembly.xml | 77 -
catalog/src/main/bin/catserv-client | 33 -
catalog/src/main/bin/catserv-server | 33 -
.../cli/action/CatalogServiceCliAction.java | 77 -
.../action/GetSupportedCatalogIdsCliAction.java | 40 -
.../action/LoadCatalogRepositoryCliAction.java | 80 -
.../cli/action/LoadCatalogsCliAction.java | 70 -
.../catalog/cli/action/PagedQueryCliAction.java | 116 -
.../cas/catalog/cli/action/QueryCliAction.java | 95 -
.../cli/action/ReducedPagedQueryCliAction.java | 134 -
.../cli/action/ReducedQueryCliAction.java | 110 -
.../catalog/cli/action/ShutdownCliAction.java | 38 -
.../exception/CatalogDictionaryException.java | 41 -
.../cas/catalog/exception/CatalogException.java | 40 -
.../exception/CatalogIndexException.java | 40 -
.../exception/CatalogRepositoryException.java | 40 -
.../exception/CatalogServiceException.java | 40 -
.../exception/IngestServiceException.java | 40 -
.../exception/QueryServiceException.java | 40 -
.../catalog/mapping/DataSourceIngestMapper.java | 259 --
.../mapping/DataSourceIngestMapperFactory.java | 91 -
.../catalog/mapping/InMemoryIngestMapper.java | 41 -
.../mapping/InMemoryIngestMapperFactory.java | 52 -
.../oodt/cas/catalog/mapping/IngestMapper.java | 157 -
.../catalog/mapping/IngestMapperFactory.java | 31 -
.../cas/catalog/mapping/LuceneIngestMapper.java | 114 -
.../mapping/LuceneIngestMapperFactory.java | 35 -
.../mapping/MemoryBasedIngestMapper.java | 281 --
.../mapping/MemoryBasedIngestMapperFactory.java | 34 -
.../catalog/metadata/TransactionalMetadata.java | 73 -
.../oodt/cas/catalog/page/CatalogReceipt.java | 83 -
.../oodt/cas/catalog/page/IndexPager.java | 77 -
.../oodt/cas/catalog/page/IngestReceipt.java | 56 -
.../org/apache/oodt/cas/catalog/page/Page.java | 77 -
.../apache/oodt/cas/catalog/page/PageInfo.java | 49 -
.../cas/catalog/page/ProcessedPageInfo.java | 47 -
.../oodt/cas/catalog/page/QueryPager.java | 73 -
.../cas/catalog/page/TransactionReceipt.java | 91 -
.../query/ComparisonQueryExpression.java | 84 -
.../catalog/query/CustomQueryExpression.java | 73 -
.../query/CustomWrapperQueryExpression.java | 58 -
.../catalog/query/FreeTextQueryExpression.java | 103 -
.../cas/catalog/query/NotQueryExpression.java | 54 -
.../oodt/cas/catalog/query/QueryExpression.java | 53 -
.../cas/catalog/query/QueryLogicalGroup.java | 117 -
.../cas/catalog/query/StdQueryExpression.java | 50 -
.../cas/catalog/query/TermQueryExpression.java | 44 -
.../catalog/query/WrapperQueryExpression.java | 57 -
.../catalog/query/filter/FilterAlgorithm.java | 35 -
.../cas/catalog/query/filter/QueryFilter.java | 60 -
.../query/filter/time/MetadataTimeEvent.java | 41 -
.../time/MetadataTimeEventFilterAlgorithm.java | 57 -
.../time/MetadataTimeEventQueryFilter.java | 112 -
.../conv/AsciiSortableVersionConverter.java | 39 -
.../filter/time/conv/VersionConverter.java | 32 -
.../query/parser/JJTQueryParserState.java | 123 -
.../oodt/cas/catalog/query/parser/Node.java | 36 -
.../catalog/query/parser/ParseException.java | 190 --
.../cas/catalog/query/parser/QueryParser.java | 1000 ------
.../cas/catalog/query/parser/QueryParser.jj | 497 ---
.../cas/catalog/query/parser/QueryParser.jjt | 214 --
.../query/parser/QueryParserConstants.java | 65 -
.../query/parser/QueryParserTokenManager.java | 806 -----
.../query/parser/QueryParserTreeConstants.java | 29 -
.../catalog/query/parser/SimpleCharStream.java | 480 ---
.../cas/catalog/query/parser/SimpleNode.java | 79 -
.../oodt/cas/catalog/query/parser/Token.java | 131 -
.../cas/catalog/query/parser/TokenMgrError.java | 146 -
.../catalog/repository/CatalogRepository.java | 77 -
.../repository/CatalogRepositoryFactory.java | 34 -
.../MemoryBasedCatalogRepository.java | 120 -
.../MemoryBasedCatalogRepositoryFactory.java | 38 -
.../repository/SerializedCatalogRepository.java | 212 --
.../SerializedCatalogRepositoryFactory.java | 54 -
.../repository/SpringCatalogRepository.java | 87 -
.../SpringCatalogRepositoryFactory.java | 43 -
.../server/CatalogServiceCommandLineClient.java | 46 -
.../server/CatalogServiceServerLauncher.java | 51 -
.../AbstractCommunicationChannelClient.java | 42 -
.../AbstractCommunicationChannelServer.java | 404 ---
.../channel/CommunicationChannelClient.java | 127 -
.../CommunicationChannelClientFactory.java | 35 -
.../channel/CommunicationChannelServer.java | 154 -
.../CommunicationChannelServerFactory.java | 40 -
.../rmi/RmiCommunicationChannelClient.java | 271 --
.../RmiCommunicationChannelClientInterface.java | 109 -
.../rmi/RmiCommunicationChannelClientMBean.java | 27 -
.../rmi/RmiCommunicationChannelServer.java | 275 --
.../XmlRpcCommunicationChannelClient.java | 639 ----
...XmlRpcCommunicationChannelClientFactory.java | 93 -
.../XmlRpcCommunicationChannelServer.java | 261 --
...XmlRpcCommunicationChannelServerFactory.java | 77 -
.../action/CatalogServiceServerCliAction.java | 82 -
.../cli/action/LaunchXmlRpcServerCliAction.java | 68 -
.../oodt/cas/catalog/struct/Dictionary.java | 65 -
.../cas/catalog/struct/DictionaryFactory.java | 29 -
.../apache/oodt/cas/catalog/struct/Index.java | 65 -
.../oodt/cas/catalog/struct/IndexFactory.java | 29 -
.../oodt/cas/catalog/struct/IngestService.java | 74 -
.../oodt/cas/catalog/struct/QueryService.java | 80 -
.../oodt/cas/catalog/struct/TransactionId.java | 72 -
.../catalog/struct/TransactionIdFactory.java | 31 -
.../dictionary/WorkflowManagerDictionary.java | 71 -
.../WorkflowManagerDictionaryFactory.java | 34 -
.../struct/impl/index/DataSourceIndex.java | 549 ----
.../impl/index/DataSourceIndexFactory.java | 67 -
.../struct/impl/index/InMemoryIndex.java | 45 -
.../struct/impl/index/InMemoryIndexFactory.java | 47 -
.../index/WorkflowManagerDataSourceIndex.java | 323 --
.../WorkflowManagerDataSourceIndexFactory.java | 59 -
.../transaction/LongTransactionIdFactory.java | 52 -
.../transaction/StringTransactionIdFactory.java | 51 -
.../transaction/UuidTransactionIdFactory.java | 55 -
.../apache/oodt/cas/catalog/system/Catalog.java | 399 ---
.../oodt/cas/catalog/system/CatalogFactory.java | 80 -
.../oodt/cas/catalog/system/CatalogService.java | 130 -
.../catalog/system/CatalogServiceFactory.java | 31 -
.../system/impl/CatalogServiceClient.java | 407 ---
.../impl/CatalogServiceClientFactory.java | 66 -
.../system/impl/CatalogServiceLocal.java | 1336 --------
.../system/impl/CatalogServiceLocalFactory.java | 122 -
.../apache/oodt/cas/catalog/term/Bucket.java | 47 -
.../org/apache/oodt/cas/catalog/term/Term.java | 163 -
.../oodt/cas/catalog/term/TermBucket.java | 103 -
.../util/CasPropertyPlaceholderConfigurer.java | 62 -
.../cas/catalog/util/PluginClassLoader.java | 100 -
.../apache/oodt/cas/catalog/util/PluginURL.java | 47 -
.../oodt/cas/catalog/util/QueryUtils.java | 91 -
.../oodt/cas/catalog/util/Serializer.java | 99 -
.../oodt/cas/catalog/util/SpringUtils.java | 54 -
catalog/src/main/resources/REMOVE.log | 19 -
catalog/src/main/resources/logging.properties | 56 -
.../oracle/create-transaction-id-map-table.sql | 29 -
.../oracle/create-transaction-index-table.sql | 31 -
.../src/main/resources/policy/catserv-beans.xml | 71 -
.../policy/catserv-client-action-beans.xml | 51 -
.../policy/catserv-client-cmd-line-beans.xml | 302 --
.../resources/policy/catserv-client-config.xml | 29 -
.../resources/policy/catserv-properties.xml | 43 -
.../policy/catserv-server-cmd-line-beans.xml | 51 -
.../resources/policy/catserv-server-config.xml | 28 -
.../main/resources/policy/cmd-line-actions.xml | 51 -
.../main/resources/policy/cmd-line-options.xml | 317 --
.../policy/cmd-line-server-actions.xml | 30 -
.../policy/cmd-line-server-options.xml | 207 --
.../resources/policy/in-memory-index-cat.sql | 32 -
.../policy/in-memory-ingest-mapper.sql | 26 -
.../resources/policy/workflow-catalog-beans.xml | 56 -
.../system/impl/TestCatalogServiceLocal.java | 204 --
catalog/src/test/resources/test-index-cat.sql | 32 -
catalog/src/test/resources/test-mapper-cat.sql | 26 -
docker/Dockerfile | 22 -
grid/pom.xml | 138 -
.../grid/AuthenticationRequiredException.java | 30 -
.../java/org/apache/oodt/grid/ConfigBean.java | 177 --
.../org/apache/oodt/grid/ConfigServlet.java | 309 --
.../org/apache/oodt/grid/Configuration.java | 463 ---
.../java/org/apache/oodt/grid/GridServlet.java | 126 -
.../java/org/apache/oodt/grid/LoginServlet.java | 65 -
.../apache/oodt/grid/ProductQueryServlet.java | 226 --
.../org/apache/oodt/grid/ProductServer.java | 65 -
.../apache/oodt/grid/ProfileQueryServlet.java | 141 -
.../org/apache/oodt/grid/ProfileServer.java | 71 -
.../java/org/apache/oodt/grid/QueryServlet.java | 274 --
.../oodt/grid/RestfulProductQueryServlet.java | 88 -
.../main/java/org/apache/oodt/grid/Server.java | 166 -
.../main/java/org/apache/oodt/grid/Utility.java | 82 -
grid/src/main/webapp/META-INF/context.xml | 23 -
grid/src/main/webapp/WEB-INF/jetty-web.xml | 21 -
grid/src/main/webapp/WEB-INF/web.xml | 86 -
grid/src/main/webapp/config.jsp | 205 --
grid/src/main/webapp/error.jsp | 60 -
grid/src/main/webapp/images/webapp-large.png | Bin 3529 -> 0 bytes
grid/src/main/webapp/images/webapp-small.png | Bin 1222 -> 0 bytes
grid/src/main/webapp/index.html | 32 -
grid/src/main/webapp/style.css | 161 -
grid/src/site/resources/images/web-grid.jpg | Bin 45879 -> 0 bytes
grid/src/site/resources/images/web-grid.psd | Bin 741413 -> 0 bytes
grid/src/site/resources/slides.pdf | Bin 631046 -> 0 bytes
grid/src/site/site.xml | 30 -
grid/src/site/xdoc/index.xml | 73 -
.../org/apache/oodt/grid/ConfigurationTest.java | 180 --
opendapps/pom.xml | 99 -
.../org/apache/oodt/opendapps/DapNames.java | 37 -
.../apache/oodt/opendapps/DatasetCrawler.java | 126 -
.../apache/oodt/opendapps/DatasetExtractor.java | 188 --
.../OpendapProfileElementExtractor.java | 174 --
.../oodt/opendapps/OpendapProfileHandler.java | 186 --
.../org/apache/oodt/opendapps/Profiler.java | 155 -
.../oodt/opendapps/config/ConstantSpec.java | 86 -
.../apache/oodt/opendapps/config/DapRoot.java | 88 -
.../oodt/opendapps/config/DatasetMetElem.java | 68 -
.../oodt/opendapps/config/OpendapConfig.java | 128 -
.../opendapps/config/OpendapConfigMetKeys.java | 87 -
.../opendapps/config/OpendapConfigReader.java | 133 -
.../opendapps/config/OpendapProfileMetKeys.java | 36 -
.../config/ProcessingInstructions.java | 102 -
.../oodt/opendapps/config/RewriteSpec.java | 86 -
.../extractors/DasMetadataExtractor.java | 186 --
.../opendapps/extractors/MetadataExtractor.java | 43 -
.../extractors/NcmlMetadataExtractor.java | 55 -
.../extractors/ThreddsMetadataExtractor.java | 315 --
.../opendapps/util/OpendapURLEvaluator.java | 48 -
.../oodt/opendapps/util/ProfileChecker.java | 186 --
.../oodt/opendapps/util/ProfileSerializer.java | 109 -
.../oodt/opendapps/util/ProfileUtils.java | 421 ---
opendapps/src/main/resources/logging.properties | 35 -
opendapps/src/main/resources/opendap.config.xml | 192 --
pom.xml | 15 -
product/.gitignore | 1 -
product/pom.xml | 138 -
product/src/main/conf/displayableTypes.xml | 50 -
product/src/main/conf/ofsn-ps.xml | 201 --
.../oodt/product/LargeProductQueryHandler.java | 57 -
.../org/apache/oodt/product/QueryHandler.java | 38 -
.../handlers/ofsn/AbstractCrawlLister.java | 116 -
.../ofsn/DirListNonRecursiveHandler.java | 60 -
.../handlers/ofsn/DirListRecursiveHandler.java | 63 -
.../ofsn/FileListNonRecursiveHandler.java | 56 -
.../handlers/ofsn/FileListRecursiveHandler.java | 55 -
.../product/handlers/ofsn/MD5GetHandler.java | 143 -
.../product/handlers/ofsn/OFSNFileHandler.java | 255 --
.../ofsn/OFSNFileHandlerConfiguration.java | 131 -
.../OFSNFileHandlerConfigurationReader.java | 93 -
.../product/handlers/ofsn/OFSNGetHandler.java | 73 -
.../handlers/ofsn/OFSNHandlerConfig.java | 121 -
.../product/handlers/ofsn/OFSNListHandler.java | 61 -
.../handlers/ofsn/RawSizeListHandler.java | 60 -
.../handlers/ofsn/SingleFileListHandler.java | 64 -
.../handlers/ofsn/SingleZipFileListHandler.java | 83 -
.../handlers/ofsn/StdOFSNGetHandler.java | 112 -
.../product/handlers/ofsn/URLGetHandler.java | 252 --
.../handlers/ofsn/metadata/OFSNMetKeys.java | 41 -
.../ofsn/metadata/OFSNXMLConfigMetKeys.java | 55 -
.../handlers/ofsn/metadata/OFSNXMLMetKeys.java | 43 -
.../handlers/ofsn/metadata/OODTMetKeys.java | 31 -
.../handlers/ofsn/metadata/XMLQueryMetKeys.java | 32 -
.../handlers/ofsn/util/OFSNObjectFactory.java | 112 -
.../product/handlers/ofsn/util/OFSNUtils.java | 197 --
.../xmlquery/ChunkedProductInputStream.java | 215 --
.../org/apache/oodt/xmlquery/LargeResult.java | 166 -
.../src/site/resources/images/delegation.png | Bin 59132 -> 0 bytes
.../src/site/resources/images/delegation.psd | Bin 277484 -> 0 bytes
.../src/site/resources/images/grid-product.jpg | Bin 55049 -> 0 bytes
product/src/site/site.xml | 32 -
product/src/site/xdoc/servlet/index.xml | 243 --
product/src/site/xdoc/tutorials/index.xml | 36 -
product/src/site/xdoc/tutorials/lh/index.xml | 718 -----
product/src/site/xdoc/tutorials/ps/index.xml | 481 ---
product/src/site/xdoc/tutorials/qh/index.xml | 704 -----
.../handlers/ofsn/util/OFSNUtilsTest.java | 59 -
.../xmlquery/ChunkedProductInputStreamTest.java | 170 -
.../apache/oodt/xmlquery/LargeResultTest.java | 54 -
profile/pom.xml | 156 -
profile/src/main/dtd/prof.dtd | 86 -
.../org/apache/oodt/profile/DefaultFactory.java | 56 -
.../oodt/profile/EnumeratedProfileElement.java | 106 -
.../org/apache/oodt/profile/ObjectFactory.java | 109 -
.../java/org/apache/oodt/profile/Profile.java | 401 ---
.../apache/oodt/profile/ProfileAttributes.java | 344 --
.../org/apache/oodt/profile/ProfileElement.java | 586 ----
.../apache/oodt/profile/ProfileException.java | 57 -
.../oodt/profile/ProfileSAXException.java | 37 -
.../oodt/profile/ProfileSQLException.java | 34 -
.../oodt/profile/RangedProfileElement.java | 115 -
.../apache/oodt/profile/ResourceAttributes.java | 602 ----
.../oodt/profile/UnspecifiedProfileElement.java | 89 -
.../java/org/apache/oodt/profile/Utility.java | 254 --
.../profile/activity/ConnectedToServer.java | 26 -
.../activity/ProfileClientConstructed.java | 26 -
.../oodt/profile/activity/QueriedHandlers.java | 26 -
.../oodt/profile/activity/ReceivedQuery.java | 26 -
.../apache/oodt/profile/gui/LeafListener.java | 288 --
.../oodt/profile/gui/ProfileBuilderGUI.form | 435 ---
.../oodt/profile/gui/ProfileBuilderGUI.java | 962 ------
.../apache/oodt/profile/gui/profileTree.java | 41 -
.../gui/pstructs/ProfileAttributesPrinter.java | 75 -
.../gui/pstructs/ProfileElementPrinter.java | 64 -
.../profile/gui/pstructs/ProfilePrinter.java | 77 -
.../gui/pstructs/ResourceAttributesPrinter.java | 118 -
.../handlers/DatabaseProfileManager.java | 277 --
.../oodt/profile/handlers/ProfileHandler.java | 64 -
.../oodt/profile/handlers/ProfileManager.java | 149 -
.../profile/handlers/cas/CASProfileHandler.java | 289 --
.../profile/handlers/cas/util/ProfileUtils.java | 107 -
.../handlers/lightweight/AndExpression.java | 67 -
.../lightweight/ConstantExpression.java | 65 -
.../handlers/lightweight/FalseResult.java | 50 -
.../handlers/lightweight/Intersection.java | 60 -
.../lightweight/LightweightProfileServer.java | 306 --
.../handlers/lightweight/MatchingResult.java | 61 -
.../handlers/lightweight/NotExpression.java | 59 -
.../lightweight/OperatorExpression.java | 140 -
.../handlers/lightweight/OrExpression.java | 67 -
.../profile/handlers/lightweight/Result.java | 35 -
.../SearchableEnumeratedProfileElement.java | 50 -
.../lightweight/SearchableObjectFactory.java | 62 -
.../handlers/lightweight/SearchableProfile.java | 44 -
.../lightweight/SearchableProfileElement.java | 36 -
.../SearchableRangedProfileElement.java | 66 -
.../SearchableResourceAttributes.java | 142 -
.../SearchableUnspecifiedProfileElement.java | 39 -
.../profile/handlers/lightweight/Union.java | 58 -
.../handlers/lightweight/WhereExpression.java | 55 -
.../profile/handlers/lightweight/package.html | 32 -
profile/src/site/resources/examples/src.jar | Bin 7973 -> 0 bytes
profile/src/site/resources/images/class.png | Bin 120990 -> 0 bytes
profile/src/site/resources/images/class.psd | Bin 499375 -> 0 bytes
.../src/site/resources/images/delegation.png | Bin 48258 -> 0 bytes
.../src/site/resources/images/delegation.psd | Bin 254613 -> 0 bytes
.../src/site/resources/images/grid-profile.jpg | Bin 54712 -> 0 bytes
profile/src/site/resources/images/stack.png | Bin 44350 -> 0 bytes
profile/src/site/resources/images/stack.psd | Bin 256409 -> 0 bytes
profile/src/site/resources/images/tree.png | Bin 27643 -> 0 bytes
profile/src/site/resources/images/tree.psd | Bin 129734 -> 0 bytes
profile/src/site/site.xml | 37 -
profile/src/site/xdoc/adv/index.xml | 1072 -------
profile/src/site/xdoc/handler/index.xml | 595 ----
profile/src/site/xdoc/info/index.xml | 848 -----
profile/src/site/xdoc/querying/index.xml | 203 --
profile/src/site/xdoc/rep/index.xml | 334 --
.../profile/EnumeratedProfileElementTest.java | 130 -
.../oodt/profile/ProfileAttributesTest.java | 167 -
.../oodt/profile/ProfileElementTestCase.java | 187 --
.../org/apache/oodt/profile/ProfileTest.java | 130 -
.../oodt/profile/RangedProfileElementTest.java | 82 -
.../oodt/profile/ResourceAttributesTest.java | 178 --
.../LightweightProfileServerTest.java | 158 -
.../handlers/lightweight/lightweightTest.xml | 119 -
.../resources/org/apache/oodt/profile/test.xml | 71 -
profile/src/test/resources/test.xml | 71 -
protocol/api/.gitignore | 1 -
protocol/api/pom.xml | 147 -
protocol/api/src/main/assembly/assembly.xml | 94 -
protocol/api/src/main/bin/protocol | 29 -
.../org/apache/oodt/cas/protocol/Protocol.java | 60 -
.../oodt/cas/protocol/ProtocolFactory.java | 31 -
.../apache/oodt/cas/protocol/ProtocolFile.java | 142 -
.../oodt/cas/protocol/auth/Authentication.java | 30 -
.../cas/protocol/auth/BasicAuthentication.java | 46 -
.../cas/protocol/auth/NoAuthentication.java | 34 -
.../cli/action/BasicVerifyCliAction.java | 83 -
.../action/CrossProtocolTransferCliAction.java | 123 -
.../action/DeleteEmptyDirectoriesCliAction.java | 70 -
.../protocol/cli/action/DownloadCliAction.java | 81 -
.../action/GetSupportedFactoriesCliAction.java | 43 -
.../protocol/cli/action/ProtocolCliAction.java | 84 -
.../cas/protocol/config/ProtocolConfig.java | 39 -
.../protocol/config/SpringProtocolConfig.java | 77 -
.../protocol/exceptions/ProtocolException.java | 34 -
.../protocol/system/ProtocolCommandLine.java | 31 -
.../cas/protocol/system/ProtocolManager.java | 116 -
.../cas/protocol/util/ProtocolFileFilter.java | 32 -
.../protocol/verify/BasicProtocolVerifier.java | 84 -
.../verify/BasicProtocolVerifierFactory.java | 47 -
.../cas/protocol/verify/ProtocolVerifier.java | 35 -
.../verify/ProtocolVerifierFactory.java | 28 -
.../main/resources/policy/cmd-line-actions.xml | 42 -
.../main/resources/policy/cmd-line-options.xml | 166 -
.../main/resources/policy/protocol-config.xml | 31 -
.../apache/oodt/cas/protocol/MockProtocol.java | 130 -
.../oodt/cas/protocol/MockProtocolFactory.java | 51 -
.../oodt/cas/protocol/TestProtocolFile.java | 53 -
.../protocol/auth/TestBasicAuthentication.java | 49 -
.../cas/protocol/auth/TestNoAuthentication.java | 35 -
.../cli/action/MockProtocolCliAction.java | 33 -
.../cli/action/TestBasicVerifyCliAction.java | 53 -
.../cli/action/TestDownloadCliAction.java | 76 -
.../cli/action/TestProtocolCliAction.java | 41 -
.../config/MockSpringProtocolConfig.java | 44 -
.../protocol/system/TestProtocolManager.java | 95 -
.../src/test/resources/test-protocol-config.xml | 53 -
protocol/ftp/.gitignore | 1 -
protocol/ftp/pom.xml | 122 -
.../cas/protocol/ftp/CogJGlobusFtpProtocol.java | 226 --
.../ftp/CogJGlobusFtpProtocolFactory.java | 39 -
.../cas/protocol/ftp/CommonsNetFtpProtocol.java | 246 --
.../ftp/CommonsNetFtpProtocolFactory.java | 38 -
.../resources/policy/ftp-protocol-config.xml | 32 -
.../protocol/ftp/TestCogJGlobusFtpProtocol.java | 137 -
.../ftp/src/test/resources/users.properties | 26 -
protocol/http/.gitignore | 1 -
protocol/http/pom.xml | 105 -
.../apache/oodt/cas/protocol/http/HttpFile.java | 51 -
.../oodt/cas/protocol/http/HttpProtocol.java | 242 --
.../cas/protocol/http/HttpProtocolFactory.java | 37 -
.../oodt/cas/protocol/http/util/HttpUtils.java | 130 -
.../resources/policy/http-protocol-config.xml | 31 -
.../oodt/cas/protocol/http/TestHttpFile.java | 53 -
.../cas/protocol/http/TestHttpProtocol.java | 103 -
.../cas/protocol/http/util/TestHttpUtils.java | 173 -
protocol/imaps/.gitignore | 1 -
protocol/imaps/pom.xml | 114 -
.../oodt/cas/protocol/imaps/ImapsProtocol.java | 385 ---
.../protocol/imaps/ImapsProtocolFactory.java | 43 -
.../resources/policy/imaps-protocol-config.xml | 31 -
.../cas/protocol/imaps/TestImapsProtocol.java | 112 -
protocol/sftp/.gitignore | 1 -
protocol/sftp/pom.xml | 140 -
.../cas/protocol/sftp/JschSftpProtocol.java | 211 --
.../protocol/sftp/JschSftpProtocolFactory.java | 48 -
.../sftp/auth/HostKeyAuthentication.java | 49 -
.../resources/policy/sftp-protocol-config.xml | 23 -
.../sftp/DummyAuthenticationProvider.java | 71 -
.../cas/protocol/sftp/TestJschSftpProtocol.java | 298 --
.../sftp/UnsupportedShellProcessProvider.java | 114 -
.../sftp/auth/TestHostKeyAuthentication.java | 36 -
.../sftp/src/test/resources/authorization.xml | 24 -
protocol/sftp/src/test/resources/platform.xml | 35 -
protocol/sftp/src/test/resources/sample-dsa.key | 12 -
protocol/sftp/src/test/resources/sample-dsa.pub | 1 -
protocol/sftp/src/test/resources/server.xml | 28 -
.../src/test/resources/sshTestDir/sshTestFile | 18 -
pushpull/pom.xml | 181 --
pushpull/src/main/assembly/assembly.xml | 85 -
pushpull/src/main/bin/pushpull | 32 -
pushpull/src/main/bin/url-downloader | 21 -
.../apache/oodt/cas/pushpull/config/Config.java | 405 ---
.../oodt/cas/pushpull/config/ConfigMetKeys.java | 71 -
.../pushpull/config/ConfigParserMetKeys.java | 113 -
.../oodt/cas/pushpull/config/DaemonInfo.java | 131 -
.../oodt/cas/pushpull/config/DataFilesInfo.java | 47 -
.../oodt/cas/pushpull/config/DownloadInfo.java | 86 -
.../oodt/cas/pushpull/config/ParserInfo.java | 104 -
.../oodt/cas/pushpull/config/PropFilesInfo.java | 164 -
.../oodt/cas/pushpull/config/ProtocolInfo.java | 168 -
.../oodt/cas/pushpull/config/RemoteSpecs.java | 364 ---
.../oodt/cas/pushpull/config/SiteInfo.java | 120 -
.../apache/oodt/cas/pushpull/daemon/Daemon.java | 576 ----
.../cas/pushpull/daemon/DaemonController.java | 208 --
.../cas/pushpull/daemon/DaemonLauncher.java | 194 --
.../pushpull/daemon/DaemonLauncherMBean.java | 38 -
.../cas/pushpull/daemon/DaemonListener.java | 40 -
.../oodt/cas/pushpull/daemon/DaemonMBean.java | 95 -
.../oodt/cas/pushpull/daemon/DaemonManager.java | 123 -
.../cas/pushpull/daemon/DaemonRmiInterface.java | 97 -
.../exceptions/AlreadyInDatabaseException.java | 41 -
.../pushpull/exceptions/ConfigException.java | 45 -
.../exceptions/CrawlDaemonException.java | 41 -
.../pushpull/exceptions/CrawlerException.java | 45 -
.../exceptions/FileRestrictionsException.java | 41 -
.../exceptions/MetExtractorException.java | 41 -
.../pushpull/exceptions/MethodException.java | 41 -
.../pushpull/exceptions/ParserException.java | 45 -
.../exceptions/ProtocolDeletionError.java | 41 -
.../pushpull/exceptions/ProtocolException.java | 42 -
.../exceptions/ProtocolFileException.java | 42 -
.../exceptions/PushPullFrameworkException.java | 57 -
.../exceptions/RemoteConnectionException.java | 45 -
.../exceptions/RetrievalMethodException.java | 45 -
.../exceptions/ThreadEvaluatorException.java | 41 -
.../ToManyFailedDownloadsException.java | 41 -
.../exceptions/UndefinedTypeException.java | 41 -
.../pushpull/expressions/GlobalVariables.java | 40 -
.../oodt/cas/pushpull/expressions/Method.java | 301 --
.../oodt/cas/pushpull/expressions/Operator.java | 45 -
.../cas/pushpull/expressions/Punctuation.java | 45 -
.../cas/pushpull/expressions/ValidInput.java | 36 -
.../oodt/cas/pushpull/expressions/Variable.java | 126 -
.../filerestrictions/FileRestrictions.java | 518 ---
.../cas/pushpull/filerestrictions/Parser.java | 43 -
.../pushpull/filerestrictions/VirtualFile.java | 315 --
.../filerestrictions/VirtualFileStructure.java | 66 -
.../parsers/ClassNoaaEmailParser.java | 123 -
.../parsers/DirStructXmlParser.java | 346 --
.../parsers/FileListParser.java | 59 -
.../parsers/GenericEmailParser.java | 168 -
.../renamingconventions/RenamingConvention.java | 168 -
.../objectfactory/PushPullObjectFactory.java | 76 -
.../cas/pushpull/protocol/ProtocolHandler.java | 603 ----
.../cas/pushpull/protocol/ProtocolPath.java | 142 -
.../oodt/cas/pushpull/protocol/RemoteSite.java | 133 -
.../cas/pushpull/protocol/RemoteSiteFile.java | 87 -
.../pushpull/retrievalmethod/ListRetriever.java | 111 -
.../pushpull/retrievalmethod/RemoteCrawler.java | 174 --
.../retrievalmethod/RetrievalMethod.java | 45 -
.../DataFileToPropFileLinker.java | 183 --
.../retrievalsystem/DownloadListener.java | 41 -
.../DownloadThreadEvaluator.java | 164 -
.../retrievalsystem/DownloadingFileInfo.java | 66 -
.../retrievalsystem/FileRetrievalSystem.java | 966 ------
.../pushpull/retrievalsystem/RemoteFile.java | 97 -
.../retrievalsystem/RemoteFileMetKeys.java | 57 -
.../retrievalsystem/RetrievalSetup.java | 267 --
.../retrievalsystem/TimeAndThreadCount.java | 48 -
.../pushpull/url/handlers/imaps/Handler.java | 41 -
.../url/handlers/imaps/ImapsURLConnection.java | 46 -
.../cas/pushpull/url/handlers/sftp/Handler.java | 41 -
.../url/handlers/sftp/SftpURLConnection.java | 44 -
.../cas/pushpull/util/ExpressionValidator.java | 131 -
pushpull/src/main/resources/REMOVE.log | 18 -
pushpull/src/main/resources/default.properties | 21 -
.../Push-Pull-User-Manual_2008-02-12.doc | Bin 431616 -> 0 bytes
.../ClassNoaaEmailParserFiles/IasiEmail | 129 -
.../DirStructXmlParserFiles/AIRABRAD.xml | 26 -
.../DirStructXmlParserFiles/AIRS3ST8.xml | 23 -
.../DirStructXmlParserFiles/AIRS3STD.xml | 23 -
.../DirStructXmlParserFiles/CLASS_Email.xml | 22 -
.../CLASS_Text_Email.xml | 26 -
.../DirStructXmlParserFiles/CloudSAT.xml | 20 -
.../examples/DirStructXmlParserFiles/GFS.xml | 30 -
.../examples/DirStructXmlParserFiles/IASI.xml | 22 -
.../examples/DirStructXmlParserFiles/IASI_2.xml | 22 -
.../DirStructXmlParserFiles/IBIBLIO.xml | 25 -
.../examples/DirStructXmlParserFiles/MODIS.xml | 23 -
.../DirStructXmlParserFiles/RTG_SST.xml | 24 -
.../ExternalSourcesFiles/ExternalSources.xml | 75 -
.../FileListParserFiles/DownloadList.txt | 7 -
.../examples/ProcmailForwarding/[dot]forward | 1 -
.../ProcmailForwarding/[dot]procmail/general.rc | 25 -
.../examples/ProcmailForwarding/[dot]procmailrc | 7 -
.../examples/RemoteSpecsFiles/RemoteSpecs.xml | 181 --
pushpull/src/main/resources/jssecacerts | Bin 113900 -> 0 bytes
pushpull/src/main/resources/logging.properties | 43 -
.../policy/ParserToRetrievalMethodMap.xml | 30 -
.../resources/policy/ProtocolFactoryInfo.xml | 45 -
.../src/main/resources/policy/mimetypes.xml | 60 -
.../src/main/resources/policy/mimetypes.xsd | 71 -
.../resources/push_pull_framework.properties | 106 -
.../src/site/resources/images/cas-pushpull.jpg | Bin 72076 -> 0 bytes
.../src/site/resources/images/cas-pushpull.psd | Bin 1013848 -> 0 bytes
.../resources/images/pp_extension_points.png | Bin 50656 -> 0 bytes
.../site/resources/images/pp_object_model.png | Bin 15808 -> 0 bytes
pushpull/src/site/site.xml | 32 -
.../src/site/xdoc/development/developer.xml | 286 --
pushpull/src/site/xdoc/development/maven.xml | 176 --
pushpull/src/site/xdoc/user/advanced.xml | 50 -
pushpull/src/site/xdoc/user/basic.xml | 50 -
pushpull/src/site/xdoc/user/index.xml | 49 -
.../parsers/GenericEmailParserTest.java | 75 -
pushpull/src/test/resources/TestEmail.txt | 16 -
sso/pom.xml | 75 -
.../sso/AbstractWebBasedSingleSignOn.java | 90 -
.../org/apache/oodt/security/sso/DummyImpl.java | 102 -
.../apache/oodt/security/sso/OpenSSOImpl.java | 190 --
.../apache/oodt/security/sso/SingleSignOn.java | 85 -
.../oodt/security/sso/SingleSignOnFactory.java | 68 -
.../security/sso/opensso/IdentityDetails.java | 136 -
.../oodt/security/sso/opensso/SSOMetKeys.java | 81 -
.../oodt/security/sso/opensso/SSOProxy.java | 308 --
.../sso/opensso/SingleSignOnException.java | 11 -
.../oodt/security/sso/opensso/UserDetails.java | 97 -
sso/src/main/php/pear/Config.php | 65 -
sso/src/main/php/pear/SingleSignOn.php | 202 --
sso/src/main/php/pear/package.xml | 94 -
vagrant/radix/README.txt | 51 -
vagrant/radix/Vagrantfile | 129 -
vagrant/radix/vagrant/conf/terminal/bashrc | 110 -
vagrant/radix/vagrant/env.sh | 28 -
vagrant/radix/vagrant/provision.sh | 70 -
xmlps/.gitignore | 1 -
xmlps/pom.xml | 146 -
xmlps/src/main/conf/example-ps.xml | 71 -
xmlps/src/main/conf/example.db.properties | 21 -
.../oodt/xmlps/exceptions/XmlpsException.java | 27 -
.../oodt/xmlps/mapping/DatabaseTable.java | 118 -
.../oodt/xmlps/mapping/DatabaseTableGroup.java | 82 -
.../apache/oodt/xmlps/mapping/FieldScope.java | 35 -
.../apache/oodt/xmlps/mapping/FieldType.java | 35 -
.../org/apache/oodt/xmlps/mapping/Mapping.java | 163 -
.../apache/oodt/xmlps/mapping/MappingField.java | 251 --
.../oodt/xmlps/mapping/MappingReader.java | 206 --
.../xmlps/mapping/MappingReaderMetKeys.java | 65 -
.../oodt/xmlps/mapping/funcs/MappingFunc.java | 64 -
.../oodt/xmlps/mapping/funcs/ReplaceFunc.java | 77 -
.../apache/oodt/xmlps/product/DBMSExecutor.java | 68 -
.../oodt/xmlps/product/XMLPSProductHandler.java | 390 ---
.../apache/oodt/xmlps/profile/DBMSExecutor.java | 169 -
.../oodt/xmlps/profile/XMLPSProfileHandler.java | 200 --
.../oodt/xmlps/queryparser/AndExpression.java | 30 -
.../xmlps/queryparser/ContainsExpression.java | 30 -
.../xmlps/queryparser/EqualsExpression.java | 30 -
.../oodt/xmlps/queryparser/Expression.java | 34 -
.../GreaterThanEqualsExpression.java | 31 -
.../queryparser/GreaterThanExpression.java | 31 -
.../xmlps/queryparser/HandlerQueryParser.java | 132 -
.../queryparser/LessThanEqualsExpression.java | 33 -
.../xmlps/queryparser/LessThanExpression.java | 33 -
.../apache/oodt/xmlps/queryparser/Literal.java | 39 -
.../oodt/xmlps/queryparser/LogOpExpression.java | 79 -
.../oodt/xmlps/queryparser/OrExpression.java | 30 -
.../oodt/xmlps/queryparser/ParseConstants.java | 65 -
.../oodt/xmlps/queryparser/RelOpExpression.java | 75 -
.../oodt/xmlps/queryparser/WildcardLiteral.java | 48 -
.../apache/oodt/xmlps/structs/CDEResult.java | 181 --
.../xmlps/structs/CDEResultInputStream.java | 121 -
.../org/apache/oodt/xmlps/structs/CDERow.java | 70 -
.../org/apache/oodt/xmlps/structs/CDEValue.java | 74 -
.../xmlps/util/GenericCDEObjectFactory.java | 70 -
.../apache/oodt/xmlps/util/XMLQueryHelper.java | 38 -
.../apache/oodt/xmlps/util/XMLQueryKeys.java | 30 -
.../oodt/xmlps/mapping/TestMappingReader.java | 165 -
.../xmlps/product/TestXMLPSProductHandler.java | 182 --
.../xmlps/profile/TestXMLPSProfileHandler.java | 71 -
.../queryparser/TestHandlerQueryParser.java | 111 -
.../oodt/xmlps/structs/TestCDEResult.java | 122 -
.../xmlps/structs/TestCDEResultInputStream.java | 137 -
xmlps/src/test/resources/loging.properties | 34 -
xmlps/src/test/resources/test-ps.xml | 120 -
.../test/resources/test-required-tables-ps.xml | 71 -
.../test/resources/test-same-col-name-ps.xml | 63 -
xmlquery/.gitignore | 1 -
xmlquery/pom.xml | 128 -
xmlquery/src/main/conf/mime.properties | 407 ---
xmlquery/src/main/dtd/query.dtd | 100 -
.../oodt/product/HttpRedirectException.java | 40 -
.../apache/oodt/product/ProductException.java | 62 -
.../java/org/apache/oodt/product/Retriever.java | 46 -
.../apache/oodt/xmlquery/ByteArrayCodec.java | 63 -
.../java/org/apache/oodt/xmlquery/Codec.java | 85 -
.../org/apache/oodt/xmlquery/CodecFactory.java | 60 -
.../oodt/xmlquery/CompressedObjectCodec.java | 110 -
.../oodt/xmlquery/CompressedStringCodec.java | 91 -
.../java/org/apache/oodt/xmlquery/Header.java | 211 --
.../org/apache/oodt/xmlquery/ObjectCodec.java | 106 -
.../org/apache/oodt/xmlquery/QueryElement.java | 148 -
.../apache/oodt/xmlquery/QueryException.java | 37 -
.../org/apache/oodt/xmlquery/QueryHeader.java | 304 --
.../org/apache/oodt/xmlquery/QueryResult.java | 151 -
.../java/org/apache/oodt/xmlquery/Result.java | 447 ---
.../java/org/apache/oodt/xmlquery/Results.java | 60 -
.../org/apache/oodt/xmlquery/Statistic.java | 155 -
.../org/apache/oodt/xmlquery/StringCodec.java | 51 -
.../oodt/xmlquery/UnsupportedMimeTypeCodec.java | 44 -
.../java/org/apache/oodt/xmlquery/XMLQuery.java | 981 ------
.../xmlquery/activity/QueryConstructed.java | 23 -
.../oodt/xmlquery/activity/ResultsReceived.java | 23 -
.../java/org/apache/oodt/xmlquery/package.html | 26 -
.../src/site/resources/images/edm-query.jpg | Bin 57650 -> 0 bytes
.../src/site/resources/images/large-stack.png | Bin 41424 -> 0 bytes
.../src/site/resources/images/large-stack.psd | Bin 282874 -> 0 bytes
xmlquery/src/site/resources/images/results.png | Bin 53580 -> 0 bytes
xmlquery/src/site/resources/images/results.psd | Bin 275480 -> 0 bytes
.../src/site/resources/images/small-stack.png | Bin 12368 -> 0 bytes
.../src/site/resources/images/small-stack.psd | Bin 89725 -> 0 bytes
xmlquery/src/site/resources/images/xmlquery.png | Bin 85734 -> 0 bytes
xmlquery/src/site/resources/images/xmlquery.psd | Bin 352069 -> 0 bytes
xmlquery/src/site/site.xml | 33 -
xmlquery/src/site/xdoc/disquery/index.xml | 106 -
xmlquery/src/site/xdoc/servlet/index.xml | 640 ----
xmlquery/src/site/xdoc/tutorial/index.xml | 659 ----
.../apache/oodt/xmlquery/CodecFactoryTest.java | 61 -
.../org/apache/oodt/xmlquery/CodecTest.java | 77 -
.../xmlquery/CompressedObjectCodecTest.java | 42 -
.../xmlquery/CompressedStringCodecTest.java | 37 -
.../oodt/xmlquery/EmptyByteArrayCodecTest.java | 51 -
.../org/apache/oodt/xmlquery/HeaderTest.java | 142 -
.../apache/oodt/xmlquery/ObjectCodecTest.java | 42 -
.../apache/oodt/xmlquery/QueryElementTest.java | 93 -
.../org/apache/oodt/xmlquery/ResultTest.java | 166 -
.../apache/oodt/xmlquery/StringCodecTest.java | 37 -
.../org/apache/oodt/xmlquery/XMLQueryTest.java | 225 --
870 files changed, 103981 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/fmbrowser/pom.xml
----------------------------------------------------------------------
diff --git a/app/fmbrowser/pom.xml b/app/fmbrowser/pom.xml
deleted file mode 100644
index f266b2e..0000000
--- a/app/fmbrowser/pom.xml
+++ /dev/null
@@ -1,81 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more contributor
-license agreements. See the NOTICE.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>
- <parent>
- <groupId>org.apache.oodt</groupId>
- <artifactId>oodt-core</artifactId>
- <version>1.1-SNAPSHOT</version>
- <relativePath>../../core/pom.xml</relativePath>
- </parent>
- <artifactId>cas-fm-browser</artifactId>
- <name>Catalog and Archive File Management Browser</name>
- <description>The graphical front-end interface to the Catalog and Archive Service. This component
- provides the user of the CAS File Manager with a graphical environment in which they
- can view archived products' metadata, query for products with particular metadata,
- and export results of queries to the MS Excel(c) file format.</description>
- <!-- All dependencies should be listed in core/pom.xml and be ordered alphabetically by package and artifact.
- Once the dependency is in the core pom, it can then be used in other modules without the version tags.
- For example, within core/pom.xml:
-
- <dependency>
- <groupId>com.amazonaws</groupId>
- <artifactId>aws-java-sdk</artifactId>
- <version>1.7.4</version>
- </dependency>
-
- Elsewhere in the platform:
- <dependency>
- <groupId>com.amazonaws</groupId>
- <artifactId>aws-java-sdk</artifactId>
- </dependency>
-
- Where possible the same dependency version should be used across the whole platform but if required the version
- can be overridden in a specific pom and should have a comment explaing why the version has been overridden
--->
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.oodt</groupId>
- <artifactId>cas-filemgr</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.oodt</groupId>
- <artifactId>cas-metadata</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.poi</groupId>
- <artifactId>poi</artifactId>
- </dependency>
-
-
- </dependencies>
- <build>
- <plugins />
- </build>
- <scm>
- <!--<connection>scm:svn:https://svn.apache.org/repos/asf/oodt/trunk/app/fmbrowser</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/oodt/trunk/app/fmbrowser</developerConnection>
- <url>http://svn.apache.org/viewvc/oodt/trunk/app/fmbrowser</url>-->
- <tag>0.13-SNAPSHOT</tag>
- </scm>
-</project>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/fmbrowser/src/main/bin/filemgr-browser
----------------------------------------------------------------------
diff --git a/app/fmbrowser/src/main/bin/filemgr-browser b/app/fmbrowser/src/main/bin/filemgr-browser
deleted file mode 100644
index f6d3881..0000000
--- a/app/fmbrowser/src/main/bin/filemgr-browser
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/sh
-#
-# init script for XmlRpcFileManager
-#
-# chkconfig: 345 88 22
-# description: CAS File Manager Browser
-#
-# 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.
-#
-# $Id$
-
-[ -f /etc/sysconfig/java ] && . /etc/sysconfig/java
-#[ -f /etc/sysconfig/cas-filemgr] && . /etc/sysconfig/cas-filemgr
-
-JAVA_HOME=/path/to/java/home
-export JAVA_HOME
-FILEMGR_BROWSER_HOME=..
-export FILEMGR_BROWSER_HOME
-
-PATH=${JAVA_HOME}/bin:${FILEMGR_BROWSER_HOME}/bin:/usr/bin:/bin:/usr/sbin:/sbin
-export PATH
-
-$JAVA_HOME/bin/java -Djava.ext.dirs=${FILEMGR_BROWSER_HOME}/lib \
- org.apache.oodt.cas.filemgr.browser.system.XmlRpcFilemgrBrowser &
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/controller/TableListener.java
----------------------------------------------------------------------
diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/controller/TableListener.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/controller/TableListener.java
deleted file mode 100644
index 7f49328..0000000
--- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/controller/TableListener.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.filemgr.browser.controller;
-
-import org.apache.oodt.cas.filemgr.browser.view.menus.RightClickMenu;
-import org.apache.oodt.cas.filemgr.browser.view.panels.HeaderCell;
-import org.apache.oodt.cas.filemgr.browser.view.panels.HeaderSpacer;
-import org.apache.oodt.cas.filemgr.browser.view.panels.Row;
-import org.apache.oodt.cas.filemgr.browser.view.panels.TablePane;
-import org.apache.poi.hssf.usermodel.HSSFRow;
-import org.apache.poi.hssf.usermodel.HSSFSheet;
-import org.apache.poi.hssf.usermodel.HSSFWorkbook;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.io.FileOutputStream;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.swing.JFileChooser;
-
-public class TableListener implements MouseListener, ActionListener {
-
- private static Logger LOG = Logger.getLogger(TableListener.class.getName());
-
- private Component caller;
- private TablePane table;
- private int mousePos;
- private RightClickMenu rcMenu;
-
- public TableListener(TablePane t) {
- table = t;
- mousePos = -1;
- caller = null;
- rcMenu = new RightClickMenu(this);
-
- }
-
- public void mouseClicked(MouseEvent arg0) {
- }
-
- public void mouseEntered(MouseEvent arg0) {
- }
-
- public void mouseExited(MouseEvent e) {
- }
-
- public void mousePressed(MouseEvent e) {
- caller = e.getComponent();
- mousePos = e.getX() + caller.getX();
- }
-
- public void mouseReleased(MouseEvent e) {
- if (caller != null) {
- if (caller instanceof HeaderSpacer) {
- HeaderSpacer hsCaller = (HeaderSpacer) caller;
- if (e.getModifiers() == 18
- && table.hiddenCols.contains(Integer.valueOf(hsCaller.getColNum() + 1))) {
- rcMenu.setUnhideMode();
- rcMenu.show(caller, e.getX(), e.getY());
-
- } else {
- int change = e.getX() + caller.getX() - mousePos;
- int curWidth = table.header.getWidth(hsCaller.getColNum());
- table.header.changeWidth(hsCaller.getColNum(), curWidth + change);
-
- for (int i = 1; i < table.getComponentCount(); i++) {
- ((Row) table.getComponent(i)).changeWidth(((HeaderSpacer) caller)
- .getColNum(), curWidth + change + 2);
- }
- caller = null;
- }
- } else {
- if (caller instanceof HeaderCell && e.getModifiers() == 18) {
- rcMenu.setHideMode();
- rcMenu.show(caller, e.getX(), e.getY());
-
- }
- }
- }
-
- }
-
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getActionCommand().equals("Hide")) {
- if (caller != null) {
- int colNum = ((HeaderCell) caller).getColNum();
- table.hideColumn(colNum);
- caller = null;
- }
- } else if (arg0.getActionCommand().equals("Unhide")) {
- if (caller != null) {
- int colNum = ((HeaderSpacer) caller).getColNum() + 1;
- table.unhideColumn(colNum);
- caller = null;
- }
- } else if (arg0.getActionCommand().equals("Unhide Columns")) {
- while (!table.hiddenCols.isEmpty()) {
- table.unhideColumn(table.hiddenCols.firstElement());
- }
- } else if (arg0.getActionCommand().equals("Export Table")) {
-
- final JFileChooser fc = new JFileChooser();
- int returnVal = fc.showSaveDialog(table);
- if (returnVal == JFileChooser.APPROVE_OPTION) {
-
- // write out excel file
- String fullFileName = (fc.getSelectedFile()).getAbsolutePath();
- if (!fullFileName.endsWith(".xls")) {
- fullFileName += ".xls";
- }
-
- HSSFWorkbook wb = new HSSFWorkbook();
- HSSFSheet sheet = wb.createSheet("results");
- HSSFRow headerRow = sheet.createRow((short) 0);
-
- int i = 0;
- for (int j = 0; j < table.getRow(0).getComponentCount(); j++) {
- if (!table.hiddenCols.contains(Integer.valueOf(j))) {
- headerRow.createCell((short) i).setCellValue(
- table.header.getText(j));
- i++;
- }
- }
-
- for (int k = 0; k < table.getComponentCount() - 1; k++) {
- HSSFRow row = sheet.createRow((short) k + 1);
- i = 0;
- for (int j = 0; j < table.getRow(0).getComponentCount(); j++) {
- if (!table.hiddenCols.contains(j)) {
- row.createCell((short) i).setCellValue(
- (table.getRow(k)).getText(j));
- i++;
- }
- }
- }
-
- FileOutputStream fileOut;
- try {
-
- fileOut = new FileOutputStream(fullFileName);
- wb.write(fileOut);
- fileOut.close();
-
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- }
- }
-
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/controller/WindowListener.java
----------------------------------------------------------------------
diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/controller/WindowListener.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/controller/WindowListener.java
deleted file mode 100644
index 81fd721..0000000
--- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/controller/WindowListener.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.filemgr.browser.controller;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.JButton;
-import javax.swing.JOptionPane;
-
-import org.apache.oodt.cas.filemgr.browser.model.CasDB;
-import org.apache.oodt.cas.filemgr.browser.view.MainWindow;
-import org.apache.oodt.cas.filemgr.browser.view.prompts.ConnectPrompt;
-import org.apache.oodt.cas.filemgr.browser.view.prompts.QueryBuilderPrompt;
-import org.apache.oodt.cas.filemgr.browser.view.prompts.SortPrompt;
-
-public class WindowListener implements ActionListener {
-
- private MainWindow window;
- private ConnectPrompt prompt;
- private SortPrompt sort;
- private QueryBuilderPrompt query;
-
- private CasDB db;
-
- public WindowListener(MainWindow m) {
- window = m;
- db = new CasDB();
- }
-
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getActionCommand().equals("About")) {
- String aboutInfo = "OODT Catalog and Archive Server File Manger Browser.\n"
- + "Copyright (c) 2010, Apache Software Foundation.";
- JOptionPane.showMessageDialog(window, aboutInfo);
- } else if (arg0.getActionCommand().equals("Query Language")) {
- String aboutQueryLanguage = "The CAS File Manager Browser uses the Lucene Query Language.\n"
- + "More Information can be found at:\n"
- + "http://lucene.apache.org/java/docs/queryparsersyntax.html";
- JOptionPane.showMessageDialog(window, aboutQueryLanguage);
- } else if (arg0.getActionCommand().equals("Exit")) {
- String exitWarning = "Are you sure you want to exit the CAS File Manager Browser?\n"
- + "All unexported queries will be lost.";
- int returnVal = JOptionPane.showConfirmDialog(window, exitWarning,
- "Exit", JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);
- if (returnVal == JOptionPane.OK_OPTION) {
- System.exit(0);
- }
- } else if (arg0.getActionCommand().equals("Connect...")) {
- // this is from the main menu
- window.bar.changeConnectStatus();
- prompt = new ConnectPrompt(this);
- prompt.pack();
- prompt.setVisible(true);
- } else if (arg0.getActionCommand().equals("Disconnect")) {
- String disconnectWarning = "Are you sure you want to disconnect from this File Manager?\n"
- + "All unexported queries will be lost.";
- int returnVal = JOptionPane.showConfirmDialog(window, disconnectWarning,
- "Disconnect", JOptionPane.OK_CANCEL_OPTION,
- JOptionPane.WARNING_MESSAGE);
- if (returnVal == JOptionPane.OK_OPTION) {
- window.bar.changeConnectStatus();
- db.disconnect();
- window.mPane.tPane.setBlank();
- window.qPane.updateTypes(new String[] { "" });
- window.bPane.changeStatus("Disconnected");
- }
- } else if (arg0.getActionCommand().equals("Cancel")) {
- if (((JButton) arg0.getSource()).getName().equals("ConnectCancel")) {
- prompt.dispose();
- window.bar.changeConnectStatus();
- } else if (((JButton) arg0.getSource()).getName().equals("SortCancel")) {
- sort.dispose();
- }
- } else if (arg0.getActionCommand().equals("Connect")) {
- // this is from the connect prompt
- boolean connected = db.connect(prompt.getCASUrl());
- if (connected) {
- window.qPane.updateTypes(db.getAvailableTypes());
- window.bPane.changeStatus("Connected to " + prompt.getCASUrl());
- } else {
- window.bar.changeConnectStatus();
- String errorConnectingString = "Error Connecting to CAS File Manager at this following address:"
- + prompt.getCASUrl();
- JOptionPane.showMessageDialog(window, errorConnectingString, "Error",
- JOptionPane.ERROR_MESSAGE);
- }
- prompt.dispose();
- } else if (arg0.getActionCommand().equals("Sort")) {
- sort = new SortPrompt(window, this);
- sort.pack();
- sort.setVisible(true);
- } else if (arg0.getActionCommand().equals("Query Builder")) {
- if (db.isConnected()) {
- query = new QueryBuilderPrompt(db, this);
- query.pack();
- query.setVisible(true);
- } else {
- String errorQueryString = "You must connect to a CAS File Manager before using the Query Builder.";
- JOptionPane.showMessageDialog(window, errorQueryString, "Disconnected",
- JOptionPane.WARNING_MESSAGE);
- }
- } else if (arg0.getActionCommand().equals("OK")) {
- window.mPane.tPane.sortRows(sort.getSortIndex(), sort.getSortType());
- sort.dispose();
- } else if (arg0.getActionCommand().equals("Search")) {
- if (((JButton) arg0.getSource()).getName().equals("AdvancedQuery")) {
- if (db.isConnected()) {
- window.bPane.changeStatus("Querying the CAS...");
- boolean result = db.issueQuery(query.getQuery(), query
- .getProductType());
- if (result) {
- window.mPane.tPane.newTable(db.results.getData());
- window.bPane.changeStatus("Query: " + query.getQueryString()
- + " returned " + db.results.getNumRecords() + " records.");
- } else {
- window.mPane.tPane.setBlank();
- window.bPane.changeStatus("Query failed.");
- window.qPane.clearQuery();
- }
- }
- query.dispose();
- } else {
- if (db.isConnected()) {
- window.bPane.changeStatus("Querying the CAS...");
- String query = window.qPane.getQuery();
- boolean result = db.createQuery(query, window.qPane.getType());
- if (result) {
- window.mPane.tPane.newTable(db.results.getData());
- window.bPane.changeStatus("Query: " + query + " returned "
- + db.results.getNumRecords() + " records.");
- } else {
- window.mPane.tPane.setBlank();
- window.bPane.changeStatus("Query failed.");
- window.qPane.clearQuery();
- }
- }
- }
- } else if (arg0.getActionCommand().equals("Clear Query")) {
- String clearWarning = "Are you sure you want to clear the current Query?\n"
- + "All unexported queries will be lost.";
- int returnVal = JOptionPane.showConfirmDialog(window, clearWarning,
- "Clear", JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);
- if (returnVal == JOptionPane.OK_OPTION) {
- window.mPane.tPane.setBlank();
- window.bPane.changeStatus("Query cleared.");
- }
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/model/CasDB.java
----------------------------------------------------------------------
diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/model/CasDB.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/model/CasDB.java
deleted file mode 100644
index ef7109e..0000000
--- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/model/CasDB.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.filemgr.browser.model;
-
-import org.apache.oodt.cas.filemgr.structs.Element;
-import org.apache.oodt.cas.filemgr.structs.Product;
-import org.apache.oodt.cas.filemgr.structs.ProductType;
-import org.apache.oodt.cas.filemgr.structs.exceptions.RepositoryManagerException;
-import org.apache.oodt.cas.filemgr.structs.exceptions.ValidationLayerException;
-import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient;
-import org.apache.oodt.cas.metadata.Metadata;
-
-import java.net.URL;
-import java.util.Vector;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-public class CasDB {
-
- public static final int INT = 20;
- URL filemgrUrl;
- XmlRpcFileManagerClient client;
- public Results results;
- private static Logger LOG = Logger.getLogger(CasDB.class.getName());
- private static String freeTextBlock = "__FREE__";
-
- public CasDB() {
- filemgrUrl = null;
- }
-
- public boolean connect(String cas) {
- try {
- filemgrUrl = new URL(cas);
- client = new XmlRpcFileManagerClient(filemgrUrl);
- } catch (Exception e) {
- filemgrUrl = null;
- return false;
- }
- return true;
- }
-
- public boolean disconnect() {
- filemgrUrl = null;
- return true;
- }
-
- public boolean isConnected() {
- return filemgrUrl != null;
- }
-
- public String[] getAvailableTypes() {
- String[] types = null;
- if (filemgrUrl != null) {
- try {
- Vector<ProductType> v = (Vector<ProductType>) client.getProductTypes();
- types = new String[v.size()];
-
- } catch (RepositoryManagerException e) {
- LOG.log(Level.SEVERE, e.getMessage());
- }
-
- } else {
- types = new String[1];
- types[0] = "";
- }
-
- return types;
- }
-
- public String[] getAvailableElements(String productTypeName) {
- String[] elements = null;
- if (filemgrUrl != null) {
- try {
- ProductType pt = client.getProductTypeByName(productTypeName);
- Vector<Element> v = (Vector<Element>) client
- .getElementsByProductType(pt);
- elements = new String[v.size()];
-
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- }
- } else {
- elements = new String[1];
- elements[0] = "";
- }
- return elements;
- }
-
- public String getElementID(String elementName) {
- String elementID = "";
- Element e;
- try {
- e = client.getElementByName(elementName);
- elementID = e.getElementId();
- } catch (ValidationLayerException ignored) {
- }
- return elementID;
- }
-
- public boolean issueQuery(org.apache.oodt.cas.filemgr.structs.Query query,
- String productType) {
- results = new Results();
- try {
- ProductType type = client.getProductTypeByName(productType);
- Vector<Product> products = (Vector<Product>) client.query(query, type);
- int maxVal = INT;
- if (products.size() < maxVal) {
- maxVal = products.size();
- }
- for (int i = 0; i < maxVal; i++) {
- Metadata m = client.getMetadata(products.get(i));
- results.addProduct(m);
- }
- } catch (Exception e) {
- return false;
- }
-
- return true;
- }
-
- public boolean createQuery(String queryText, String productType) {
-
- results = new Results();
- if (queryText.trim().equals("*")) {
- ProductType type;
- try {
- type = client.getProductTypeByName(productType);
- Vector<Product> products = (Vector<Product>) client
- .getProductsByProductType(type);
- int maxVal = INT;
- if (products.size() < maxVal) {
- maxVal = products.size();
- }
- for (int i = 0; i < maxVal; i++) {
- Metadata m = client.getMetadata(products.get(i));
- results.addProduct(m);
- }
- } catch (Exception e) {
- return false;
- }
-
- } else {
-
- QueryBuilder qb = new QueryBuilder(this);
- org.apache.oodt.cas.filemgr.structs.Query casQ = qb.ParseQuery(queryText);
- ProductType type;
- try {
- type = client.getProductTypeByName(productType);
- Vector<Product> products = (Vector<Product>) client.query(casQ, type);
- int maxVal = INT;
- if (products.size() < maxVal) {
- maxVal = products.size();
- }
- for (int i = 0; i < maxVal; i++) {
- Metadata m = client.getMetadata(products.get(i));
- results.addProduct(m);
- }
- } catch (Exception e) {
- return false;
- }
-
- }
-
- return true;
- }
-
- public boolean clearQuery() {
- results = null;
- return true;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/model/QueryBuilder.java
----------------------------------------------------------------------
diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/model/QueryBuilder.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/model/QueryBuilder.java
deleted file mode 100644
index 3c08acb..0000000
--- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/model/QueryBuilder.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.filemgr.browser.model;
-
-import org.apache.lucene.index.Term;
-import org.apache.lucene.queryparser.classic.QueryParser;
-import org.apache.lucene.search.*;
-import org.apache.lucene.util.BytesRef;
-import org.apache.oodt.cas.filemgr.structs.Query;
-import org.apache.oodt.cas.filemgr.structs.RangeQueryCriteria;
-import org.apache.oodt.cas.filemgr.structs.TermQueryCriteria;
-import org.apache.oodt.cas.filemgr.tools.CASAnalyzer;
-
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-public class QueryBuilder {
-
- private CasDB database;
- private static Logger LOG = Logger.getLogger(QueryBuilder.class.getName());
- public QueryBuilder(CasDB db) {
- database = db;
- }
-
- public Query ParseQuery(String query) {
- // note that "__FREE__" is a control work for free text searching
- QueryParser parser = new QueryParser("__FREE__", new CASAnalyzer());
-
- org.apache.lucene.search.Query luceneQ = null;
- org.apache.oodt.cas.filemgr.structs.Query casQ = new org.apache.oodt.cas.filemgr.structs.Query();
-
- try {
- luceneQ = parser.parse(query);
- } catch (org.apache.lucene.queryparser.classic.ParseException e) {
- // TODO Auto-generated catch block
- LOG.log(Level.SEVERE, e.getMessage());
- }
-
- System.out.println(luceneQ != null ? luceneQ.toString() : null);
- GenerateCASQuery(casQ, luceneQ);
-
- return casQ;
- }
-
- public void GenerateCASQuery(org.apache.oodt.cas.filemgr.structs.Query casQ,
- org.apache.lucene.search.Query luceneQ) {
- if (luceneQ instanceof TermQuery) {
- Term t = ((TermQuery) luceneQ).getTerm();
- if (!t.field().equals("__FREE__")) {
- String element = database.getElementID(t.field());
- if (!element.equals("") && !t.text().equals("")) {
-
- casQ.addCriterion(new TermQueryCriteria(element, t.text()));
- }
- }
- } else if (luceneQ instanceof PhraseQuery) {
- Term[] t = ((PhraseQuery) luceneQ).getTerms();
- if (!t[0].field().equals("__FREE__")) {
- for (Term aT : t) {
- String element = database.getElementID(aT.field());
- if (!element.equals("") && !aT.text().equals("")) {
- casQ.addCriterion(new TermQueryCriteria(element, aT.text()));
- }
- }
- }
- } else if (luceneQ instanceof TermRangeQuery) {
- BytesRef startT = ((TermRangeQuery) luceneQ).getLowerTerm();
- BytesRef endT = ((TermRangeQuery) luceneQ).getUpperTerm();
- String element = database.getElementID(((TermRangeQuery) luceneQ).getField());
- if (!element.equals("") && !startT.utf8ToString().equals("")
- && !endT.utf8ToString().equals("")) {
- casQ.addCriterion(new RangeQueryCriteria(element, startT.utf8ToString(), endT
- .utf8ToString()));
- }
- } else if (luceneQ instanceof BooleanQuery) {
- List<BooleanClause> clauses = ((BooleanQuery) luceneQ).clauses();
- for (BooleanClause clause : clauses) {
- GenerateCASQuery(casQ, (clause).getQuery());
- }
- } else {
- System.out.println("Error Parsing Query");
- System.exit(-1);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/model/Results.java
----------------------------------------------------------------------
diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/model/Results.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/model/Results.java
deleted file mode 100644
index 248067e..0000000
--- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/model/Results.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.filemgr.browser.model;
-
-import org.apache.oodt.cas.metadata.Metadata;
-
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-
-public class Results {
-
- public Vector<Metadata> products;
-
- public Results() {
- products = new Vector<Metadata>();
- }
-
- public void addProduct(Metadata m) {
- products.add(m);
- }
-
- public int getNumRecords() {
- return products.size();
- }
-
- public String[][] getData() {
-
- String[][] data = null;
- if (products.size() > 0) {
- data = new String[products.size() + 1][];
-
- Hashtable hash = products.firstElement().getHashTable();
- int numCols = hash.size();
- data[0] = new String[numCols];
- int i = 0;
- for (Enumeration e = hash.keys(); e.hasMoreElements();) {
- data[0][i] = e.nextElement().toString();
- System.out.println(data[0][i]);
- i++;
- }
-
- for (int j = 0; j < products.size(); j++) {
- data[j + 1] = new String[i];
- for (int k = 0; k < i; k++) {
- data[j + 1][k] = products.get(j).getMetadata(data[0][k]);
- }
- }
-
- }
- return data;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/system/XmlRpcFilemgrBrowser.java
----------------------------------------------------------------------
diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/system/XmlRpcFilemgrBrowser.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/system/XmlRpcFilemgrBrowser.java
deleted file mode 100644
index 0ac9caf..0000000
--- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/system/XmlRpcFilemgrBrowser.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.filemgr.browser.system;
-
-import org.apache.oodt.cas.filemgr.browser.view.MainWindow;
-
-public class XmlRpcFilemgrBrowser {
-
- private static MainWindow window;
-
- public static void main(String args[]) {
- javax.swing.SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- window = new MainWindow();
- window.pack();
- window.setVisible(true);
- }
- });
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/GuiParams.java
----------------------------------------------------------------------
diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/GuiParams.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/GuiParams.java
deleted file mode 100644
index 7f12da5..0000000
--- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/GuiParams.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.filemgr.browser.view;
-
-public class GuiParams {
-
- public static final int WINDOW_WIDTH = 600;
- public static final int WINDOW_HEIGHT = 400;
-
- public static final int DEFAULT_CELL_WIDTH = 70;
- public static final int DEFAULT_CELL_HEIGHT = 20;
-
-}
[19/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/pom.xml
----------------------------------------------------------------------
diff --git a/profile/pom.xml b/profile/pom.xml
deleted file mode 100644
index 3d67496..0000000
--- a/profile/pom.xml
+++ /dev/null
@@ -1,156 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.oodt</groupId>
- <artifactId>oodt-core</artifactId>
- <version>1.1-SNAPSHOT</version>
- <relativePath>../core/pom.xml</relativePath>
- </parent>
- <artifactId>oodt-profile</artifactId>
- <name>Profile Service</name>
- <description>The Profile Service describes and locates resources using metadata
- descriptions. These descriptions, called profiles, tell of a
- resource's inception, composition, and location using a mix of
- Dublin Core and ISO-11179 metadata as well as URIs for locations.
- The Profile Service catalogs metadata descriptions and provides
- creating, updating, and querying capabilities.</description>
- <!-- All dependencies should be listed in core/pom.xml and be ordered alphabetically by package and artifact.
- Once the dependency is in the core pom, it can then be used in other modules without the version tags.
- For example, within core/pom.xml:
-
- <dependency>
- <groupId>com.amazonaws</groupId>
- <artifactId>aws-java-sdk</artifactId>
- <version>1.7.4</version>
- </dependency>
-
- Elsewhere in the platform:
- <dependency>
- <groupId>com.amazonaws</groupId>
- <artifactId>aws-java-sdk</artifactId>
- </dependency>
-
- Where possible the same dependency version should be used across the whole platform but if required the version
- can be overridden in a specific pom and should have a comment explaing why the version has been overridden
- -->
- <dependencies>
- <dependency>
- <groupId>com.ibm.icu</groupId>
- <artifactId>icu4j</artifactId>
- <version>3.4.4</version>
- </dependency>
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <version>1.3</version>
- </dependency>
- <dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- <version>3.0-alpha1</version>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.0.4</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.2</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jena</groupId>
- <artifactId>apache-jena-libs</artifactId>
- <version>${jena.version}</version>
- <type>pom</type>
- </dependency>
- <dependency>
- <groupId>org.apache.oodt</groupId>
- <artifactId>cas-filemgr</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.oodt</groupId>
- <artifactId>oodt-commons</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.oodt</groupId>
- <artifactId>oodt-xmlquery</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- </dependencies>
- <build>
- <resources>
- <resource>
- <directory>${basedir}/src/main/dtd</directory>
- </resource>
- </resources>
- <plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <forkMode>once</forkMode>
- <excludes>
- <exclude>org/apache/oodt/profile/ProfileElementTestCase.java</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <scm>
- <!-- <connection>scm:svn:https://svn.apache.org/repos/asf/oodt/trunk/profile</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/oodt/trunk/profile</developerConnection>
- <url>http://svn.apache.org/viewvc/oodt/trunk/profile</url>-->
- <tag>0.13-SNAPSHOT</tag>
- </scm>
- <profiles>
- <profile>
- <id>audit</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>rat-maven-plugin</artifactId>
- <configuration>
- <excludes>
- <exclude>**/testdata/*</exclude>
- <exclude>**/handlers/lightweight/package.html</exclude>
- </excludes>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>check</goal>
- </goals>
- <phase>verify</phase>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-</project>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/dtd/prof.dtd
----------------------------------------------------------------------
diff --git a/profile/src/main/dtd/prof.dtd b/profile/src/main/dtd/prof.dtd
deleted file mode 100644
index ee8af94..0000000
--- a/profile/src/main/dtd/prof.dtd
+++ /dev/null
@@ -1,86 +0,0 @@
-<?xml encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<!ELEMENT profiles
- (profile*)>
-
-<!ELEMENT profile
- (profAttributes,
- resAttributes,
- profElement*)>
-
- <!ELEMENT profAttributes
- (profId, profVersion?, profType,
- profStatusId, profSecurityType?, profParentId?, profChildId*,
- profRegAuthority?, profRevisionNote*)>
-
- <!ELEMENT resAttributes
- (Identifier, Title?, Format*, Description?, Creator*, Subject*,
- Publisher*, Contributor*, Date*, Type*, Source*,
- Language*, Relation*, Coverage*, Rights*,
- resContext+, resAggregation?, resClass, resLocation*)>
-
- <!ELEMENT profElement
- (elemId?, elemName, elemDesc?, elemType?, elemUnit?,
- elemEnumFlag, (elemValue* | (elemMinValue, elemMaxValue)),
- elemSynonym*,
- elemObligation?, elemMaxOccurrence?, elemComment?)>
-
- <!ELEMENT profId (#PCDATA)>
- <!ELEMENT profVersion (#PCDATA)>
- <!ELEMENT profType (#PCDATA)>
- <!ELEMENT profParentId (#PCDATA)>
- <!ELEMENT profChildId (#PCDATA)>
- <!ELEMENT profStatusId (#PCDATA)>
- <!ELEMENT profSecurityType (#PCDATA)>
- <!ELEMENT profRegAuthority (#PCDATA)>
- <!ELEMENT profRevisionNote (#PCDATA)>
-
- <!ELEMENT Identifier (#PCDATA)>
- <!ELEMENT Title (#PCDATA)>
- <!ELEMENT Format (#PCDATA)>
- <!ELEMENT Description (#PCDATA)>
- <!ELEMENT Creator (#PCDATA)>
- <!ELEMENT Subject (#PCDATA)>
- <!ELEMENT Publisher (#PCDATA)>
- <!ELEMENT Contributor (#PCDATA)>
- <!ELEMENT Date (#PCDATA)>
- <!ELEMENT Type (#PCDATA)>
- <!ELEMENT Source (#PCDATA)>
- <!ELEMENT Language (#PCDATA)>
- <!ELEMENT Relation (#PCDATA)>
- <!ELEMENT Coverage (#PCDATA)>
- <!ELEMENT Rights (#PCDATA)>
- <!ELEMENT resContext (#PCDATA)>
- <!ELEMENT resAggregation (#PCDATA)>
- <!ELEMENT resClass (#PCDATA)>
- <!ELEMENT resLocation (#PCDATA)>
-
- <!ELEMENT elemId (#PCDATA)>
- <!ELEMENT elemName (#PCDATA)>
- <!ELEMENT elemType (#PCDATA)>
- <!ELEMENT elemEnumFlag (#PCDATA)>
- <!ELEMENT elemDesc (#PCDATA)>
- <!ELEMENT elemSynonym (#PCDATA)>
- <!ELEMENT elemUnit (#PCDATA)>
- <!ELEMENT elemValue (#PCDATA)>
- <!ELEMENT elemMinValue (#PCDATA)>
- <!ELEMENT elemMaxValue (#PCDATA)>
- <!ELEMENT elemObligation (#PCDATA)>
- <!ELEMENT elemMaxOccurrence (#PCDATA)>
- <!ELEMENT elemComment (#PCDATA)>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/DefaultFactory.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/DefaultFactory.java b/profile/src/main/java/org/apache/oodt/profile/DefaultFactory.java
deleted file mode 100644
index 33bbe3e..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/DefaultFactory.java
+++ /dev/null
@@ -1,56 +0,0 @@
-// 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.
-
-package org.apache.oodt.profile;
-
-import java.util.List;
-import org.w3c.dom.Element;
-
-/**
- * Default factory for profile objects.
- *
- * This factory creates the typical profile objects {@link RangedProfileElement}, {@link
- * UnspecifiedProfileElement}, {@link EnumeratedProfileElement}, {@link Profile}, {@link
- * ProfileAttributes}, and {@link ResourceAttributes}.
- *
- * @author Kelly
- * @version $Revision: 1.1.1.1 $
- */
-class DefaultFactory implements ObjectFactory {
- public RangedProfileElement createRangedProfileElement(Profile profile, String name, String id, String desc, String type,
- String unit, List synonyms, boolean obligation, int maxOccurrence, String comments, String min, String max) {
- return new RangedProfileElement(profile, name, id, desc, type, unit, synonyms, obligation, maxOccurrence,
- comments, min, max);
- }
- public UnspecifiedProfileElement createUnspecifiedProfileElement(Profile profile, String name, String id, String desc,
- String type, String unit, List synonyms, boolean obligation, int maxOccurrence, String comments) {
- return new UnspecifiedProfileElement(profile, name, id, desc, type, unit, synonyms, obligation, maxOccurrence,
- comments);
- }
- public EnumeratedProfileElement createEnumeratedProfileElement(Profile profile, String name, String id, String desc,
- String type, String unit, List synonyms, boolean obligation, int maxOccurrence, String comments, List values) {
- return new EnumeratedProfileElement(profile, name, id, desc, type, unit, synonyms, obligation, maxOccurrence,
- comments, values);
- }
- public Profile createProfile(Element node) {
- return new Profile(node, this);
- }
- public ProfileAttributes createProfileAttributes(Element node) {
- return new ProfileAttributes(node);
- }
- public ResourceAttributes createResourceAttributes(Profile profile, Element node) {
- return new ResourceAttributes(profile, node);
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/EnumeratedProfileElement.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/EnumeratedProfileElement.java b/profile/src/main/java/org/apache/oodt/profile/EnumeratedProfileElement.java
deleted file mode 100644
index 42304a6..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/EnumeratedProfileElement.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Node;
-import org.apache.jena.rdf.model.Model;
-import org.apache.jena.rdf.model.Resource;
-
-import java.net.URI;
-
-import org.w3c.dom.Element;
-
-/**
- * Enumerated profile element.
- *
- * Objects of this class are elements of a profile that have several enumerated values.
- *
- * @author Kelly
- */
-public class EnumeratedProfileElement extends ProfileElement {
- /**
- * Create blank profile element belonging to the given profile.
- */
- public EnumeratedProfileElement(Profile profile) {
- super(profile);
- values = new ArrayList<Object>();
- }
-
- /**
- * Create a profile element from constituent attributes.
- *
- * @param profile Profile to which this element belongs.
- * @param name Required name of the element.
- * @param id ID of the element.
- * @param desc Long description of the element.
- * @param type Data type of the element.
- * @param unit Units.
- * @param synonyms Collection of element IDs ({@link String}) that are synonyms for this element.
- * @param obligation True if this is a required element
- * @param maxOccurrence Maximum number of occurrences of this element.
- * @param comment Any comments about this element.
- * @param values Valid values.
- */
- public EnumeratedProfileElement(Profile profile, String name, String id, String desc, String type, String unit,
- List<?> synonyms, boolean obligation, int maxOccurrence, String comment, List<?> values) {
- super(profile, name, id, desc, type, unit, synonyms, obligation, maxOccurrence, comment);
- if (values.contains(null)) {
- throw new IllegalArgumentException("Null item in 'values' not allowed for enumerated profile elements");
- }
- this.values = values;
- }
-
- protected boolean isEnumerated() {
- return true;
- }
-
- protected void addValues(Node node) throws DOMException {
- if (values == null) {
- return;
- }
- for (Object value : values) {
- Element e = node.getOwnerDocument().createElement("elemValue");
- e.appendChild(node.getOwnerDocument().createCDATASection((String) value));
- node.appendChild(e);
- }
- }
-
- public String getMinValue() {
- return "";
- }
-
- public String getMaxValue() {
- return "";
- }
-
- public List getValues() {
- return values;
- }
-
- protected void addElementSpecificProperties(Model model, Resource element, ProfileAttributes profAttr, URI uri) {
- Utility.addProperty(model, element, Utility.edmValue, values, profAttr, uri);
- }
-
- /** Valid values. */
- protected List<?> values;
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/ObjectFactory.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/ObjectFactory.java b/profile/src/main/java/org/apache/oodt/profile/ObjectFactory.java
deleted file mode 100755
index e2b7a4d..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/ObjectFactory.java
+++ /dev/null
@@ -1,109 +0,0 @@
-// 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.
-
-package org.apache.oodt.profile;
-
-import java.util.List;
-import org.w3c.dom.Element;
-
-/**
- * Factory to create profile-related objects.
- *
- * @author Kelly
- * @version $Revision: 1.1.1.1 $
- */
-public interface ObjectFactory {
- /**
- * Create a ranged profile element.
- *
- * @param profile a <code>Profile</code> value.
- * @param name a <code>String</code> value.
- * @param id a <code>String</code> value.
- * @param desc a <code>String</code> value.
- * @param type a <code>String</code> value.
- * @param unit a <code>String</code> value.
- * @param synonyms a <code>List</code> value.
- * @param obligation a <code>boolean</code> value.
- * @param maxOccurrence an <code>int</code> value.
- * @param comments a <code>String</code> value.
- * @param min a <code>double</code> value.
- * @param max a <code>double</code> value.
- * @return a <code>RangedProfileElement</code> value.
- */
- RangedProfileElement createRangedProfileElement(Profile profile, String name, String id, String desc, String type,
- String unit, List synonyms, boolean obligation, int maxOccurrence, String comments, String min, String max);
-
- /**
- * Create a profile element with unspecified values.
- *
- * @param profile a <code>Profile</code> value.
- * @param name a <code>String</code> value.
- * @param id a <code>String</code> value.
- * @param desc a <code>String</code> value.
- * @param type a <code>String</code> value.
- * @param unit a <code>String</code> value.
- * @param synonyms a <code>List</code> value.
- * @param obligation a <code>boolean</code> value.
- * @param maxOccurrence an <code>int</code> value.
- * @param comments a <code>String</code> value.
- * @return an <code>UnspecifiedProfileElement</code> value.
- */
- UnspecifiedProfileElement createUnspecifiedProfileElement(Profile profile, String name, String id, String desc, String type,
- String unit, List synonyms, boolean obligation, int maxOccurrence, String comments);
-
- /**
- * Create a profile element with enumerated values.
- *
- * @param profile a <code>Profile</code> value.
- * @param name a <code>String</code> value.
- * @param id a <code>String</code> value.
- * @param desc a <code>String</code> value.
- * @param type a <code>String</code> value.
- * @param unit a <code>String</code> value.
- * @param synonyms a <code>List</code> value.
- * @param obligation a <code>boolean</code> value.
- * @param maxOccurrence an <code>int</code> value.
- * @param comments a <code>String</code> value.
- * @param values a <code>List</code> value.
- * @return an <code>Enumerated</code> value.
- */
- EnumeratedProfileElement createEnumeratedProfileElement(Profile profile, String name, String id, String desc, String type,
- String unit, List synonyms, boolean obligation, int maxOccurrence, String comments, List values);
-
- /**
- * Create a profile from a DOM node.
- *
- * @param node an <code>Element</code> value.
- * @return a <code>Profile</code> value.
- */
- Profile createProfile(Element node);
-
- /**
- * Create profile attributes from a DOM node.
- *
- * @param node an <code>Element</code> value.
- * @return a <code>ProfileAttributes</code> value.
- */
- ProfileAttributes createProfileAttributes(Element node);
-
- /**
- * Create resource attributes from a DOM node.
- *
- * @param profile Owning profile.
- * @param node an <code>Element</code> value.
- * @return a <code>ResourceAttributes</code> value.
- */
- ResourceAttributes createResourceAttributes(Profile profile, Element node);
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/Profile.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/Profile.java b/profile/src/main/java/org/apache/oodt/profile/Profile.java
deleted file mode 100644
index 8f9cc6e..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/Profile.java
+++ /dev/null
@@ -1,401 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile;
-
-import org.apache.jena.rdf.model.Model;
-import org.apache.jena.rdf.model.ModelFactory;
-import org.apache.jena.rdf.model.Resource;
-import org.apache.oodt.commons.util.Documentable;
-import org.apache.oodt.commons.util.XML;
-
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.SAXException;
-
-import java.io.BufferedReader;
-import java.io.FileReader;
-import java.io.OutputStreamWriter;
-import java.io.Serializable;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * A profile.
- *
- * Objects of this class are profiles. Profiles are metadata descriptions of resources.
- *
- * @author Kelly
- */
-public class Profile implements Serializable, Cloneable, Comparable<Object>, Documentable {
- /** Serial version unique ID. */
- static final long serialVersionUID = -3936851809184360591L;
-
- /** The formal public identifier of the profiles DTD. */
- public static final String PROFILES_DTD_FPI = "-//JPL//DTD Profile 1.1//EN";
- public static final int INT = 512;
-
- /** The system identifier of the profiles DTD. */
- public static String PROFILES_DTD_URL = "http://oodt.jpl.nasa.gov/grid-profile/dtd/prof.dtd";
-
- /**
- * Create a list of profiles by deserializing data from the given XML element.
- *
- * @param root Either a <profiles> or a <profile> element.
- * @param factory Factory for creation of profile-related objects.
- * @return A list of profiles.
- */
- public static List<Profile> createProfiles(Element root, ObjectFactory factory) {
- List<Profile> profiles = new ArrayList<Profile>();
- if ("profile".equals(root.getNodeName()))
- // The root is a <profile>, so add the single profile to the list.
- {
- profiles.add(factory.createProfile((Element) root));
- } else if ("profiles".equals(root.getNodeName())) {
- // The root is a <profiles>, so add each <profile> to the list.
- NodeList children = root.getChildNodes();
- for (int i = 0; i < children.getLength(); ++i) {
- Node node = children.item(i);
- if ("profile".equals(node.getNodeName())) {
- profiles.add(factory.createProfile((Element) node));
- }
- }
- } else {
- throw new IllegalArgumentException("Expected a <profiles> or <profile> top level element but got "
- + root.getNodeName());
- }
- return profiles;
- }
-
-
- /**
- * Create a list of profiles by deserializing data from the given XML element.
- *
- * This method uses the default factory that yields objects of this package,
- * namely {@link Profile}, {@link ProfileAttributes}, {@link ResourceAttributes},
- * and {@link ProfileElement} and its subclasses.
- *
- * @param root Either a <profiles> or a <profile> element.
- * @return A list of profiles.
- */
- public static List<Profile> createProfiles(Element root) {
- return createProfiles(root, new DefaultFactory());
- }
-
- /**
- * Create a blank profile.
- */
- public Profile() {
- profAttr = new ProfileAttributes();
- resAttr = new ResourceAttributes(this);
- }
-
- /**
- * Create a profile from an XML document.
- *
- * @param string The XML document (as a string).
- * @throws SAXException If the <var>string</var> can't be parsed.
- */
- public Profile(String string) throws SAXException {
- this(XML.parse(string).getDocumentElement(), new DefaultFactory());
- }
-
- /**
- * Create a profile from an XML document.
- *
- * @param string The XML document (as a string).
- * @param factory Object factory to use.
- * @throws SAXException If the <var>string</var> can't be parsed.
- */
- public Profile(String string, ObjectFactory factory) throws SAXException {
- this(XML.parse(string).getDocumentElement(), factory);
- }
-
- /**
- * Creates a new <code>Profile</code> instance.
- *
- * @param root a <code>Node</code> value.
- */
- public Profile(Node root) {
- this(root, new DefaultFactory());
- }
-
- /**
- * Create a profile from an XML document.
- *
- * @param root The <profile> element.
- */
- public Profile(Node root, ObjectFactory factory) {
- if (!root.getNodeName().equals("profile")) {
- throw new IllegalArgumentException("Construct a Profile from a <profile> element, not a <"
- + root.getNodeName() + ">");
- }
- NodeList children = root.getChildNodes();
- for (int i = 0; i < children.getLength(); ++i) {
- Node node = children.item(i);
- if ("profAttributes".equals(node.getNodeName())) {
- profAttr = factory.createProfileAttributes((Element) node);
- } else if ("resAttributes".equals(node.getNodeName())) {
- resAttr = factory.createResourceAttributes(this, (Element) node);
- } else if ("profElement".equals(node.getNodeName())) {
- ProfileElement element = ProfileElement.createProfileElement((Element) node, this, factory);
- elements.put(element.getName(), element);
- }
- }
- }
-
- /**
- * Create a profile from its attributes.
- *
- * @param profAttr Profile attributes.
- * @param resAttr Resource attributes.
- */
- public Profile(ProfileAttributes profAttr, ResourceAttributes resAttr) {
- this.profAttr = profAttr;
- this.resAttr = resAttr;
- if (this.resAttr != null) {
- this.resAttr.profile = this;
- }
- }
-
- public int hashCode() {
- return profAttr.hashCode();
- }
-
- public boolean equals(Object rhs) {
- if (rhs == this) {
- return true;
- }
- if (rhs == null || !(rhs instanceof Profile)) {
- return false;
- }
- Profile obj = (Profile) rhs;
- return profAttr.equals(obj.profAttr);
- }
-
- public int compareTo(Object rhs) {
- Profile obj = (Profile) rhs;
- return profAttr.compareTo(obj.profAttr);
- }
-
- public String toString() {
- Document doc = createProfileDocument();
- doc.removeChild(doc.getDocumentElement());
- doc.appendChild(toXML(doc));
- return XML.serialize(doc);
- }
-
- public Object clone() {
- Object clone = null;
- try {
- clone = super.clone();
- } catch (CloneNotSupportedException ignored) {}
- return clone;
- }
-
- /**
- * Get the profile attributes.
- *
- * @return The profile attributes.
- */
- public ProfileAttributes getProfileAttributes() {
- return profAttr;
- }
-
- /**
- * Get the resource attributes.
- *
- * @return The resource attributes.
- */
- public ResourceAttributes getResourceAttributes() {
- return resAttr;
- }
-
- /**
- * Set this profile's profile attributes.
- *
- * @param profAttr a <code>ProfileAttributes</code> value.
- */
- public void setProfileAttributes(ProfileAttributes profAttr) {
- this.profAttr = profAttr;
- }
-
- /**
- * Set this profile's resource attributes.
- *
- * @param resAttr a <code>ResourceAttributes</code> value.
- */
- public void setResourceAttributes(ResourceAttributes resAttr) {
- this.resAttr = resAttr;
- }
-
- /**
- * Get the profile elements.
- *
- * The profile elements are a mapping from the element name ({@link
- * java.lang.String}) to {@link ProfileElement}.
- *
- * @return The profile elements.
- */
- public Map<String, ProfileElement> getProfileElements() {
- return elements;
- }
-
- public URI getURI() {
- return resAttr.getURI();
- }
-
- /**
- * Add this profile as an RDF resource description to an RDF model.
- *
- * This creates a description of the resource that this profile describes, as well
- * as additional resources for the reified statements about the profile itself,
- * and adds them all to the given model.
- *
- * @param model Model to which to add the profile and its related descriptions.
- */
- public void addToModel(Model model) {
- Resource resource = model.createResource(getURI().toString());
- resAttr.addToModel(model, resource, profAttr);
- for (ProfileElement e : elements.values()) {
- e.addToModel(model, resource, profAttr);
- }
- }
-
- /**
- * Serialize this profile as an XML node.
- *
- * @param doc The document that will own this node.
- * @return The XML element <profile> representing these attributes.
- * @throws DOMException If an error occurs creating the XML nodes.
- */
- public Node toXML(Document doc) throws DOMException {
- return toXML(doc, /*withElements*/true);
- }
-
- /**
- * Serialize this profile as an XML node but without any elements.
- *
- * @param doc The document that will own this node.
- * @return The XML element <profile> representing these attributes.
- * @throws DOMException If an error occurs creating the XML nodes.
- */
- public Node toXMLWithoutElements(Document doc) throws DOMException {
- return toXML(doc, /*withElements*/false);
- }
-
- /**
- * Serialize this profile as an XML node.
- *
- * @param doc The document that will own this node.
- * @param withElements Include the profile elements?
- * @return The XML element <profile> representing these attributes.
- * @throws DOMException If an error occurs creating the XML nodes.
- */
- private Node toXML(Document doc, boolean withElements) throws DOMException {
- Element profile = doc.createElement("profile");
- profile.appendChild(profAttr.toXML(doc));
- profile.appendChild(resAttr.toXML(doc));
- if (withElements) {
- for (ProfileElement profileElement : elements.values()) {
- profile.appendChild((profileElement).toXML(doc));
- }
- }
- return profile;
- }
-
- /**
- * Create a <profiles> document using the profiles DTD.
- *
- * @return A <profiles> document with the profiles DTD.
- */
- public static Document createProfilesDocument() {
- return createDocument("profiles");
- }
-
- /**
- * Create a <profile> document using the profiles DTD.
- *
- * @return A <profile> document with the profiles DTD.
- */
- public static Document createProfileDocument() {
- return createDocument("profile");
- }
-
- /**
- * Create a document using the profiles DTD with the given root element.
- *
- * @param root Name of the root element.
- * @return The document with the appropriate document type declaration.
- */
- static Document createDocument(String root) {
- DocumentType docType = XML.getDOMImplementation().createDocumentType(root, PROFILES_DTD_FPI, PROFILES_DTD_URL);
- return XML.getDOMImplementation().createDocument(/*namespaceURI*/null, root, docType);
- }
-
- /** My profile attributes. */
- protected ProfileAttributes profAttr;
-
- /** My resource attributes. */
- protected ResourceAttributes resAttr;
-
- /** My elements.
- *
- * This mapping is from element name (a {@link String}) to {@link ProfileElement}.
- */
- protected Map<String, ProfileElement> elements = new ConcurrentHashMap<String, ProfileElement>();
-
- /**
- * Try to parse an XML profile in a file in its XML vocabulary. If successful,
- * you get the profile as RDF document (in XML format) to the standard output
- * after it's been digested by the profile class. If not, then you get an
- * exception.
- *
- * @param argv Command-line arguments, of which there should be one, the name of XML file containing the profile to parse
- * @throws Throwable if an error occurs.
- */
- public static void main(String[] argv) throws Throwable {
- if (argv.length != 1) {
- System.err.println("Usage: <profile.xml>");
- System.exit(1);
- }
- StringBuilder b = new StringBuilder();
- BufferedReader reader = new BufferedReader(new FileReader(argv[0]));
- char[] buf = new char[INT];
- int num;
- while ((num = reader.read(buf)) != -1) {
- b.append(buf, 0, num);
- }
- reader.close();
- Profile p = new Profile(b.toString());
-
- Model model = ModelFactory.createDefaultModel();
- p.addToModel(model);
- OutputStreamWriter writer = new OutputStreamWriter(System.out);
- model.write(writer);
- writer.close();
- System.exit(0);
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/ProfileAttributes.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/ProfileAttributes.java b/profile/src/main/java/org/apache/oodt/profile/ProfileAttributes.java
deleted file mode 100644
index c79e5f6..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/ProfileAttributes.java
+++ /dev/null
@@ -1,344 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile;
-
-import org.apache.oodt.commons.util.Documentable;
-import org.apache.oodt.commons.util.XML;
-import org.w3c.dom.*;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Profile attributes.
- *
- * Objects of this class are attributes of profiles.
- *
- * @author Kelly
- */
-public class ProfileAttributes implements Serializable, Cloneable, Comparable, Documentable {
- /**
- * Create blank profile attributes.
- */
- public ProfileAttributes() {
- id = "UNKNOWN";
- type = "UNKNOWN";
- statusID = "UNKNOWN";
- children = new ArrayList();
- revisionNotes = new ArrayList();
- }
-
- /**
- * Create profile attributes from an XML document.
- *
- * @param root The <profAttributes> element.
- */
- public ProfileAttributes(Node root) {
- children = new ArrayList();
- revisionNotes = new ArrayList();
- NodeList childNodes = root.getChildNodes();
- for (int i = 0; i < childNodes.getLength(); ++i) {
- Node node = childNodes.item(i);
- if ("profId".equals(node.getNodeName())) {
- id = XML.unwrappedText(node);
- } else if ("profVersion".equals(node.getNodeName())) {
- version = XML.unwrappedText(node);
- } else if ("profType".equals(node.getNodeName())) {
- type = XML.unwrappedText(node);
- } else if ("profStatusId".equals(node.getNodeName())) {
- statusID = XML.unwrappedText(node);
- } else if ("profSecurityType".equals(node.getNodeName())) {
- securityType = XML.unwrappedText(node);
- } else if ("profParentId".equals(node.getNodeName())) {
- parent = XML.unwrappedText(node);
- } else if ("profChildId".equals(node.getNodeName())) {
- children.add(XML.unwrappedText(node));
- } else if ("profRegAuthority".equals(node.getNodeName())) {
- regAuthority = XML.unwrappedText(node);
- } else if ("profRevisionNote".equals(node.getNodeName())) {
- revisionNotes.add(XML.unwrappedText(node));
- }
- }
- }
-
- /**
- * Create profile attributes from constituent attributes.
- *
- * @param id The profile ID.
- * @param version Version.
- * @param type Type of the profile.
- * @param statusID Status ID.
- * @param securityType Security type.
- * @param parent Parent profile IDs.
- * @param children Zero or more {@link String} child profile IDs.
- * @param regAuthority Registration authority.
- * @param revisionNotes Zero or more {@link String} revision notes.
- */
- public ProfileAttributes(String id, String version, String type, String statusID, String securityType, String parent,
- List children, String regAuthority, List revisionNotes) {
- this.id = id;
- this.version = version;
- this.type = type;
- this.statusID = statusID;
- this.securityType = securityType;
- this.parent = parent;
- this.children = children;
- this.regAuthority = regAuthority;
- this.revisionNotes = revisionNotes;
- }
-
- public int hashCode() {
- return id.hashCode();
- }
-
- public boolean equals(Object rhs) {
- if (rhs == this) {
- return true;
- }
- if (rhs == null || !(rhs instanceof ProfileAttributes)) {
- return false;
- }
- return ((ProfileAttributes) rhs).id.equals(id);
- }
-
- public int compareTo(Object rhs) {
- ProfileAttributes obj = (ProfileAttributes) rhs;
- return id.compareTo(obj.id);
- }
-
- public String toString() {
- return getClass().getName() + "[id=" + id + "]";
- }
-
- public Object clone() {
- Object clone = null;
- try {
- clone = super.clone();
- } catch (CloneNotSupportedException ignored) {}
- return clone;
- }
-
- /**
- * Get the ID.
- *
- * @return The ID.
- */
- public String getID() {
- return id;
- }
-
- /**
- * Get the version.
- *
- * @return The version.
- */
- public String getVersion() {
- return version;
- }
-
- /**
- * Get the type.
- *
- * @return The type of the profile.
- */
- public String getType() {
- return type;
- }
-
- /**
- * Get the status ID.
- *
- * @return The status ID.
- */
- public String getStatusID() {
- return statusID;
- }
-
- /**
- * Get the security type.
- *
- * @return The security type.
- */
- public String getSecurityType() {
- return securityType;
- }
-
- /**
- * Get the parent of this profile.
- *
- * @return The parent profile's ID.
- */
- public String getParent() {
- return parent;
- }
-
- /**
- * Get the children of this profile.
- *
- * @return A list of {@link String} IDs of its children.
- */
- public List getChildren() {
- return children;
- }
-
- /**
- * Get the registration authority of this profile.
- *
- * @return Its registration authority.
- */
- public String getRegAuthority() {
- return regAuthority;
- }
-
- /**
- * Get the revision notes of this profile.
- *
- * @return A list of {@link String} revision notes.
- */
- public List getRevisionNotes() {
- return revisionNotes;
- }
-
- /**
- *
- * Set the Parent
- *
- * @param theParent The Parent String.
- */
- public void setParent(String theParent){
- parent = theParent;
- }
-
- /**
- * Set the ID.
- *
- * @param id The ID.
- */
- public void setID(String id) {
- this.id = id;
- }
-
- /**
- * Set the version.
- *
- * @param version The version.
- */
- public void setVersion(String version) {
- this.version = version;
- }
-
- /**
- * Set the type.
- *
- * @param type The type of the profile.
- */
- public void setType(String type) {
- this.type = type;
- }
-
- /**
- * Set the status ID.
- *
- * @param statusID The status ID.
- */
- public void setStatusID(String statusID) {
- this.statusID = statusID;
- }
-
- /**
- * Set the security type.
- *
- * @param securityType The security type.
- */
- public void setSecurityType(String securityType) {
- this.securityType = securityType;
- }
-
- /**
- * Set the registration authority of this profile.
- *
- * @param regAuthority Its registration authority.
- */
- public void setRegAuthority(String regAuthority) {
- this.regAuthority = regAuthority;
- }
-
- /**
- * Serialize this attributes as an XML node.
- *
- * @param doc The document that will own this node.
- * @return The XML element <profAttributes> representing these attributes.
- * @throws DOMException If an error occurs creating the XML nodes.
- */
- public Node toXML(Document doc) throws DOMException {
- Element root = doc.createElement("profAttributes");
- XML.add(root, "profId", id);
- XML.addNonNull(root, "profVersion", version);
- XML.addNonNull(root, "profType", type);
- XML.addNonNull(root, "profStatusId", statusID);
- XML.addNonNull(root, "profSecurityType", securityType);
- XML.addNonNull(root, "profParentId", parent);
- XML.add(root, "profChildId", children);
- XML.addNonNull(root, "profRegAuthority", regAuthority);
- XML.add(root, "profRevisionNote", revisionNotes);
- return root;
- }
-
- /** Unique identifier, required. */
- protected String id;
-
- /** Version, optional. */
- protected String version;
-
- /** Type, required. */
- protected String type;
-
- /** Status ID, required. */
- protected String statusID;
-
- /** Type of security to apply, optional. */
- protected String securityType;
-
- /** Parent profile ID, optional. */
- protected String parent;
-
- /** List of zero or more children profile IDs ({@link String}s). */
- protected List children;
-
- /** Registration authority, optional. */
- protected String regAuthority;
-
- /** Revision notes, zero or more {@link String}s. */
- protected List revisionNotes;
-
- /** Serial version unique ID. */
- static final long serialVersionUID = 6140264312462080058L;
-
- /**
- * Create a <profAttributes> document using the profiles DTD.
- *
- * @return A <profAttributs> document with the profiles DTD.
- */
- public static Document createProfAttributesDocument() {
- return Profile.createDocument("profAttributes");
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/ProfileElement.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/ProfileElement.java b/profile/src/main/java/org/apache/oodt/profile/ProfileElement.java
deleted file mode 100644
index d7fce0f..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/ProfileElement.java
+++ /dev/null
@@ -1,586 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile;
-
-import org.apache.jena.rdf.model.Model;
-import org.apache.jena.rdf.model.Resource;
-
-import java.io.Serializable;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.oodt.commons.util.Documentable;
-import org.apache.oodt.commons.util.XML;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * Profile element.
- *
- * Objects of this class are elements that describe the composition of a resource.
- *
- * @author Kelly
- */
-public abstract class ProfileElement implements Serializable, Cloneable, Comparable<Object>, Documentable {
- /**
- * Create a profile element from the given XML node.
- *
- * @param root The <profElement> node.
- * @param profile To what profile the element belongs.
- * @return A profile element.
- */
- public static ProfileElement createProfileElement(Element root, Profile profile, ObjectFactory factory) {
- String name = null;
- String id = null;
- String desc = null;
- String type = null;
- String unit = null;
- List<String> synonyms = new ArrayList<String>();
- boolean obligation = false;
- int maxOccurrence = 0;
- String comments = null;
- boolean ranged = false;
- NodeList children = root.getChildNodes();
- String min = "0.0", max = "0.0";
- boolean gotMin = false;
- boolean gotMax = false;
- List<String> values = new ArrayList<String>();
- for (int i = 0; i < children.getLength(); ++i) {
- Node node = children.item(i);
- if ("elemId".equals(node.getNodeName())) {
- id = XML.unwrappedText(node);
- } else if ("elemName".equals(node.getNodeName())) {
- name = XML.unwrappedText(node);
- } else if ("elemDesc".equals(node.getNodeName())) {
- desc = XML.unwrappedText(node);
- } else if ("elemType".equals(node.getNodeName())) {
- type = XML.unwrappedText(node);
- } else if ("elemUnit".equals(node.getNodeName())) {
- unit = XML.unwrappedText(node);
- } else if ("elemEnumFlag".equals(node.getNodeName())) {
- ranged = "F".equals(XML.unwrappedText(node));
- } else if ("elemSynonym".equals(node.getNodeName())) {
- synonyms.add(XML.unwrappedText(node));
- } else if ("elemObligation".equals(node.getNodeName())) {
- String value = XML.unwrappedText(node);
- obligation = "Required".equals(value) || "T".equals(value);
- } else if ("elemMaxOccurrence".equals(node.getNodeName())) {
- try {
- maxOccurrence = Integer.parseInt(XML.unwrappedText(node));
- } catch (NumberFormatException ignore) {
- }
- } else if ("elemComment".equals(node.getNodeName())) {
- comments = XML.unwrappedText(node);
- } else if ("elemValue".equals(node.getNodeName())) {
- values.add(text(node));
- } else if ("elemMinValue".equals(node.getNodeName())) {
- try {
- min = XML.unwrappedText(node);
- gotMin = true;
- } catch (NumberFormatException ignore) {
- }
- } else if ("elemMaxValue".equals(node.getNodeName())) {
- try {
- max = XML.unwrappedText(node);
- gotMax = true;
- } catch (NumberFormatException ignore) {
- }
- }
- }
- if (ranged) {
- if (gotMin && gotMax) {
- return factory.createRangedProfileElement(profile, name, id, desc, type, unit, synonyms, obligation,
- maxOccurrence, comments, min, max);
- }
- return factory.createUnspecifiedProfileElement(profile, name, id, desc, type, unit, synonyms, obligation,
- maxOccurrence, comments);
- } else {
- return factory.createEnumeratedProfileElement(profile, name, id, desc, type, unit, synonyms, obligation,
- maxOccurrence, comments, values);
- }
- }
-
- /**
- * Create blank profile attributes belonging to the given profile.
- */
- protected ProfileElement(Profile profile) {
- this.profile = profile;
- synonyms = new ArrayList<Object>();
- }
-
- /**
- * Create a profile element from constituent attributes.
- *
- * @param profile Profile to which this element belongs.
- * @param name Required name of the element.
- * @param id ID of the element.
- * @param desc Long description of the element.
- * @param type Data type of the element.
- * @param unit Units.
- * @param synonyms Collection of element IDs ({@link String}) that are synonyms for this element.
- * @param obligation True if this is a required element
- * @param maxOccurrence Maximum number of occurrences of this element.
- * @param comments Any comments about this element.
- */
- protected ProfileElement(Profile profile, String name, String id, String desc, String type, String unit, List<?> synonyms,
- boolean obligation, int maxOccurrence, String comments) {
- this.profile = profile;
- this.name = name;
- this.id = id;
- this.desc = desc;
- this.type = type;
- this.unit = unit;
- this.synonyms = synonyms;
- this.obligation = obligation;
- this.maxOccurrence = maxOccurrence;
- this.comments = comments;
- }
-
- public int hashCode() {
- return name.hashCode();
- }
-
- public boolean equals(Object rhs) {
- if (rhs == this) {
- return true;
- }
- if (rhs == null || !(rhs instanceof ProfileElement)) {
- return false;
- }
- ProfileElement obj = (ProfileElement) rhs;
- return profile.equals(obj.profile) && name.equals(obj.name);
- }
-
- public String toString() {
- return getClass().getName() + "[profile=" + profile.toString() + ",name=" + name + "]";
- }
-
- public Object clone() {
- Object obj = null;
- try {
- obj = super.clone();
- } catch (CloneNotSupportedException ignored) {}
- return obj;
- }
-
- public int compareTo(Object rhs) {
- ProfileElement obj = (ProfileElement) rhs;
- if (profile.compareTo(obj.profile) < 0) {
- return -1;
- }
- if (profile.compareTo(obj.profile) == 0) {
- return name.compareTo(obj.name);
- }
- return 1;
- }
-
- /**
- * Get the profile to whom I belong.
- *
- * @return The owning profile.
- */
- public Profile getProfile() {
- return profile;
- }
-
- /**
- * Get my name.
- *
- * @return My name.
- */
- public String getName() {
- return name;
- }
-
- /**
- * Get my element ID.
- *
- * @return My ID.
- */
- public String getID() {
- return id;
- }
-
- /**
- * Get my long description.
- *
- * @return My long description.
- */
- public String getDescription() {
- return desc;
- }
-
- /**
- * Get my type.
- *
- * @return My type.
- */
- public String getType() {
- return type;
- }
-
- /**
- * Get my unit.
- *
- * @return My unit.
- */
- public String getUnit() {
- return unit;
- }
-
- /**
- * Get my synonyms.
- *
- * @return A list of synonyms.
- */
- public List getSynonyms() {
- return synonyms;
- }
-
- /**
- * Am I obligatory?
- *
- * @return True if I am, false otherwise.
- */
- public boolean isObligatory() {
- return obligation;
- }
-
- /**
- * Get how many times I can occur.
- *
- * @return How many times I can occur.
- */
- public int getMaxOccurrence() {
- return maxOccurrence;
- }
-
- /**
- * Get any comments about me.
- *
- * @return Any comments.
- */
- public String getComments() {
- return comments;
- }
-
- /**
- * Set the profile to whom I belong.
- *
- * @param profile The owning profile.
- */
- public void setProfile(Profile profile) {
- this.profile = profile;
- }
-
- /**
- * Set my name.
- *
- * @param name My name.
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * Set my element ID.
- *
- * @param id My ID.
- */
- public void setID(String id) {
- this.id = id;
- }
-
- /**
- * Set my long description.
- *
- * @param desc My long description.
- */
- public void setDescription(String desc) {
- this.desc = desc;
- }
-
- /**
- * Set my type.
- *
- * @param type My type.
- */
- public void setType(String type) {
- this.type = type;
- }
-
- /**
- * Set my unit.
- *
- * @param unit My unit.
- */
- public void setUnit(String unit) {
- this.unit = unit;
- }
-
- /**
- * Set whether I'm obligatory.
- *
- * @param obligatory True if I am, false otherwise.
- */
- public void setObligation(boolean obligatory) {
- this.obligation = obligatory;
- }
-
- /**
- * Set how many times I can occur.
- *
- * @param occurrence How many times I can occur.
- */
- public void setMaxOccurrence(int occurrence) {
- this.maxOccurrence = occurrence;
- }
-
- /**
- * Set any comments about me.
- *
- * @param comments Any comments.
- */
- public void setComments(String comments) {
- this.comments = comments;
- }
-
- /**
- * Get my minimum value.
- *
- * @return My minimum value.
- */
- public abstract String getMinValue();
-
- /**
- * Get my maximum value.
- *
- * @return My maximum value.
- */
- public abstract String getMaxValue();
-
- /**
- * Get legal values.
- *
- * @return List of legal values (as {@link String}s).
- */
- public abstract List getValues();
-
- /**
- * Serialize this element as an XML node.
- *
- * @param doc The document that will own this node.
- * @return The XML element <resAttributes> representing these attributes.
- * @throws DOMException If an error occurs creating the XML nodes.
- */
- public Node toXML(Document doc) throws DOMException {
- return toXML(doc, /*withValues*/true);
- }
-
- /**
- * Serialize this element as an XML node without any values.
- *
- * @param doc The document that will own this node.
- * @return The XML element <resAttributes> representing these attributes.
- * @throws DOMException If an error occurs creating the XML nodes.
- */
- public Node toXMLWithoutValues(Document doc) throws DOMException {
- return toXML(doc, /*withValues*/false);
- }
-
- /**
- * Serialize this element.
- *
- * @param doc The document that will own this node.
- * @param withValues If true, serialize the values as well.
- * @return The XML element <profElement> representing this element.
- * @throws DOMException If an error occurs creating the XML nodes.
- */
- private Node toXML(Document doc, boolean withValues) throws DOMException {
- Element profElement = doc.createElement("profElement");
- XML.addNonNull(profElement, "elemId", id);
- XML.addNonNull(profElement, "elemName", name);
- XML.addNonNull(profElement, "elemDesc", desc);
- XML.addNonNull(profElement, "elemType", type);
- XML.addNonNull(profElement, "elemUnit", unit);
- XML.add(profElement, "elemEnumFlag", isEnumerated()? "T" : "F");
- if (withValues) {
- addValues(profElement);
- }
- XML.add(profElement, "elemSynonym", synonyms);
- if (isObligatory()) {
- XML.add(profElement, "elemObligation", "Required");
- }
- if (getMaxOccurrence() >= 0) {
- XML.add(profElement, "elemMaxOccurrence", String.valueOf(getMaxOccurrence()));
- }
- XML.add(profElement, "elemComment", comments);
- return profElement;
- }
-
- /**
- * Tell if this element is of the enumerated kind.
- *
- * @return a <code>boolean</code> value.
- */
- protected abstract boolean isEnumerated();
-
- /**
- * Add the values of this element to the given node.
- *
- * @param node The node to add to.
- * @throws DOMException If an error occurs creating the XML nodes.
- */
- protected abstract void addValues(Node node) throws DOMException;
-
- /**
- * Add this element to an RDF model including this element's profile.
- *
- * @param model The model to which we're being added.
- * @param resource The profile as an RDF resource description.
- * @param profAttr The profile's attributes.
- */
- void addToModel(Model model, Resource resource, ProfileAttributes profAttr) {
- URI profileURI = profile.getURI();
- URI myURI = URI.create(profileURI.toString() + "#" + name);
-
- Resource element = model.createResource(myURI.toString());
- Utility.addProperty(model, resource, Utility.edmElement, element, profAttr, myURI);
-
- String obStr = obligation? "Required" : "Optional";
- String occurStr = String.valueOf(maxOccurrence);
-
- Utility.addProperty(model, element, Utility.edmElemID, id, profAttr, myURI);
- Utility.addProperty(model, element, Utility.edmDescription, desc, profAttr, myURI);
- Utility.addProperty(model, element, Utility.edmElemType, type, profAttr, myURI);
- Utility.addProperty(model, element, Utility.edmUnit, unit, profAttr, myURI);
- Utility.addProperty(model, element, Utility.edmSynonym, synonyms, profAttr, myURI);
- Utility.addProperty(model, element, Utility.edmObligation, obStr, profAttr, myURI);
- Utility.addProperty(model, element, Utility.edmMaxOccurrence, occurStr, profAttr, myURI);
- Utility.addProperty(model, element, Utility.edmComment, comments, profAttr, myURI);
-
- addElementSpecificProperties(model, element, profAttr, myURI);
- }
-
- /**
- * Add the statements specific to this kind of profile element to an RDF model.
- *
- * @param model The model.
- * @param element This element, as an RDF resource.
- * @param profAttr The attributes of the element's profile.
- */
- protected abstract void addElementSpecificProperties(Model model, Resource element, ProfileAttributes profAttr, URI uri);
-
- /** My profile. */
- protected Profile profile;
-
- /** My required name. */
- protected String name;
-
- /** My optional id. */
- protected String id;
-
- /** My optional description. */
- protected String desc;
-
- /** My optional type. */
- protected String type;
-
- /** My optional unit. */
- protected String unit;
-
- /** My synonyms. */
- protected List<?> synonyms;
-
- /** My obligation. */
- protected boolean obligation;
-
- /** My maxOccurrence. */
- protected int maxOccurrence;
-
- /** My optional comments. */
- protected String comments;
-
- /**
- * Create a <profElement> document using the profiles DTD.
- *
- * @return A <profElement> document with the profiles DTD.
- */
- public static Document createProfElementDocument() {
- return Profile.createDocument("profElement");
- }
-
- /**
- * Given a set of profile elements, return a set of profiles that own those elements.
- *
- * @param elements Profile elements.
- * @return Profiles that own those elements.
- */
- public static Set<Profile> profiles(Set<?> elements) {
- Set<Profile> rc = new HashSet<Profile>();
- for (Object element1 : elements) {
- ProfileElement element = (ProfileElement) element1;
- rc.add(element.getProfile());
- }
- return rc;
- }
-
- /**
- * Given a set of profiles and of profile elements, return those elements that
- * are owned by any of the given profiles.
- *
- * @param profiles Profiles.
- * @param elements Profile elements.
- * @return Members of <var>elements</var> that are owned by members of <var>profiles</var>.
- */
- public static Set<ProfileElement> elements(Set<?> profiles, Set<?> elements) {
- Set<ProfileElement> rc = new HashSet<ProfileElement>();
- for (Object element1 : elements) {
- ProfileElement element = (ProfileElement) element1;
- if (profiles.contains(element.getProfile())) {
- rc.add(element);
- }
- }
- return rc;
- }
-
- static String text(Node node) {
- StringBuffer b = new StringBuffer();
- text0(b, node);
- return b.toString();
- }
-
- static void text0(StringBuffer b, Node node) {
- if (node.getNodeType() == Node.TEXT_NODE || node.getNodeType() == Node.CDATA_SECTION_NODE) {
- b.append(node.getNodeValue());
- return;
- }
- NodeList children = node.getChildNodes();
- for (int i = 0; i < children.getLength(); ++i) {
- text0(b, children.item(i));
- }
- }
-}
-
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/ProfileException.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/ProfileException.java b/profile/src/main/java/org/apache/oodt/profile/ProfileException.java
deleted file mode 100644
index 8124e6b..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/ProfileException.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile;
-
-/**
- * A profile-related exception.
- *
- * @author Kelly
- */
-public class ProfileException extends Exception {
- /**
- * Create a profile exception with no detail message.
- */
- public ProfileException() {}
-
- /**
- * Create a profile exception with the given detail message.
- */
- public ProfileException(String message) {
- super(message);
- }
-
- /**
- * Create a chained profile exception.
- *
- * @param cause Causing exception.
- */
- public ProfileException(Throwable cause) {
- super(cause);
- }
-
- /**
- * Creates a chained profile exception with detail message.
- *
- * @param msg Detail message.
- * @param cause Causing exception.
- */
- public ProfileException(String msg, Throwable cause) {
- super(msg, cause);
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/ProfileSAXException.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/ProfileSAXException.java b/profile/src/main/java/org/apache/oodt/profile/ProfileSAXException.java
deleted file mode 100644
index 62a40f6..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/ProfileSAXException.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile;
-
-import org.xml.sax.SAXException;
-
-/**
- * An XML-related SAX exception from a profile server.
- *
- * @author Kelly
- */
-public class ProfileSAXException extends ProfileException {
- /**
- * Create a profile SAX exception.
- *
- * @param cause The SAX exception that caused this profile exception.
- */
- public ProfileSAXException(SAXException cause) {
- super(cause);
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/ProfileSQLException.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/ProfileSQLException.java b/profile/src/main/java/org/apache/oodt/profile/ProfileSQLException.java
deleted file mode 100644
index 0ae7b95..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/ProfileSQLException.java
+++ /dev/null
@@ -1,34 +0,0 @@
-// 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.
-
-package org.apache.oodt.profile;
-
-import java.sql.SQLException;
-
-/**
- * A database-related SQL exception from a profile server.
- *
- * @author Kelly
- */
-public class ProfileSQLException extends ProfileException {
- /**
- * Create a profile SQL exception.
- *
- * @param cause The SQL exception that caused this profile exception.
- */
- public ProfileSQLException(SQLException cause) {
- super(cause);
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/RangedProfileElement.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/RangedProfileElement.java b/profile/src/main/java/org/apache/oodt/profile/RangedProfileElement.java
deleted file mode 100644
index 5c98743..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/RangedProfileElement.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile;
-
-import org.apache.jena.rdf.model.Model;
-import org.apache.jena.rdf.model.Resource;
-import org.apache.oodt.commons.util.XML;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Node;
-
-import java.net.URI;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * Ranged profile element.
- *
- * Objects of this class are elements of a profile that represent a range of values.
- *
- * @author Kelly
- */
-public class RangedProfileElement extends ProfileElement {
- /**
- * Create blank profile attributes belonging to the given profile.
- */
- public RangedProfileElement(Profile profile) {
- super(profile);
- min = "";
- max = "";
- }
-
- /**
- * Create a profile element from constituent attributes.
- *
- * @param profile Profile to which this element belongs.
- * @param name Required name of the element.
- * @param id ID of the element.
- * @param desc Long description of the element.
- * @param type Data type of the element.
- * @param unit Units.
- * @param synonyms Collection of element IDs ({@link String}) that are synonyms for this element.
- * @param obligation True if this is a required element
- * @param maxOccurrence Maximum number of occurrences of this element.
- * @param comment Any comments about this element.
- * @param min Minimum value.
- * @param max Maximum value.
- */
- public RangedProfileElement(Profile profile, String name, String id, String desc, String type, String unit, List synonyms,
- boolean obligation, int maxOccurrence, String comment, String min, String max) {
- super(profile, name, id, desc, type, unit, synonyms, obligation, maxOccurrence, comment);
- this.min = min;
- this.max = max;
- }
-
- protected boolean isEnumerated() {
- return false;
- }
-
- public void setMinValue(String min){
- this.min = min;
-
- }
-
- public void setMaxValue(String max){
- this.max = max;
-
- }
-
- protected void addValues(Node node) throws DOMException {
- XML.add(node, "elemMinValue", min);
- XML.add(node, "elemMaxValue", max);
- }
-
- public String getMinValue() {
- return String.valueOf(min);
- }
-
- public String getMaxValue() {
- return String.valueOf(max);
- }
-
- public List getValues() {
- return Collections.EMPTY_LIST;
- }
-
- protected void addElementSpecificProperties(Model model, Resource element, ProfileAttributes profAttr, URI uri) {
- Utility.addProperty(model, element, Utility.edmMinValue, min, profAttr, uri);
- Utility.addProperty(model, element, Utility.edmMaxValue, max, profAttr, uri);
- }
-
- /** Minimum value. */
- protected String min;
-
- /** Maximum value. */
- protected String max;
-
- /** Serial version unique ID. */
- static final long serialVersionUID = -5697102597443089753L;
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/ResourceAttributes.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/ResourceAttributes.java b/profile/src/main/java/org/apache/oodt/profile/ResourceAttributes.java
deleted file mode 100644
index d0b1e55..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/ResourceAttributes.java
+++ /dev/null
@@ -1,602 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile;
-
-import org.apache.jena.rdf.model.Model;
-import org.apache.jena.rdf.model.Resource;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.oodt.commons.util.Documentable;
-import org.apache.oodt.commons.util.XML;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-import java.net.URI;
-
-/**
- * Resource attribuets.
- *
- * Objects of this class are resource attributes of profiles.
- *
- * @author Kelly
- */
-public class ResourceAttributes implements Serializable, Cloneable, Comparable<Object>, Documentable {
- /**
- * Create blank profile attributes.
- */
- public ResourceAttributes() {
- this(/*profile*/null);
- }
-
- /**
- * Create blank profile attributes belonging to a certain profile.
- *
- * @param profile Owning profile.
- */
- public ResourceAttributes(Profile profile) {
- this.profile = profile;
- identifier = "UNKNOWN";
-
- // Other attributes are optional according to prof.dtd.
- initializeLists();
- }
-
- /**
- * Create resource attributes from an XML document.
- *
- * @param profile Owning profile.
- * @param root The <resAttributes> element.
- */
- public ResourceAttributes(Profile profile, Node root) {
- this.profile = profile;
- initializeLists();
- NodeList children = root.getChildNodes();
- for (int i = 0; i < children.getLength(); ++i) {
- Node node = children.item(i);
- if ("Identifier".equals(node.getNodeName())) {
- identifier = XML.unwrappedText(node);
- } else if ("Title".equals(node.getNodeName())) {
- title = XML.unwrappedText(node);
- } else if ("Format".equals(node.getNodeName())) {
- formats.add(XML.unwrappedText(node));
- } else if ("Description".equals(node.getNodeName())) {
- description = XML.unwrappedText(node);
- } else if ("Creator".equals(node.getNodeName())) {
- creators.add(XML.unwrappedText(node));
- } else if ("Subject".equals(node.getNodeName())) {
- subjects.add(XML.unwrappedText(node));
- } else if ("Publisher".equals(node.getNodeName())) {
- publishers.add(XML.unwrappedText(node));
- } else if ("Contributor".equals(node.getNodeName())) {
- contributors.add(XML.unwrappedText(node));
- } else if ("Date".equals(node.getNodeName())) {
- dates.add(XML.unwrappedText(node));
- } else if ("Type".equals(node.getNodeName())) {
- types.add(XML.unwrappedText(node));
- } else if ("Source".equals(node.getNodeName())) {
- sources.add(XML.unwrappedText(node));
- } else if ("Language".equals(node.getNodeName())) {
- languages.add(XML.unwrappedText(node));
- } else if ("Relation".equals(node.getNodeName())) {
- relations.add(XML.unwrappedText(node));
- } else if ("Coverage".equals(node.getNodeName())) {
- coverages.add(XML.unwrappedText(node));
- } else if ("Rights".equals(node.getNodeName())) {
- rights.add(XML.unwrappedText(node));
- } else if ("resContext".equals(node.getNodeName())) {
- contexts.add(XML.unwrappedText(node));
- } else if ("resAggregation".equals(node.getNodeName())) {
- aggregation = XML.unwrappedText(node);
- } else if ("resClass".equals(node.getNodeName())) {
- clazz = XML.unwrappedText(node);
- } else if ("resLocation".equals(node.getNodeName())) {
- locations.add(XML.unwrappedText(node));
- }
- }
- }
-
- /**
- * Create resource attributes from constituent attributes.
- *
- * According to the Dublin Core, these attributes may be multivalued, but we force
- * the identifier, title, and description to be singly values in the DTD, so it is
- * here, too. Unless otherwise specified, these are all collections of {@link
- * String}.
- *
- * @param profile Owning profile.
- * @param identifier The unique identifier.
- * @param title Title of the resource.
- * @param formats Format of the resource.
- * @param description Description of the resource.
- * @param creators Who/what created the resource.
- * @param subjects Subject matter covered by the resource.
- * @param publishers Who/what published the resrouce.
- * @param contributors Who/what contributed to the resource.
- * @param dates When the resource was created (collection of {@link java.util.Date}.
- * @param types Type of the resource.
- * @param sources Source of the resource.
- * @param languages Language in which the resource is written.
- * @param relations Relationships to the resource.
- * @param coverages Coverage of the resource.
- * @param rights Rights of the resource.
- * @param contexts Context of the resource.
- * @param aggregation Aggregation of the resource.
- * @param clazz Class of the resource.
- * @param locations Location of the resource.
- */
- public ResourceAttributes(Profile profile, String identifier, String title, List<String> formats, String description,
- List<String> creators, List<String> subjects, List<String> publishers, List<String> contributors, List<String> dates, List<String> types, List<String> sources,
- List<String> languages, List<String> relations, List<String> coverages, List<String> rights, List<String> contexts, String aggregation, String clazz,
- List<String> locations) {
- this.profile = profile;
- this.identifier = identifier;
- this.title = title;
- this.formats = formats;
- this.description = description;
- this.creators = creators;
- this.subjects = subjects;
- this.publishers = publishers;
- this.contributors = contributors;
- this.dates = dates;
- this.types = types;
- this.sources = sources;
- this.languages = languages;
- this.relations = relations;
- this.coverages = coverages;
- this.rights = rights;
- this.contexts = contexts;
- this.aggregation = aggregation;
- this.clazz = clazz;
- this.locations = locations;
- }
-
- public int hashCode() {
- return identifier.hashCode();
- }
-
- public boolean equals(Object rhs) {
- if (rhs == this) {
- return true;
- }
- if (rhs == null || !(rhs instanceof ResourceAttributes)) {
- return false;
- }
- return ((ResourceAttributes) rhs).identifier.equals(identifier);
- }
-
- public int compareTo(Object rhs) {
- ResourceAttributes obj = (ResourceAttributes) rhs;
- return identifier.compareTo(obj.identifier);
- }
-
- public String toString() {
- return getClass().getName() + "[identifer=" + identifier + "]";
- }
-
- public Object clone() {
- Object clone = null;
- try {
- clone = super.clone();
- } catch (CloneNotSupportedException ignored) {}
- return clone;
- }
-
- /**
- * Add resource attribute statements to the profile description in an RDF model.
- *
- * @param model Model to which the profile belongs.
- * @param resource Resource description of the profile.
- * @param profAttr Profile's attributes.
- */
- void addToModel(Model model, Resource resource, ProfileAttributes profAttr) {
- URI myURI = getURI();
-
- Utility.addProperty(model, resource, Utility.dcTitle, title, profAttr, myURI);
- Utility.addProperty(model, resource, Utility.dcFormat, formats, profAttr, myURI);
- Utility.addProperty(model, resource, Utility.dcDescription, description, profAttr, myURI);
- Utility.addProperty(model, resource, Utility.dcCreator, creators, profAttr, myURI);
- Utility.addProperty(model, resource, Utility.dcSubject, subjects, profAttr, myURI);
- Utility.addProperty(model, resource, Utility.dcPublisher, publishers, profAttr, myURI);
- Utility.addProperty(model, resource, Utility.dcContributor, contributors, profAttr, myURI);
- Utility.addProperty(model, resource, Utility.dcDate, dates, profAttr, myURI);
- Utility.addProperty(model, resource, Utility.dcType, types, profAttr, myURI);
- Utility.addProperty(model, resource, Utility.dcSource, sources, profAttr, myURI);
- Utility.addProperty(model, resource, Utility.dcLanguage, languages, profAttr, myURI);
- Utility.addProperty(model, resource, Utility.dcRelation, relations, profAttr, myURI);
- Utility.addProperty(model, resource, Utility.dcRights, rights, profAttr, myURI);
- Utility.addProperty(model, resource, Utility.edmContext, contexts, profAttr, myURI);
- Utility.addProperty(model, resource, Utility.edmAggregation, aggregation, profAttr, myURI);
- Utility.addProperty(model, resource, Utility.edmClass, clazz, profAttr, myURI);
- Utility.addProperty(model, resource, Utility.edmLocation, locations, profAttr, myURI);
- }
-
- public URI getURI() {
- String identification;
- if (identifier == null || identifier.length() == 0) {
- if (locations.isEmpty()) {
- identification = null;
- } else {
- identification = (String) locations.get(0);
- }
- } else {
- identification = identifier;
- }
-
- return identification == null? UNKNOWN_URI : URI.create(identification);
- }
-
- /**
- * Get the identifier.
- *
- * @return The identifier.
- */
- public String getIdentifier() {
- return identifier;
- }
-
- /**
- * Set the identifier.
- *
- * @param identifier The identifier.
- */
- public void setIdentifier(String identifier) {
- this.identifier = identifier;
- }
-
- /**
- * Get the title.
- *
- * @return The title.
- */
- public String getTitle() {
- return title;
- }
-
- /**
- * Set the title.
- *
- * @param title The title.
- */
- public void setTitle(String title) {
- this.title = title;
- }
-
-
- /**
- * Get the formats.
- *
- * @return The formats.
- */
- public List<String> getFormats() {
- return formats;
- }
-
- /**
- * Set the description.
- *
- * @param description The new description.
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * Get the description.
- *
- * @return The description.
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * Get the creators.
- *
- * @return The creators.
- */
- public List<String> getCreators() {
- return creators;
- }
-
- /**
- * Get the subjects.
- *
- * @return The subjects.
- */
- public List<String> getSubjects() {
- return subjects;
- }
-
- /**
- * Get the publishers.
- *
- * @return The publishers.
- */
- public List<String> getPublishers() {
- return publishers;
- }
-
- /**
- * Get the contributors.
- *
- * @return The contributors.
- */
- public List<String> getContributors() {
- return contributors;
- }
-
- /**
- * Get the dates.
- *
- * @return The dates.
- */
- public List<String> getDates() {
- return dates;
- }
-
- /**
- * Get the types.
- *
- * @return The types.
- */
- public List<String> getTypes() {
- return types;
- }
-
- /**
- * Get the sources.
- *
- * @return The sources.
- */
- public List<String> getSources() {
- return sources;
- }
-
- /**
- * Get the languages.
- *
- * @return The languages.
- */
- public List<String> getLanguages() {
- return languages;
- }
-
- /**
- * Get the relations.
- *
- * @return The relations.
- */
- public List<String> getRelations() {
- return relations;
- }
-
- /**
- * Get the coverages.
- *
- * @return The coverages.
- */
- public List<String> getCoverages() {
- return coverages;
- }
-
- /**
- * Get the rights.
- *
- * @return The rights.
- */
- public List<String> getRights() {
- return rights;
- }
-
- /**
- * Get the contexts.
- *
- * @return The contexts, a list of {@link String}s.
- */
- public List<String> getResContexts() {
- return contexts;
- }
-
-
- /**
- * Get the aggregation.
- *
- * @return The aggregation.
- */
- public String getResAggregation() {
- return aggregation;
- }
-
- /**
- * Set the aggregation.
- *
- * @param aggregation The aggregation.
- */
- public void setResAggregation(String aggregation) {
- this.aggregation = aggregation;
- }
-
- /**
- * Get the class.
- *
- * @return The class.
- */
- public String getResClass() {
- return clazz;
- }
-
- /**
- * Set the class.
- *
- * @param clazz The class.
- */
- public void setResClass(String clazz) {
- this.clazz = clazz;
- }
-
- /**
- * Get the locations.
- *
- * @return Locations, a list of {@link String}s.
- */
- public List<String> getResLocations() {
- return locations;
- }
-
-
- /**
- * Initialize all the various {@link java.util.List} fields.
- */
- protected void initializeLists() {
- formats = new ArrayList<String>();
- creators = new ArrayList<String>();
- subjects = new ArrayList<String>();
- publishers = new ArrayList<String>();
- contributors = new ArrayList<String>();
- dates = new ArrayList<String>();
- types = new ArrayList<String>();
- sources = new ArrayList<String>();
- languages = new ArrayList<String>();
- relations = new ArrayList<String>();
- coverages = new ArrayList<String>();
- rights = new ArrayList<String>();
- contexts = new ArrayList<String>();
- locations = new ArrayList<String>();
- }
-
- /** Profile I describe. */
- protected Profile profile;
-
- /** Identifer. */
- protected String identifier;
-
- /** Titles. */
- protected String title;
-
- /** Formats. */
- protected List<String> formats;
-
- /** Descriptions. */
- protected String description;
-
- /** Creators. */
- protected List<String> creators;
-
- /** Subjects. */
- protected List<String> subjects;
-
- /** Publishers. */
- protected List<String> publishers;
-
- /** Contributors. */
- protected List<String> contributors;
-
- /** Dates. */
- protected List<String> dates;
-
- /** Types. */
- protected List<String> types;
-
- /** Sources. */
- protected List<String> sources;
-
- /** Languages. */
- protected List<String> languages;
-
- /** Relations. */
- protected List<String> relations;
-
- /** Coverages. */
- protected List<String> coverages;
-
- /** Rights. */
- protected List<String> rights;
-
- /** Contexts, one or more list of {@link String}s. */
- protected List<String> contexts;
-
- /** Aggregation. */
- protected String aggregation;
-
- /** Clazz. */
- protected String clazz;
-
- /** Locations, zero or more {@link String}s. */
- protected List<String> locations;
-
- /**
- * Serialize this attributes as an XML node.
- *
- * @param doc The document that will own this node.
- * @return The XML element <resAttributes> representing these attributes.
- * @throws DOMException If an error occurs creating the XML nodes.
- */
- public Node toXML(Document doc) throws DOMException {
- Element root = doc.createElement("resAttributes");
- XML.add(root, "Identifier", identifier);
- XML.addNonNull(root, "Title", title);
- XML.add(root, "Format", formats);
- XML.addNonNull(root, "Description", description);
- XML.add(root, "Creator", creators);
- XML.add(root, "Subject", subjects);
- XML.add(root, "Publisher", publishers);
- XML.add(root, "Contributor", contributors);
- XML.add(root, "Date", dates);
- XML.add(root, "Type", types);
- XML.add(root, "Source", sources);
- XML.add(root, "Language", languages);
- XML.add(root, "Relation", relations);
- XML.add(root, "Coverage", coverages);
- XML.add(root, "Rights", rights);
- List<String> contexts = new ArrayList<String>(this.contexts);
- if (contexts.isEmpty()) {
- contexts.add("UNKNOWN");
- }
- XML.add(root, "resContext", contexts);
- XML.addNonNull(root, "resAggregation", aggregation);
- if(clazz==null) {
- clazz = "UNKNOWN";
- }
- XML.addNonNull(root, "resClass", clazz);
- XML.add(root, "resLocation", locations);
-
- return root;
- }
-
- /**
- * Create a <resAttributes> document using the profiles DTD.
- *
- * @return A <resAttributs> document with the profiles DTD.
- */
- public static Document createResAttributesDocument() {
- return Profile.createDocument("resAttributes");
- }
-
- /** URI of a profile whose URI is unknown. */
- private static final URI UNKNOWN_URI = URI.create("urn:eda:profile:UNKNOWN");
-
- /** Serial version unique ID. */
- static final long serialVersionUID = -4251763559607642607L;
-}
[49/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/ModelGraph.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/ModelGraph.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/ModelGraph.java
deleted file mode 100644
index 3305763..0000000
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/ModelGraph.java
+++ /dev/null
@@ -1,307 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.workflow.gui.model;
-
-//OODT imports
-import org.apache.oodt.cas.metadata.Metadata;
-import org.apache.oodt.cas.workflow.gui.perspective.view.ViewState;
-import org.apache.oodt.cas.workflow.gui.util.GuiUtils;
-
-//JDK imports
-import java.util.List;
-import java.util.Stack;
-import java.util.Vector;
-
-/**
- *
- *
- * The graph to display per workflow in the Workflow Editor GUI.
- *
- * @author bfoster
- * @author mattmann
- *
- */
-public class ModelGraph {
-
- private ModelGraph parent;
- private ModelNode model;
- private ModelGraph preConditions;
- private Vector<ModelGraph> children;
- private ModelGraph postConditions;
- private boolean isPreCondition;
- private boolean isPostCondition;
-
- public ModelGraph(ModelNode model) {
- this.isPreCondition = isPostCondition = false;
- this.model = model;
- this.children = new Vector<ModelGraph>();
- if (this.model.isParentType()) {
- this.addChild(new ModelGraph(GuiUtils.createDummyNode()));
- }
- }
-
- public void setIsRef(boolean isRef) {
- Stack<ModelGraph> stack = new Stack<ModelGraph>();
- stack.add(this);
- while (!stack.empty()) {
- ModelGraph curGraph = stack.pop();
- curGraph.getModel().setIsRef(isRef);
- stack.addAll(curGraph.getChildren());
- if (curGraph.getPreConditions() != null) {
- stack.add(curGraph.getPreConditions());
- }
- if (curGraph.getPostConditions() != null) {
- stack.add(curGraph.getPostConditions());
- }
- }
- }
-
- public boolean isCondition() {
- return this.isPreCondition || this.isPostCondition;
- }
-
- public boolean isExcused() {
- return this.parent != null
- && this.parent.getModel().getExcusedSubProcessorIds()
- .contains(this.getModel().getModelId());
- }
-
- public String getId() {
- return model.getId();
- }
-
- public void setParent(ModelGraph parent) {
- if (this.parent != null) {
- if (this.isCondition() && !this.parent.isCondition()) {
- if (this.isPreCondition) {
- this.parent.preConditions = null;
- } else {
- this.parent.postConditions = null;
- }
- } else {
- this.parent.removeChild(this);
- }
- }
- this.parent = parent;
- if (!this.getModel().isRef() && parent != null && parent.getModel().isRef()) {
- this.getModel().setIsRef(true);
- }
- }
-
- public ModelGraph getParent() {
- return this.parent;
- }
-
- public ModelGraph getRootParent() {
- if (this.parent == null) {
- return this;
- } else {
- return this.parent.getRootParent();
- }
- }
-
- public List<ModelGraph> getPathFromRootParent() {
- Vector<ModelGraph> path = new Vector<ModelGraph>();
- ModelGraph curGraph = this;
- while (curGraph != null) {
- path.add(0, curGraph);
- curGraph = this.parent;
- }
- return path;
- }
-
- public void addChild(ModelGraph graph) {
- if (this.children.size() == 1
- && GuiUtils.isDummyNode(this.children.get(0).getModel())) {
- this.children.clear();
- }
- this.children.add(graph);
- graph.setParent(this);
- }
-
- public void removeChild(ModelGraph graph) {
- this.children.remove(graph);
- this.getModel().getExcusedSubProcessorIds()
- .remove(graph.getModel().getModelId());
- graph.parent = null;
- if (this.children.size() == 0) {
- this.addChild(new ModelGraph(GuiUtils.createDummyNode()));
- }
- }
-
- public List<ModelGraph> getChildren() {
- if (this.getModel().isParentType() && children.size() == 0) {
- this.addChild(new ModelGraph(GuiUtils.createDummyNode()));
- }
- return children;
- }
-
- public boolean hasChildren() {
- if (this.children.size() == 1
- && GuiUtils.isDummyNode(this.children.get(0).getModel())) {
- return false;
- } else {
- return this.children.size() > 0;
- }
- }
-
- public ModelNode getModel() {
- return model;
- }
-
- public void setModel(ModelNode model) {
- this.model = model;
- }
-
- public Metadata getInheritedStaticMetadata(ViewState state) {
- Metadata m = new Metadata();
- if (this.parent != null) {
- m.replaceMetadata(this.parent.getInheritedStaticMetadata(state));
- if (this.parent.getModel().getStaticMetadata() != null) {
- m.replaceMetadata(this.parent.getModel().getStaticMetadata());
- }
- if (this.parent.getModel().getExtendsConfig() != null) {
- for (String configGroup : this.parent.getModel().getExtendsConfig()) {
- m.replaceMetadata(state.getGlobalConfigGroups().get(configGroup)
- .getMetadata());
- }
- }
- }
- return m;
- }
-
- public ModelGraph getPreConditions() {
- return preConditions;
- }
-
- public void setPreConditions(ModelGraph preConditions) {
- if (this.preConditions != null) {
- this.preConditions.setParent(null);
- }
- Stack<ModelGraph> stack = new Stack<ModelGraph>();
- stack.add(preConditions);
- while (!stack.empty()) {
- ModelGraph graph = stack.pop();
- graph.isPreCondition = true;
- stack.addAll(graph.getChildren());
- }
- (this.preConditions = preConditions).setParent(this);
- }
-
- public ModelGraph getPostConditions() {
- return postConditions;
- }
-
- public void setPostConditions(ModelGraph postConditions) {
- if (this.postConditions != null) {
- this.postConditions.setParent(null);
- }
- Stack<ModelGraph> stack = new Stack<ModelGraph>();
- stack.add(postConditions);
- while (!stack.empty()) {
- ModelGraph graph = stack.pop();
- graph.isPostCondition = true;
- stack.addAll(graph.getChildren());
- }
- (this.postConditions = postConditions).setParent(this);
- }
-
- public ModelGraph recursiveFind(String id) {
- Stack<ModelGraph> stack = new Stack<ModelGraph>();
- stack.add(this);
- while (!stack.empty()) {
- ModelGraph curGraph = stack.pop();
- if (curGraph.getId().equals(id)) {
- return curGraph;
- }
- stack.addAll(curGraph.getChildren());
- if (curGraph.getPreConditions() != null) {
- stack.add(curGraph.getPreConditions());
- }
- if (curGraph.getPostConditions() != null) {
- stack.add(curGraph.getPostConditions());
- }
- }
- return null;
- }
-
- public ModelGraph recursiveFindByModelId(String modelId) {
- Stack<ModelGraph> stack = new Stack<ModelGraph>();
- stack.add(this);
- while (!stack.empty()) {
- ModelGraph curGraph = stack.pop();
- if (curGraph.getModel().getModelId().equals(modelId)) {
- return curGraph;
- }
- stack.addAll(curGraph.getChildren());
- if (curGraph.getPreConditions() != null) {
- stack.add(curGraph.getPreConditions());
- }
- if (curGraph.getPostConditions() != null) {
- stack.add(curGraph.getPostConditions());
- }
- }
- return null;
- }
-
- public List<ModelGraph> getLeafNodes() {
- Vector<ModelGraph> leafNodes = new Vector<ModelGraph>();
- Stack<ModelGraph> stack = new Stack<ModelGraph>();
- stack.add(this);
- while (!stack.empty()) {
- ModelGraph curGraph = stack.pop();
- if (curGraph.getChildren().size() == 0) {
- leafNodes.add(curGraph);
- } else {
- stack.addAll(curGraph.getChildren());
- }
- }
- return leafNodes;
- }
-
- public int hashCode() {
- return this.getId().hashCode();
- }
-
- public boolean equals(Object obj) {
- if (obj instanceof ModelGraph) {
- return this.getId().equals(((ModelGraph) obj).getId());
- } else {
- return false;
- }
- }
-
- public String toString() {
- return this.getModel().getModelId();
- }
-
- public ModelGraph clone() {
- ModelNode cloneNode = this.model.clone();
- ModelGraph clone = new ModelGraph(cloneNode);
- for (ModelGraph child : this.children) {
- clone.addChild(child.clone());
- }
- if (this.preConditions != null) {
- clone.setPreConditions(this.preConditions.clone());
- }
- if (this.postConditions != null) {
- clone.setPostConditions(this.postConditions.clone());
- }
- return clone;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/ModelNode.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/ModelNode.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/ModelNode.java
deleted file mode 100644
index 20a4562..0000000
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/ModelNode.java
+++ /dev/null
@@ -1,375 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.workflow.gui.model;
-
-//JDK imports
-import java.awt.Color;
-import java.io.File;
-import java.util.List;
-import java.util.UUID;
-import java.util.Vector;
-
-//OODT imports
-import org.apache.oodt.cas.metadata.Metadata;
-
-/**
- *
- *
- * Represents a node in the Workflow Model graph.
- *
- * @author bfoster
- * @author mattmann
- *
- */
-public class ModelNode {
-
- private String id;
- private String alias;
- private boolean isRef;
- private File file;
- private boolean textVisible;
- private boolean entryPoint;
- private List<String> configGroups;
- private String executionType;
- private String modelId;
- private String modelName;
- private String instanceClass;
- private List<String> excusedSubProcessorIds;
- private Metadata staticMetadata;
- private long timeout;
- private boolean optional;
-
- public ModelNode(File file) {
- super();
- this.file = file;
- this.id = UUID.randomUUID().toString();
- this.isRef = false;
- this.executionType = "task";
- this.textVisible = true;
- this.entryPoint = false;
- this.configGroups = new Vector<String>();
- this.modelId = null;
- this.modelName = null;
- this.instanceClass = null;
- this.excusedSubProcessorIds = new Vector<String>();
- this.staticMetadata = new Metadata();
- this.timeout = -1;
- this.optional = false;
- }
-
- public ModelNode(File file, String modelId) {
- this(file);
- this.setModelId(modelId);
- this.setModelName(modelId);
- }
-
- public ModelNode(File file, String modelId, boolean isRef) {
- this(file, modelId);
- this.isRef = isRef;
- }
-
- public String getId() {
- return this.id;
- }
-
- public void setAlias(String alias) {
- this.alias = alias;
- }
-
- public String getAlias() {
- return alias;
- }
-
- public void setIsRef(boolean isRef) {
- this.isRef = isRef;
- }
-
- public boolean isRef() {
- return this.isRef;
- }
-
- public File getFile() {
- return this.file;
- }
-
- public void setExtendsConfig(List<String> configGroups) {
- this.configGroups.clear();
- this.configGroups.addAll(configGroups);
- }
-
- public List<String> getExtendsConfig() {
- return this.configGroups;
- }
-
- public void setTextVisible(boolean textVisible) {
- this.textVisible = textVisible;
- }
-
- public void setEntryPoint(boolean entryPoint) {
- this.entryPoint = entryPoint;
- }
-
- public boolean isEntryPoint() {
- return this.entryPoint;
- }
-
- public boolean isParentType() {
- return !(this.getExecutionType().equals("task") || this.getExecutionType()
- .equals("condition"));
- }
-
- public Color getColor() {
- if (this.isParentType()) {
- if (this.getExecutionType().equals("sequential")) {
- return new Color(100, 149, 237);
- } else if (this.getExecutionType().equals("parallel")) {
- return new Color(143, 188, 143);
- } else {
- return Color.darkGray;
- }
- } else {
- if (this.getExecutionType().equals("task")) {
- return Color.orange;
- } else {
- return Color.cyan;
- }
- }
- }
-
- public Color getGradientColor() {
- if (this.isParentType()) {
- if (this.getExecutionType().equals("sequential")) {
- return new Color(200, 200, 200);
- } else if (this.getExecutionType().equals("parallel")) {
- return new Color(200, 200, 200);
- } else {
- return Color.white;
- }
- } else {
- return Color.darkGray;
- }
- }
-
- public String getModelId() {
- return modelId;
- }
-
- public String getModelName() {
- if (modelName == null) {
- return modelId;
- } else {
- return modelName;
- }
- }
-
- public String getExecutionType() {
- return executionType;
- }
-
- public String getInstanceClass() {
- return instanceClass;
- }
-
- public List<String> getExcusedSubProcessorIds() {
- if (this.excusedSubProcessorIds == null) {
- this.excusedSubProcessorIds = new Vector<String>();
- }
- return this.excusedSubProcessorIds;
- }
-
- public Metadata getStaticMetadata() {
- return staticMetadata != null ? this.staticMetadata
- : (this.staticMetadata = new Metadata());
- }
-
- public int hashCode() {
- return this.getId().hashCode();
- }
-
- public boolean equals(Object obj) {
- if (obj instanceof ModelNode) {
- return this.getId().equals(((ModelNode) obj).getId());
- } else {
- return false;
- }
- }
-
- public String toString() {
- if (this.textVisible) {
- if (this.isParentType()) {
- return this.getModelName() + " : " + this.getExecutionType();
- } else {
- return this.getModelName();
- }
- } else {
- return null;
- }
- }
-
- public ModelNode clone() {
- ModelNode clone = new ModelNode(this.file);
- clone.id = this.id;
- if (this.excusedSubProcessorIds != null) {
- clone.excusedSubProcessorIds = new Vector<String>(
- this.excusedSubProcessorIds);
- }
- clone.executionType = this.executionType;
- clone.instanceClass = this.instanceClass;
- clone.modelId = this.modelId;
- clone.modelName = this.modelName;
- clone.staticMetadata = null;
- clone.textVisible = this.textVisible;
- if (this.staticMetadata != null) {
- clone.staticMetadata = new Metadata(this.staticMetadata);
- }
- return clone;
- }
-
- /**
- * @param modelId
- * the modelId to set
- */
- public void setModelId(String modelId) {
- this.modelId = modelId;
- }
-
- /**
- * @param modelName
- * the modelName to set
- */
- public void setModelName(String modelName) {
- this.modelName = modelName;
- }
-
- /**
- * @param instanceClass
- * the instanceClass to set
- */
- public void setInstanceClass(String instanceClass) {
- this.instanceClass = instanceClass;
- }
-
- /**
- * @param excusedSubProcessorIds
- * the excusedSubProcessorIds to set
- */
- public void setExcusedSubProcessorIds(List<String> excusedSubProcessorIds) {
- this.excusedSubProcessorIds = excusedSubProcessorIds;
- }
-
-
-
- /**
- * @return the configGroups
- */
- public List<String> getConfigGroups() {
- return configGroups;
- }
-
-
-
- /**
- * @param configGroups the configGroups to set
- */
- public void setConfigGroups(List<String> configGroups) {
- this.configGroups = configGroups;
- }
-
-
-
- /**
- * @return the textVisible
- */
- public boolean isTextVisible() {
- return textVisible;
- }
-
-
-
- /**
- * @param id the id to set
- */
- public void setId(String id) {
- this.id = id;
- }
-
-
-
- /**
- * @param isRef the isRef to set
- */
- public void setRef(boolean isRef) {
- this.isRef = isRef;
- }
-
-
-
- /**
- * @param file the file to set
- */
- public void setFile(File file) {
- this.file = file;
- }
-
-
-
- /**
- * @param executionType the executionType to set
- */
- public void setExecutionType(String executionType) {
- this.executionType = executionType;
- }
-
-
-
- /**
- * @param staticMetadata the staticMetadata to set
- */
- public void setStaticMetadata(Metadata staticMetadata) {
- this.staticMetadata = staticMetadata;
- }
-
- /**
- * @return the timeout
- */
- public long getTimeout() {
- return timeout;
- }
-
- /**
- * @param timeout the timeout to set
- */
- public void setTimeout(long timeout) {
- this.timeout = timeout;
- }
-
- /**
- * @return the optional
- */
- public boolean isOptional() {
- return optional;
- }
-
- /**
- * @param optional the optional to set
- */
- public void setOptional(boolean optional) {
- this.optional = optional;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/repo/XmlWorkflowModelRepository.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/repo/XmlWorkflowModelRepository.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/repo/XmlWorkflowModelRepository.java
deleted file mode 100644
index 70d54aa..0000000
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/repo/XmlWorkflowModelRepository.java
+++ /dev/null
@@ -1,614 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.workflow.gui.model.repo;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang.StringUtils;
-import org.apache.oodt.cas.metadata.Metadata;
-import org.apache.oodt.cas.workflow.gui.model.ModelGraph;
-import org.apache.oodt.cas.workflow.gui.model.ModelNode;
-import org.apache.oodt.cas.workflow.gui.util.exceptions.WorkflowException;
-import org.apache.oodt.commons.xml.XMLUtils;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.SAXException;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-import java.util.Vector;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.xpath.XPath;
-import javax.xml.xpath.XPathConstants;
-import javax.xml.xpath.XPathExpression;
-import javax.xml.xpath.XPathExpressionException;
-import javax.xml.xpath.XPathFactory;
-
-/**
- *
- * Model Repository which stores models in xml files
- *
- * @author bfoster
- * @author mattmann
- *
- */
-public class XmlWorkflowModelRepository {
-
- private File workspace;
- private List<File> files;
- private Set<ModelGraph> graphs;
- private Map<String, ConfigGroup> globalConfigGroups;
- private static final Logger LOG = Logger
- .getLogger(XmlWorkflowModelRepository.class.getName());
-
- public XmlWorkflowModelRepository(File workspace) {
- this.files = new Vector<File>();
- if(workspace!=null) {
- for (File file : (this.workspace = workspace).listFiles()) {
- if (!file.isDirectory()) {
- this.files.add(file);
- }
- }
- }
- }
-
- public void loadGraphs(Set<String> supportedProcessorIds)
- throws XPathExpressionException, WorkflowException, IOException, SAXException, ParserConfigurationException {
- this.graphs = new HashSet<ModelGraph>();
- ConcurrentHashMap<String, ConfigGroup> globalConfGroups = new ConcurrentHashMap<String, ConfigGroup>();
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- factory.setNamespaceAware(true);
- DocumentBuilder parser = factory.newDocumentBuilder();
- List<FileBasedElement> rootElements = new Vector<FileBasedElement>();
- for (File file : files) {
- System.out.println("Loading: " + file);
- rootElements.add(new FileBasedElement(file, parser.parse(file)
- .getDocumentElement()));
- }
- for (FileBasedElement root : rootElements) {
- loadConfiguration(rootElements, root, null, globalConfGroups);
- NodeList rootChildren = root.getElement().getChildNodes();
- for (int i = 0; i < rootChildren.getLength(); i++) {
- if (rootChildren.item(i).getNodeType() == Node.ELEMENT_NODE
- && !rootChildren.item(i).getNodeName().equals("configuration")
- && !rootChildren.item(i).getNodeName().equals("event")) {
- System.out.println("node name: ["
- + rootChildren.item(i).getNodeName() + "]");
- ModelGraph graph = this.loadGraph(rootElements, new FileBasedElement(
- root.getFile(), (Element) rootChildren.item(i)), new Metadata(),
- globalConfGroups, supportedProcessorIds);
- this.graphs.add(graph);
- }
- }
- }
- ensureUniqueIds(graphs);
- this.globalConfigGroups = globalConfGroups;
- System.out.println(this.globalConfigGroups.keySet());
- }
-
- public Set<ModelGraph> getGraphs() {
- return this.graphs;
- }
-
- public Map<String, ConfigGroup> getGlobalConfigGroups() {
- return this.globalConfigGroups;
- }
-
- public void setGlobalConfigGroups(Map<String, ConfigGroup> globalConfigGroups) {
- this.globalConfigGroups = new ConcurrentHashMap<String, ConfigGroup>(
- globalConfigGroups);
- }
-
- public List<File> getFiles() {
- return this.files;
- }
-
- public void save() throws IOException, ParserConfigurationException {
- this.backupCurrentFiles();
- this.saveGraphs();
- }
-
- private void backupCurrentFiles() throws IOException {
- File backupDir = new File(this.workspace, ".backup");
- for (File file : this.files) {
- FileUtils.copyFile(file, new File(backupDir, file.getName()));
- file.delete();
- }
- this.files.clear();
- }
-
- private void saveGraphs() throws
- ParserConfigurationException {
- Map<File, Document> documents = new ConcurrentHashMap<File, Document>();
- for (ModelGraph graph : this.graphs) {
- Document document = documents.get(graph.getModel().getFile());
- if (document == null) {
- document = createDocument();
- document.appendChild(document.createElement("workflows"));
- documents.put(graph.getModel().getFile(), document);
- }
- saveGraph(graph, document.getDocumentElement(), document);
- }
- saveGlobalConfigGroups(documents);
- writeOutDocuments(documents);
- this.files = new ArrayList<File>(documents.keySet());
- }
-
- private void writeOutDocuments(Map<File, Document> documents) {
- for (Map.Entry<File, Document> file : documents.entrySet()) {
- XMLUtils.writeXmlFile(documents.get(file.getKey()), file.getKey().getAbsolutePath());
- }
- }
-
- private void saveGlobalConfigGroups(Map<File, Document> documents)
- throws ParserConfigurationException {
- File globalConfigGroupsFile = new File(workspace,
- "shared-configuration.xml");
- Document document = documents.get(globalConfigGroupsFile);
- if (document == null) {
- document = createDocument();
- document.appendChild(document.createElement("workflows"));
- documents.put(globalConfigGroupsFile, document);
- }
- for (Map.Entry<String, ConfigGroup> configName : this.globalConfigGroups.entrySet()) {
- ConfigGroup globalConfig = configName.getValue();
- Element configElem = document.createElement("configuration");
- document.getDocumentElement().appendChild(configElem);
- configElem.setAttribute("name", globalConfig.getName());
- if (!globalConfig.getExtends().isEmpty()) {
- configElem.setAttribute("extends",
- StringUtils.join(globalConfig.getExtends(), ", "));
- }
-
- String[] properties = globalConfig.getMetadata().getAllKeys()
- .toArray(new String[globalConfig.getMetadata().getAllKeys().size()]);
- Arrays.sort(properties);
- for (String property : properties) {
- Element propElem = document.createElement("property");
- configElem.appendChild(propElem);
- propElem.setAttribute("name", property);
- propElem.setAttribute("value",
- globalConfig.getMetadata().getMetadata(property));
- }
- }
- }
-
- private void saveGraph(ModelGraph graph, Element parentElem, Document document) {
- ModelNode node = graph.getModel();
-
- Element workflowElem = document.createElement(node.getExecutionType());
- parentElem.appendChild(workflowElem);
-
- if (node.isRef()) {
- workflowElem.setAttribute("id-ref", node.getModelId());
- if (node.getAlias() != null) {
- workflowElem.setAttribute("alias", node.getAlias());
- }
- saveConfiguration(node, workflowElem, document);
- } else {
- workflowElem.setAttribute("id", node.getModelId());
- workflowElem.setAttribute("name", node.getModelName());
- if (node.getInstanceClass() != null) {
- workflowElem.setAttribute("class", node.getInstanceClass());
- }
-
- saveConfiguration(node, workflowElem, document);
-
- // handle preconditions
- if (graph.getPreConditions() != null) {
- Element preConditions = document.createElement("conditions");
- workflowElem.appendChild(preConditions);
- preConditions.setAttribute("type", "pre");
- preConditions.setAttribute("execution", graph.getPreConditions()
- .getModel().getExecutionType());
- preConditions.setAttribute("timeout", String.valueOf(graph.getModel().getTimeout()));
- preConditions.setAttribute("optional", String.valueOf(graph.getModel().isOptional()));
- for (ModelGraph preCondition : graph.getPreConditions().getChildren()) {
- saveGraph(preCondition, preConditions, document);
- }
- }
-
- // handle subprocessors
- for (ModelGraph subProcessor : graph.getChildren()) {
- saveGraph(subProcessor, workflowElem, document);
- }
-
- // handle postconditions
- if (graph.getPostConditions() != null) {
- Element postConditions = document.createElement("conditions");
- workflowElem.appendChild(postConditions);
- postConditions.setAttribute("type", "post");
- postConditions.setAttribute("execution", graph.getPostConditions()
- .getModel().getExecutionType());
- postConditions.setAttribute("timeout", String.valueOf(graph.getModel().getTimeout()));
- postConditions.setAttribute("optional", String.valueOf(graph.getModel().isOptional()));
- for (ModelGraph postCondition : graph.getPostConditions().getChildren()) {
- saveGraph(postCondition, postConditions, document);
- }
- }
- }
- if (!node.getExcusedSubProcessorIds().isEmpty()) {
- workflowElem.setAttribute("excused",
- StringUtils.join(node.getExcusedSubProcessorIds(), ","));
- }
- if (node.isEntryPoint()) {
- workflowElem.setAttribute("entryPoint", "true");
- }
- }
-
- private void saveConfiguration(ModelNode node, Element workflowElem,
- Document document) {
- if (!node.getStaticMetadata().getAllKeys().isEmpty()) {
- Element configElem = document.createElement("configuration");
- workflowElem.appendChild(configElem);
- if (!node.getExtendsConfig().isEmpty()) {
- configElem.setAttribute("extends",
- StringUtils.join(node.getExtendsConfig(), ", "));
- }
- String[] properties = node.getStaticMetadata().getAllKeys()
- .toArray(new String[node.getStaticMetadata().getAllKeys().size()]);
- Arrays.sort(properties);
- for (String property : properties) {
- Element propElem = document.createElement("property");
- configElem.appendChild(propElem);
- propElem.setAttribute("name", property);
- propElem.setAttribute("value",
- node.getStaticMetadata().getMetadata(property));
- }
- }
- }
-
- private Document createDocument() throws ParserConfigurationException {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- factory.setNamespaceAware(true);
- return factory.newDocumentBuilder().newDocument();
- }
-
- private void ensureUniqueIds(Set<ModelGraph> graphs) {
- for (ModelGraph graph : graphs) {
- HashSet<String> names = new HashSet<String>();
- Vector<ModelGraph> stack = new Vector<ModelGraph>();
- stack.add(graph);
- while (!stack.isEmpty()) {
- ModelGraph currentGraph = stack.remove(0);
- String currentId = currentGraph.getId();
- for (int i = 1; names.contains(currentId); i++) {
- currentId = currentGraph.getId() + "-" + i;
- }
- names.add(currentId);
- if (!currentId.equals(currentGraph.getId())) {
- currentGraph.getModel().setModelId(currentId);
- }
- stack.addAll(currentGraph.getChildren());
- }
- }
- }
-
- private ModelGraph loadGraph(List<FileBasedElement> rootElements,
- FileBasedElement workflowNode, Metadata staticMetadata,
- ConcurrentHashMap<String, ConfigGroup> globalConfGroups,
- Set<String> supportedProcessorIds) throws XPathExpressionException, WorkflowException {
-
- String modelIdRef = null;
- String modelId = null;
- String modelName = null;
- String alias = null;
- String executionType = null;
- List<String> excused = new Vector<String>();
- String clazz = null;
- long timeout = -1;
- boolean optional = false;
- boolean entryPoint = false;
-
- NamedNodeMap attributes = workflowNode.getElement().getAttributes();
- for (int i = 0; attributes != null && i < attributes.getLength(); i++) {
- Node node = workflowNode.getElement().getAttributes().item(i);
- if (node.getNodeName().equals("id")) {
- modelId = node.getNodeValue();
- } else if (node.getNodeName().equals("name")) {
- modelName = node.getNodeValue();
- } else if (node.getNodeName().equals("class")) {
- clazz = node.getNodeValue();
- } else if (node.getNodeName().equals("id-ref")) {
- modelIdRef = node.getNodeValue();
- } else if (node.getNodeName().equals("excused")) {
- excused.addAll(Arrays.asList(node.getNodeValue().split(",")));
- } else if (node.getNodeName().equals("entryPoint")) {
- entryPoint = Boolean.parseBoolean(node.getNodeValue());
- } else if (node.getNodeName().equals("alias")) {
- alias = node.getNodeValue();
- } else if (node.getNodeName().equals("execution")) {
- executionType = node.getNodeValue();
- } else if (node.getNodeName().equals("timeout")) {
- timeout = node.getNodeValue() != null
- && !node.getNodeValue().equals("") ? Long.valueOf(node
- .getNodeValue()) : -1;
- }
- else if(node.getNodeName().equals("optional")){
- optional = Boolean.valueOf(node.getNodeValue());
- }
- else if (node.getNodeName().startsWith("p:")) {
- staticMetadata.replaceMetadata(node.getNodeName().substring(2),
- node.getNodeValue());
- }
- }
-
- if (modelId == null && modelIdRef == null) {
- modelId = UUID.randomUUID().toString();
- }
-
- ModelGraph graph = null;
- if (modelId != null) {
-
- if (workflowNode.getElement().getNodeName().equals("workflow")
- || workflowNode.getElement().getNodeName().equals("conditions")
- || workflowNode.getElement().getNodeName().equals("tasks")) {
- if (executionType == null) {
- LOG.log(Level.WARNING, "workflow model '"
- + workflowNode.getElement().getNodeName()
- + "' missing execution type: assuming sequential");
- executionType = "sequential";
- }
- } else {
- executionType = workflowNode.getElement().getNodeName();
- }
-
- if (!supportedProcessorIds.contains(executionType)) {
- LOG.log(Level.WARNING, "Unsupported execution type id '"
- + executionType + "'");
- }
-
- ModelNode modelNode = new ModelNode(workflowNode.getFile());
- modelNode.setModelId(modelId);
- modelNode.setModelName(modelName);
- modelNode.setExecutionType(executionType);
- modelNode.setStaticMetadata(staticMetadata);
- modelNode.setExcusedSubProcessorIds(excused);
- modelNode.setInstanceClass(clazz);
- modelNode.setEntryPoint(entryPoint);
- modelNode.setTimeout(timeout);
- modelNode.setOptional(optional);
-
- loadConfiguration(rootElements, workflowNode, modelNode, globalConfGroups);
-
- graph = new ModelGraph(modelNode);
-
- boolean loadedPreConditions = false;
- NodeList children = workflowNode.getElement().getChildNodes();
- for (int i = 0; i < children.getLength(); i++) {
- Node curChild = children.item(i);
- if (curChild.getNodeType() == Node.ELEMENT_NODE) {
- if (curChild.getNodeName().equals("conditions")) {
- boolean isPreCondition = !loadedPreConditions;
- String type = ((Element) curChild).getAttribute("type");
- if (type.length() > 0) {
- isPreCondition = type.toLowerCase().equals("pre");
- }
- if (isPreCondition) {
- graph.setPreConditions(this.loadGraph(rootElements,
- new FileBasedElement(workflowNode.getFile(),
- (Element) curChild), new Metadata(staticMetadata),
- globalConfGroups, supportedProcessorIds));
- } else {
- graph.setPostConditions(this.loadGraph(rootElements,
- new FileBasedElement(workflowNode.getFile(),
- (Element) curChild), new Metadata(staticMetadata),
- globalConfGroups, supportedProcessorIds));
- }
- loadedPreConditions = true;
- } else if (!curChild.getNodeName().equals("configuration")
- && !curChild.getNodeName().equals("requiredMetFields")) {
- graph.addChild(this.loadGraph(rootElements, new FileBasedElement(
- workflowNode.getFile(), (Element) curChild), new Metadata(
- staticMetadata), globalConfGroups, supportedProcessorIds));
-
- }
- }
- }
-
- } else if (modelIdRef != null) {
- graph = this.findGraph(rootElements, modelIdRef, new Metadata(
- staticMetadata), globalConfGroups, supportedProcessorIds);
- if (graph == null) {
- throw new WorkflowException("Workflow '" + modelIdRef
- + "' has not been defined in this context");
- }
- graph.setIsRef(true);
- graph.getModel().setStaticMetadata(new Metadata());
- loadConfiguration(rootElements, workflowNode, graph.getModel(),
- globalConfGroups);
- graph.getModel().setAlias(alias);
- }
-
- if (entryPoint && graph.getParent() != null) {
- this.graphs.add(graph);
- }
-
- return graph;
- }
-
- protected ModelGraph findGraph(List<FileBasedElement> rootElements,
- String modelIdRef, Metadata staticMetadata,
- ConcurrentHashMap<String, ConfigGroup> globalConfGroups,
- Set<String> supportedProcessorIds) throws XPathExpressionException, WorkflowException {
- XPath xpath = XPathFactory.newInstance().newXPath();
- XPathExpression expr = xpath.compile("//*[@id = '" + modelIdRef + "']");
- for (FileBasedElement rootElement : rootElements) {
- Node node = (Node) expr.evaluate(rootElement.getElement(),
- XPathConstants.NODE);
- if (node != null) {
- return this.loadGraph(rootElements,
- new FileBasedElement(rootElement.getFile(), (Element) node),
- staticMetadata, globalConfGroups, supportedProcessorIds);
- }
- }
- return null;
- }
-
- private void loadConfiguration(List<FileBasedElement> rootElements,
- FileBasedElement workflowNode, ModelNode modelNode,
- ConcurrentHashMap<String, ConfigGroup> globalConfGroups) {
- NodeList children = workflowNode.getElement().getChildNodes();
- for (int i = 0; i < children.getLength(); i++) {
- Node curChild = children.item(i);
- if (curChild.getNodeName().equals("configuration")) {
- Metadata curMetadata = new Metadata();
- if (modelNode != null
- && !((Element) curChild).getAttribute("extends").equals("")) {
- modelNode.setExtendsConfig(Arrays.asList(((Element) curChild)
- .getAttribute("extends").split(",")));
- }
- curMetadata.replaceMetadata(this.loadConfiguration(rootElements,
- curChild, globalConfGroups));
- if (!((Element) curChild).getAttribute("name").equals("")) {
- ConfigGroup configGroup = new ConfigGroup(
- ((Element) curChild).getAttribute("name"), curMetadata);
- if (modelNode != null) {
- List<String> extendsConfig = new Vector<String>(
- modelNode.getExtendsConfig());
- configGroup.addAllExtends(extendsConfig);
- extendsConfig.add(configGroup.getName());
- modelNode.setExtendsConfig(extendsConfig);
- }
- globalConfGroups.put(((Element) curChild).getAttribute("name"),
- configGroup);
- } else if (modelNode != null) {
- modelNode.setStaticMetadata(curMetadata);
- }
- }
- }
- }
-
- private Metadata loadConfiguration(List<FileBasedElement> rootElements,
- Node configNode, ConcurrentHashMap<String, ConfigGroup> globalConfGroups) {
- Metadata curMetadata = new Metadata();
- NodeList curGrandChildren = configNode.getChildNodes();
- for (int k = 0; k < curGrandChildren.getLength(); k++) {
- if (curGrandChildren.item(k).getNodeName().equals("property")) {
- Element property = (Element) curGrandChildren.item(k);
- String delim = property.getAttribute("delim");
- String envReplace = property.getAttribute("envReplace");
- String name = property.getAttribute("name");
- String value = property.getAttribute("value");
- if (Boolean.parseBoolean(envReplace)) {
- curMetadata.replaceMetadata(name + "/envReplace", "true");
- }
- List<String> values = new Vector<String>();
- if (delim.length() > 0) {
- values.addAll(Arrays.asList(value.split("\\" + delim)));
- } else {
- values.add(value);
- }
- curMetadata.replaceMetadata(name, values);
- }
- }
- return curMetadata;
- }
-
- private class FileBasedElement {
-
- private File file;
- private Element element;
-
- public FileBasedElement(File file, Element element) {
- this.file = file;
- this.element = element;
- }
-
- public File getFile() {
- return this.file;
- }
-
- public Element getElement() {
- return this.element;
- }
-
- }
-
- public class ConfigGroup {
-
- private String name;
- private Metadata metadata;
- private List<String> extendsConfig;
-
- public ConfigGroup(String name, Metadata metadata) {
- this.name = name;
- this.metadata = metadata;
- this.extendsConfig = new Vector<String>();
- }
-
- public String getName() {
- return this.name;
- }
-
- public Metadata getMetadata() {
- return this.metadata;
- }
-
- public void addExtends(String child) {
- this.extendsConfig.add(child);
- }
-
- public void addAllExtends(List<String> children) {
- this.extendsConfig.addAll(children);
- }
-
- public void removeExtends(String child) {
- this.extendsConfig.remove(child);
- }
-
- public List<String> getExtends() {
- return this.extendsConfig;
- }
-
- public int hashCode() {
- return this.name.hashCode();
- }
-
- public boolean equals(Object obj) {
- if (obj instanceof ConfigGroup) {
- ConfigGroup comp = (ConfigGroup) obj;
- return comp.name.equals(this.name);
- } else {
- return false;
- }
- }
-
- public String toString() {
- return this.name;
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/repo/XmlWorkflowModelRepositoryFactory.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/repo/XmlWorkflowModelRepositoryFactory.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/repo/XmlWorkflowModelRepositoryFactory.java
deleted file mode 100644
index 8cf683f..0000000
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/repo/XmlWorkflowModelRepositoryFactory.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.workflow.gui.model.repo;
-
-//JDK imports
-import java.io.File;
-
-/**
- *
- * Factory for creating xml model repositories
- *
- * @author bfoster
- * @author mattmann
- *
- */
-public class XmlWorkflowModelRepositoryFactory {
-
- private String workspace;
-
- public XmlWorkflowModelRepository createModelRepository() {
- if (workspace == null) {
- return null;
- }
- if (!new File(workspace).exists()) {
- new File(workspace).mkdirs();
- }
- return new XmlWorkflowModelRepository(new File(workspace));
- }
-
- public void setWorkspace(String workspace) {
- this.workspace = workspace;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/MultiStatePerspective.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/MultiStatePerspective.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/MultiStatePerspective.java
deleted file mode 100644
index bb2ca24..0000000
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/MultiStatePerspective.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.workflow.gui.perspective;
-
-//JDK imports
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.Vector;
-
-//OODT imports
-import org.apache.oodt.cas.workflow.gui.perspective.view.ViewState;
-import org.apache.oodt.cas.workflow.gui.perspective.view.View.Mode;
-
-/**
- *
- * A multi-state display perspective.
- *
- * @author bfoster
- * @author mattmann
- *
- */
-public abstract class MultiStatePerspective extends Perspective {
-
- private static final long serialVersionUID = -6410768713084872977L;
-
- private final Map<String, ViewState> states = new ConcurrentHashMap<String, ViewState>();
-
- private Mode mode;
-
- public MultiStatePerspective(String name) {
- super(name);
- this.mode = Mode.EDIT;
- }
-
- public void addState(ViewState state) {
- this.setState(state);
- }
-
- public void setState(ViewState state) {
- super.setState(state);
- state.setMode(this.mode);
- if (!this.states.containsKey(state.getId())) {
- this.states.put(state.getId(), state);
- this.handleAddState(state);
- }
- }
-
- public void removeState(ViewState state) {
- this.states.remove(state);
- this.handleRemoveState(state);
- super.setState(this.getActiveState());
- }
-
- public ViewState getState(String stateId) {
- return this.states.get(stateId);
- }
-
- public List<ViewState> getStates() {
- return new Vector<ViewState>(this.states.values());
- }
-
- public Set<String> getStateIds() {
- return this.states.keySet();
- }
-
- public void setMode(Mode mode) {
- this.mode = mode;
- for (ViewState state : states.values()) {
- state.setMode(mode);
- }
- this.refresh();
- }
-
- public void reset() {
- super.reset();
- this.mode = Mode.EDIT;
- states.clear();
- }
-
- public abstract void handleAddState(ViewState state);
-
- public abstract void handleRemoveState(ViewState state);
-
- public abstract ViewState getActiveState();
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/Perspective.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/Perspective.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/Perspective.java
deleted file mode 100644
index 0df667a..0000000
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/Perspective.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.workflow.gui.perspective;
-
-//JDK imports
-import javax.swing.JPanel;
-
-//OODT imports
-import org.apache.oodt.cas.workflow.gui.perspective.view.View;
-import org.apache.oodt.cas.workflow.gui.perspective.view.ViewListener;
-import org.apache.oodt.cas.workflow.gui.perspective.view.ViewState;
-import org.apache.oodt.cas.workflow.gui.perspective.view.View.Mode;
-
-/**
- *
- *
- * A view listener and jpanel for keeping the Workflow perspective in sync.
- *
- * @author bfoster
- * @author mattmann
- *
- */
-public abstract class Perspective extends JPanel implements ViewListener {
-
- private static final long serialVersionUID = -3343805159396435882L;
-
- private ViewState state;
- private String name;
-
- public Perspective(String name) {
- this.name = name;
- }
-
- public String getName() {
- return this.name;
- }
-
- public ViewState getState() {
- return this.state;
- }
-
- public void setState(ViewState state) {
- this.state = state;
- }
-
- public void setMode(Mode mode) {
- this.state.setMode(mode);
- this.refresh();
- }
-
- public void save() {
- if (this.state != null) {
- this.state.save();
- }
- }
-
- public void undo() {
- if (this.state != null) {
- this.state.undo();
- this.refresh();
- }
- }
-
- public void reset() {
- this.state = null;
- }
-
- public abstract void refresh();
-
- public abstract View getActiveView();
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/build/BuildPerspective.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/build/BuildPerspective.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/build/BuildPerspective.java
deleted file mode 100644
index 67a6146..0000000
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/build/BuildPerspective.java
+++ /dev/null
@@ -1,436 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.workflow.gui.perspective.build;
-
-//JDK imports
-
-import org.apache.oodt.cas.workflow.gui.model.ModelGraph;
-import org.apache.oodt.cas.workflow.gui.perspective.MultiStatePerspective;
-import org.apache.oodt.cas.workflow.gui.perspective.view.MultiStateView;
-import org.apache.oodt.cas.workflow.gui.perspective.view.View;
-import org.apache.oodt.cas.workflow.gui.perspective.view.ViewChange;
-import org.apache.oodt.cas.workflow.gui.perspective.view.ViewListener;
-import org.apache.oodt.cas.workflow.gui.perspective.view.ViewState;
-import org.apache.oodt.cas.workflow.gui.perspective.view.impl.DefaultPropView;
-import org.apache.oodt.cas.workflow.gui.perspective.view.impl.DefaultTreeView;
-import org.apache.oodt.cas.workflow.gui.perspective.view.impl.GlobalConfigView;
-import org.apache.oodt.cas.workflow.gui.perspective.view.impl.GraphView;
-import org.apache.oodt.cas.workflow.gui.perspective.view.impl.TreeProjectView;
-import org.apache.oodt.cas.workflow.gui.util.GuiUtils;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.util.Collections;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.swing.JMenuItem;
-import javax.swing.JPanel;
-import javax.swing.JPopupMenu;
-import javax.swing.JSplitPane;
-import javax.swing.JTabbedPane;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
-
-//OODT imports
-
-/**
- *
- * The default build perspective.
- *
- * @author bfoster
- * @author mattmann
- *
- */
-public class BuildPerspective extends MultiStatePerspective {
-
- private static final long serialVersionUID = 3387632819576057527L;
-
- private View projectView;
- private View globalConfigView;
- private Class<? extends View> projectViewClass;
- private Class<? extends View> mainViewClass;
- private Class<? extends View> treeViewClass;
- private Class<? extends View> propViewClass;
- private Class<? extends View> globalViewClass;
-
- private ConcurrentHashMap<ViewState, BuildPanel> stateViews;
- private ViewState activeState;
-
- public static final int MAIN_VIEW = 1;
- private static Logger LOG = Logger.getLogger(BuildPerspective.class.getName());
- private static final int WIDTH = 1000;
- private static final int HEIGHT = 700;
-
- private JSplitPane projectSplitPane;
-
- private boolean findSelectedInTab = false;
-
- public BuildPerspective() {
- this(TreeProjectView.class, GraphView.class, DefaultTreeView.class,
- DefaultPropView.class, GlobalConfigView.class);
- }
-
- public BuildPerspective(Class<? extends View> projectViewClass,
- Class<? extends View> mainViewClass, Class<? extends View> treeViewClass,
- Class<? extends View> propViewClass, Class<? extends View> globalViewClass) {
- super("Build");
- this.projectViewClass = projectViewClass;
- this.mainViewClass = mainViewClass;
- this.treeViewClass = treeViewClass;
- this.propViewClass = propViewClass;
- this.globalViewClass = globalViewClass;
- this.stateViews = new ConcurrentHashMap<ViewState, BuildPanel>();
- this.projectView = this.createProjectView();
- this.projectView.setPreferredSize(new Dimension(WIDTH / 10, HEIGHT / 2));
- this.globalConfigView = this.createGlobalConfigView();
- this.globalConfigView
- .setPreferredSize(new Dimension(WIDTH / 10, HEIGHT / 2));
- }
-
- public void reset() {
- super.reset();
- this.activeState = null;
- this.stateViews.clear();
- this.projectView = this.createProjectView();
- this.globalConfigView = this.createGlobalConfigView();
- }
-
- public void stateChangeNotify(ViewChange<?> change) {
- if (change instanceof ViewChange.NEW_ACTIVE_STATE) {
- this.activeState = ((ViewChange.NEW_ACTIVE_STATE) change).getObject();
- this.refresh();
- } else if (change instanceof ViewChange.REFRESH_VIEW) {
- this.refresh();
- } else if (change instanceof ViewChange.STATE_NAME_CHANGE) {
- this.refresh();
- } else if (change instanceof ViewChange.VIEW_MODEL) {
- String modelId = ((ViewChange.VIEW_MODEL) change).getObject();
- for (ViewState state : this.stateViews.keySet()) {
- for (ModelGraph graph : state.getGraphs()) {
- ModelGraph found = graph.recursiveFindByModelId(modelId);
- if (found != null && !found.getModel().isRef()) {
- this.activeState = state;
- this.activeState.setSelected(found);
- break;
- }
- }
- }
- this.findSelectedInTab = true;
- this.refresh();
- this.findSelectedInTab = false;
- }
- }
-
- @Override
- public ViewState getActiveState() {
- return this.activeState;
- }
-
- public View getActiveView() {
- if (this.getActiveState() != null) {
- return this.stateViews.get(this.getActiveState()).getActiveView();
- } else {
- return null;
- }
- }
-
- @Override
- public void handleAddState(final ViewState state) {
- this.activeState = state;
- BuildPanel buildPanel = new BuildPanel(state);
- this.stateViews.put(state, buildPanel);
- this.refresh();
- }
-
- @Override
- public void handleRemoveState(ViewState state) {
- this.stateViews.remove(state);
- if (this.stateViews.size() > 0) {
- this.activeState = this.stateViews.keySet().iterator().next();
- } else {
- this.activeState = null;
- }
- this.refresh();
- }
-
- @Override
- public void refresh() {
- this.save();
- this.removeAll();
- this.setLayout(new BorderLayout());
- JPanel panel;
- if (this.activeState != null) {
- BuildPanel buildPanel = this.stateViews.get(this.activeState);
- buildPanel.refresh();
- panel = buildPanel;
- } else {
- panel = new JPanel();
- }
-
- if (this.projectView instanceof MultiStateView) {
- ((MultiStateView) this.projectView).refreshView(this.activeState,
- this.getStates());
- } else {
- this.projectView.refreshView(this.activeState);
- }
-
- this.globalConfigView.refreshView(this.activeState);
-
- JPanel globalPanel = new JPanel();
- globalPanel.setLayout(new BorderLayout());
- globalPanel.add(this.projectView, BorderLayout.CENTER);
- globalPanel.add(this.globalConfigView, BorderLayout.SOUTH);
-
- int dividerLocation = -1;
- if (projectSplitPane != null) {
- dividerLocation = projectSplitPane.getDividerLocation();
- }
- projectSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, globalPanel,
- panel);
- if (dividerLocation != -1) {
- projectSplitPane.setDividerLocation(dividerLocation);
- }
- this.add(projectSplitPane, BorderLayout.CENTER);
-
- this.revalidate();
-
- }
-
- private View createMainView(String name) {
- try {
- return this.mainViewClass.getConstructor(String.class).newInstance(name);
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- return null;
- }
- }
-
- private View createTreeView() {
- try {
- return this.treeViewClass.getConstructor(String.class).newInstance(
- this.treeViewClass.getSimpleName());
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- return null;
- }
- }
-
- private View createGlobalConfigView() {
- try {
- return this.globalViewClass.getConstructor(String.class).newInstance(
- this.globalViewClass.getSimpleName());
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- return null;
- }
- }
-
- private View createProjectView() {
- try {
- View view = this.projectViewClass.getConstructor(String.class)
- .newInstance(this.projectViewClass.getSimpleName());
- view.registerListener(this);
- return view;
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- return null;
- }
- }
-
- private View createPropView() {
- try {
- return this.propViewClass.getConstructor(String.class).newInstance(
- this.propViewClass.getSimpleName());
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- return null;
- }
- }
-
- private class BuildPanel extends JPanel implements ViewListener {
-
- private static final long serialVersionUID = -6120047959962567963L;
-
- private JTabbedPane tabbedPane;
- private Map<View, ViewState> mainViews;
- private View propView;
- private View treeView;
-
- private View primaryMainView;
-
- private JPopupMenu closeTabPopup;
-
- private ViewState state;
-
- public BuildPanel(ViewState state) {
- this.state = state;
-
- mainViews = new ConcurrentHashMap<View, ViewState>();
-
- propView = createPropView();
- if (propView != null) {
- propView.registerListener(this);
- }
-
- treeView = createTreeView();
- if (treeView != null) {
- treeView.registerListener(this);
- }
-
- tabbedPane = new JTabbedPane();
-
- this.addMainView(createMainView(state.getFile().getName()), state);
-
- closeTabPopup = new JPopupMenu();
- JMenuItem closeItem = new JMenuItem("Close");
- closeItem.addActionListener(new ActionListener() {
-
- public void actionPerformed(ActionEvent e) {
- View mainView = (View) BuildPanel.this.tabbedPane
- .getSelectedComponent();
- BuildPanel.this.removeMainView(mainView);
- }
-
- });
- closeTabPopup.add(closeItem);
-
- this.tabbedPane.addMouseListener(new MouseListener() {
-
- public void mouseClicked(MouseEvent e) {
- if (e.getButton() == MouseEvent.BUTTON3
- && !BuildPanel.this.tabbedPane.getSelectedComponent().equals(
- BuildPanel.this.primaryMainView)) {
- closeTabPopup.show(BuildPanel.this.tabbedPane, e.getX(), e.getY());
- }
- }
-
- public void mouseEntered(MouseEvent e) {
- }
-
- public void mouseExited(MouseEvent e) {
- }
-
- public void mousePressed(MouseEvent e) {
- }
-
- public void mouseReleased(MouseEvent e) {
- }
-
- });
-
- this.tabbedPane.addChangeListener(new ChangeListener() {
-
- public void stateChanged(ChangeEvent e) {
- View activeView = (View) BuildPanel.this.tabbedPane
- .getSelectedComponent();
- activeView.notifyListeners();
- }
-
- });
-
- treeView.setPreferredSize(new Dimension(WIDTH / 10, HEIGHT / 2));
- propView.setPreferredSize(new Dimension(WIDTH / 10, HEIGHT / 2));
- JSplitPane treePropPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
- treeView, propView);
- treePropPane.setResizeWeight(.25);
- tabbedPane.setPreferredSize(new Dimension(WIDTH, HEIGHT));
- JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
- tabbedPane, treePropPane);
- mainSplitPane.setResizeWeight(.75);
- this.setLayout(new BorderLayout());
- this.add(mainSplitPane, BorderLayout.CENTER);
- }
-
- public void addMainView(View mainView, ViewState state) {
- if (this.mainViews.size() == 0) {
- this.primaryMainView = mainView;
- mainView.setPrimary(true);
- }
- this.mainViews.put(mainView, state);
- this.tabbedPane.addTab(mainView.getName(), mainView);
- this.tabbedPane.setSelectedComponent(mainView);
- mainView.registerListener(this);
- }
-
- public void removeMainView(View mainView) {
- if (!this.primaryMainView.equals(mainView)) {
- for (int i = 0; i < this.tabbedPane.getTabCount(); i++) {
- if (mainView.getName().equals(this.tabbedPane.getTitleAt(i))) {
- this.tabbedPane.removeTabAt(i);
- this.mainViews.remove(mainView);
- return;
- }
- }
- }
- }
-
- public View getActiveView() {
- return (View) this.tabbedPane.getSelectedComponent();
- }
-
- public void refresh() {
- if (this.getActiveView() != null) {
- ViewState viewState = null;
- if (this.state.getSelected() != null && findSelectedInTab) {
- TOP: for (Entry<View, ViewState> entry : this.mainViews.entrySet()) {
- for (ModelGraph graph : entry.getValue().getGraphs()) {
- ModelGraph found = graph.recursiveFindByModelId(this.state
- .getSelected().getModel().getModelId());
- if (found != null && !found.getModel().isRef()) {
- viewState = entry.getValue();
- viewState.setSelected(found);
- this.tabbedPane.setSelectedComponent(entry.getKey());
- break TOP;
- }
- }
- }
- } else {
- viewState = this.mainViews.get(this.getActiveView());
- }
- this.getActiveView().refreshView(viewState);
- this.propView.refreshView(viewState);
- this.treeView.refreshView(viewState);
- }
- this.revalidate();
- }
-
- public void stateChangeNotify(ViewChange<?> change) {
- if (change instanceof ViewChange.NEW_VIEW) {
- this.addMainView(
- createMainView(((ViewChange.NEW_VIEW) change).getObject()
- .getModel().getModelId()),
- new ViewState(this.state.getFile(), null, Collections
- .singletonList(GuiUtils.find(this.state.getGraphs(),
- ((ViewChange.NEW_VIEW) change).getObject().getModel()
- .getId())), this.state.getGlobalConfigGroups()));
- this.refresh();
- }
- BuildPerspective.this.stateChangeNotify(change);
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/MultiStateView.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/MultiStateView.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/MultiStateView.java
deleted file mode 100644
index ae34285..0000000
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/MultiStateView.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.workflow.gui.perspective.view;
-
-//JDK imports
-import java.util.List;
-
-/**
- *
- * A multi-state view.
- *
- * @author bfoster
- * @author mattmann
- *
- */
-public abstract class MultiStateView extends View {
-
- public MultiStateView(String name) {
- super(name);
- }
-
- private static final long serialVersionUID = -6968627851727698540L;
-
- public void refreshView(ViewState state) {
- throw new RuntimeException(
- "This is a mutli-state view -- call multi-state view refreshView method!");
- }
-
- public abstract void refreshView(ViewState activeState, List<ViewState> states);
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/View.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/View.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/View.java
deleted file mode 100644
index b8341e1..0000000
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/View.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.workflow.gui.perspective.view;
-
-//JDK imports
-import java.util.UUID;
-import java.util.Vector;
-import javax.swing.JPanel;
-
-/**
- *
- *
- * View abstract base class.
- *
- * @author bfoster
- * @author mattmann
- *
- */
-public abstract class View extends JPanel {
-
- private static final long serialVersionUID = -708692459667309413L;
-
- public enum Mode {
- DELETE, EDIT, MOVE, ZOOM_IN, ZOOM_OUT
- }
-
- private Vector<ViewListener> listeners;
- private String id;
- private boolean isPrimary;
-
- public static final String DISPLAY_GRAPH_IDS = "DisplayGraphIds";
-
- public View(String name) {
- super();
- this.id = UUID.randomUUID().toString();
- if (name != null) {
- this.setName(name);
- }
- this.listeners = new Vector<ViewListener>();
- }
-
- public void setPrimary(boolean isPrimary) {
- this.isPrimary = isPrimary;
- }
-
- public boolean isPrimary() {
- return this.isPrimary;
- }
-
- public String getId() {
- return this.id;
- }
-
- public void registerListener(ViewListener listener) {
- listeners.add(listener);
- }
-
- public void deregisterListener(ViewListener listener) {
- this.listeners.remove(listener);
- }
-
- public void notifyListeners(ViewChange<?> change) {
- for (ViewListener listener : listeners) {
- listener.stateChangeNotify(change);
- }
- }
-
- public void notifyListeners() {
- this.notifyListeners(new ViewChange.REFRESH_VIEW(this, this));
- }
-
- public int hashCode() {
- return this.id.hashCode();
- }
-
- public boolean equals(Object obj) {
- return obj instanceof View && ((View) obj).id.equals(this.id);
- }
-
- public abstract void refreshView(ViewState state);
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/ViewChange.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/ViewChange.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/ViewChange.java
deleted file mode 100644
index 5fd2a15..0000000
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/ViewChange.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.workflow.gui.perspective.view;
-
-//OODT imports
-import org.apache.oodt.cas.workflow.gui.model.ModelGraph;
-
-/**
- *
- * Represents a change in the Workflow GUI model view.
- *
- * @author bfoster
- * @author mattmann
- *
- */
-public abstract class ViewChange<T> {
-
- private T object;
- private View source;
-
- protected ViewChange(T object, View source) {
- this.object = object;
- this.source = source;
- }
-
- public T getObject() {
- return this.object;
- }
-
- public View getSource() {
- return this.source;
- }
-
- public static final class NEW_VIEW extends ViewChange<ModelGraph> {
- public NEW_VIEW(ModelGraph object, View source) {
- super(object, source);
- }
- }
-
- public static final class DELETE_VIEW extends ViewChange<View> {
- public DELETE_VIEW(View object, View source) {
- super(object, source);
- }
- }
-
- public static final class REFRESH_VIEW extends ViewChange<View> {
- public REFRESH_VIEW(View object, View source) {
- super(object, source);
- }
- }
-
- public static final class NEW_STATE extends ViewChange<ViewState> {
- public NEW_STATE(ViewState object, View source) {
- super(object, source);
- }
- }
-
- public static final class REMOVE_STATE extends ViewChange<ViewState> {
- public REMOVE_STATE(ViewState object, View source) {
- super(object, source);
- }
- }
-
- public static final class NEW_ACTIVE_STATE extends ViewChange<ViewState> {
- public NEW_ACTIVE_STATE(ViewState object, View source) {
- super(object, source);
- }
- }
-
- public static final class STATE_NAME_CHANGE extends ViewChange<ViewState> {
- public STATE_NAME_CHANGE(ViewState object, View source) {
- super(object, source);
- }
- }
-
- public static final class VIEW_MODEL extends ViewChange<String> {
- public VIEW_MODEL(String modelId, View source) {
- super(modelId, source);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/ViewListener.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/ViewListener.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/ViewListener.java
deleted file mode 100644
index 29f855a..0000000
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/ViewListener.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.workflow.gui.perspective.view;
-
-/**
- *
- * Interface for listening/notifying about Workflow View state changes.
- *
- * @author bfoster
- * @author mattmann
- *
- */
-public interface ViewListener {
-
- void stateChangeNotify(ViewChange<?> change);
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/ViewState.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/ViewState.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/ViewState.java
deleted file mode 100644
index 3ffc1fe..0000000
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/ViewState.java
+++ /dev/null
@@ -1,271 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.workflow.gui.perspective.view;
-
-//OODT imports
-import org.apache.oodt.cas.metadata.Metadata;
-import org.apache.oodt.cas.workflow.gui.model.ModelGraph;
-import org.apache.oodt.cas.workflow.gui.model.repo.XmlWorkflowModelRepository.ConfigGroup;
-import org.apache.oodt.cas.workflow.gui.perspective.view.View.Mode;
-import org.apache.oodt.cas.workflow.gui.util.GuiUtils;
-
-//JDK imports
-import java.io.File;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.Stack;
-import java.util.UUID;
-import java.util.Vector;
-
-/**
- *
- * The current state of a particular Workflow GUI editor view.
- *
- * @author bfoster
- * @author mattmann
- *
- */
-public class ViewState {
-
- private static final ConcurrentHashMap<String, Stack<ViewState>> undoHistory = new ConcurrentHashMap<String, Stack<ViewState>>();
-
- private ModelGraph selected;
- private List<ModelGraph> graphs;
- private String id;
- private String currentMetGroup;
- private Metadata properties;
- private Mode mode;
- private File file;
- private boolean change = false;
- private Map<String, ConfigGroup> globalConfigGroups;
-
- public ViewState(File file, ModelGraph selected, List<ModelGraph> graphs,
- Map<String, ConfigGroup> globalConfigGroups) {
- this.selected = selected;
- this.graphs = new Vector<ModelGraph>(graphs);
- this.id = UUID.randomUUID().toString();
- this.currentMetGroup = null;
- this.properties = new Metadata();
- this.mode = Mode.EDIT;
- this.file = file;
- this.globalConfigGroups = globalConfigGroups;
- }
-
- public Map<String, ConfigGroup> getGlobalConfigGroups() {
- return this.globalConfigGroups;
- }
-
- public void addGlobalConfigGroup(String groupName, ConfigGroup configGroup) {
- this.globalConfigGroups.put(groupName, configGroup);
- }
-
- public void removeGlobalConfigGroup(String groupName) {
- this.globalConfigGroups.remove(groupName);
- }
-
- public File getFile() {
- return this.file;
- }
-
- public String getId() {
- return this.id;
- }
-
- public boolean containsProperty(String key) {
- return this.properties.containsGroup(key);
- }
-
- public void setProperty(String key, String value) {
- Vector<String> values = new Vector<String>();
- values.add(value);
- this.setProperty(key, values);
- }
-
- public void setProperty(String key, List<String> values) {
- this.properties.replaceMetadata(key, values);
- this.change = true;
- }
-
- public String getFirstPropertyValue(String key) {
- List<String> values = this.getProperty(key);
- if (values == null || values.size() == 0) {
- return null;
- }
- return values.get(0);
- }
-
- public List<String> getProperty(String key) {
- return this.properties.getAllMetadata(key);
- }
-
- public void removeProperty(String key) {
- this.properties.removeMetadata(key);
- this.change = true;
- }
-
- public List<String> getKeysRecur(String subGroup) {
- Vector<String> keys = new Vector<String>();
- for (String key : this.properties.getAllKeys()) {
- if (key.contains(subGroup)) {
- keys.add(key);
- }
- }
- return keys;
- }
-
- public void setSelected(ModelGraph selected) {
- if (this.selected == null || selected == null
- || !this.selected.equals(selected)) {
- this.currentMetGroup = null;
- this.selected = selected;
- this.change = true;
- }
- }
-
- public ModelGraph getSelected() {
- if (this.mode.equals(Mode.EDIT)) {
- return this.selected;
- } else {
- return null;
- }
- }
-
- public Set<String> getGraphIds() {
- HashSet<String> graphIds = new HashSet<String>();
- for (ModelGraph graph : this.getGraphs()) {
- graphIds.add(graph.getModel().getModelId());
- }
- return graphIds;
- }
-
- public List<ModelGraph> getGraphs() {
- return this.graphs;
- }
-
- public void removeGraph(ModelGraph graph) {
- this.graphs.remove(graph);
- }
-
- public void addGraph(ModelGraph graph) {
- this.graphs.add(graph);
- }
-
- public void setMode(Mode mode) {
- this.mode = mode;
- this.change = true;
- }
-
- public Mode getMode() {
- return this.mode;
- }
-
- public void setCurrentMetGroup(String currentMetGroup) {
- this.currentMetGroup = currentMetGroup;
- this.change = true;
- }
-
- public String getCurrentMetGroup() {
- return this.currentMetGroup;
- }
-
- public boolean hasChanged() {
- return this.change;
- }
-
- public void save() {
- if (this.change) {
- Stack<ViewState> stack = undoHistory.get(this.id);
- if (stack == null) {
- stack = new Stack<ViewState>();
- }
- if (stack.size() >= 100) {
- stack.remove(stack.size() - 1);
- }
- stack.push(this.clone());
- undoHistory.put(this.id, stack);
- this.change = false;
- }
- }
-
- public void undo() {
- Stack<ViewState> stack = undoHistory.get(this.id);
- if (stack != null && !stack.empty()) {
- this.clone(stack.pop());
- System.out.println(this.getGraphIds());
- this.change = false;
- }
- }
-
- public void clone(ViewState state) {
- this.graphs = null;
- this.selected = null;
- if (state.graphs != null) {
- this.graphs = new Vector<ModelGraph>();
- for (ModelGraph graph : state.graphs) {
- this.graphs.add(graph.clone());
- }
- if (state.selected != null) {
- this.selected = GuiUtils.find(this.graphs, state.selected.getModel()
- .getModelId());
- }
- }
- this.properties = new Metadata(state.properties);
- this.id = state.id;
- this.currentMetGroup = state.currentMetGroup;
- this.mode = state.mode;
- }
-
- public ViewState clone() {
- List<ModelGraph> cloneGraphs = null;
- ModelGraph selected = null;
- if (this.graphs != null) {
- cloneGraphs = new Vector<ModelGraph>();
- for (ModelGraph graph : this.graphs) {
- cloneGraphs.add(graph.clone());
- }
- if (this.selected != null) {
- selected = GuiUtils.find(cloneGraphs, this.selected.getModel()
- .getModelId());
- }
- }
- ViewState clone = new ViewState(this.file, selected, cloneGraphs,
- this.globalConfigGroups);
- clone.id = this.id;
- clone.file = this.file;
- clone.currentMetGroup = this.currentMetGroup;
- clone.properties = new Metadata(this.properties);
- clone.mode = this.mode;
- return clone;
- }
-
- public int hashCode() {
- return this.id.hashCode();
- }
-
- public boolean equals(Object obj) {
- return obj instanceof ViewState && this.id.equals(((ViewState) obj).id);
- }
-
- public String toString() {
- return this.getId();
- }
-
-}
[37/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/scripts/login.php
----------------------------------------------------------------------
diff --git a/balance/modules/puny/scripts/login.php b/balance/modules/puny/scripts/login.php
deleted file mode 100644
index b638fe4..0000000
--- a/balance/modules/puny/scripts/login.php
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Include the main Puny class
-require_once(App::Get()->settings['puny_module_path'] . '/classes/Puny.class.php');
-
-// Get the configured editor username / password
-$punyUsername = App::Get()->settings['puny_editor_username'];
-$punyPassword = App::Get()->settings['puny_editor_password'];
-
-// Get the provided credentials from the POST request
-$username = $_POST['username'];
-$password = $_POST['password'];
-
-// Ensure that the editor credentials are properly configured in config.ini
-if ( !($punyUsername && $punyPassword) ) {
- $_SESSION['puny_error'] = "Unable to launch Puny because the Puny "
- . "admin credentials are not configured properly.";
- App::Get()->redirect(App::Get()->settings['puny_module_root'] . '/error');
-}
-
-// Test the provided values against the configured values
-if ( $username == $punyUsername && $password == $punyPassword ) {
- // Login success
- Puny::initializeEditorSession();
- App::get()->redirect(SITE_ROOT . '/');
-} else {
- // Login Failure...
- $_SESSION['puny_error'] = "Invalid editor credentials provided...";
- App::Get()->redirect(App::Get()->settings['puny_module_root'] . '/error');
-}
-
-exit();
-
-
-
-
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/scripts/logout.php
----------------------------------------------------------------------
diff --git a/balance/modules/puny/scripts/logout.php b/balance/modules/puny/scripts/logout.php
deleted file mode 100644
index b223fea..0000000
--- a/balance/modules/puny/scripts/logout.php
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Parse the Puny config file
-$module = App::Get()->loadModule();
-
-// Include the main Puny class
-require_once(App::Get()->settings['puny_module_path'] . '/classes/Puny.class.php');
-
-// Destroy the editor session
-Puny::destroyEditorSession();
-
-// Redirect home
-App::Get()->redirect(SITE_ROOT . '/');
-
-exit();
-
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/scripts/store.php
----------------------------------------------------------------------
diff --git a/balance/modules/puny/scripts/store.php b/balance/modules/puny/scripts/store.php
deleted file mode 100644
index 3d3665a..0000000
--- a/balance/modules/puny/scripts/store.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Parse the Puny config file
-$module = App::Get()->loadModule();
-
-// Include the main Puny class
-require_once(App::Get()->settings['puny_module_path'] . '/classes/Puny.class.php');
-
-// Get the resource id from the request parameters
-$resourceId = $_POST['resourceId'];
-$content = $_POST['content'];
-
-// Load the requested resource and update the content
-$resource = Puny::load($resourceId)->setContent($content);
-
-// Store the updated content as a new version
-Puny::store($resource);
-
-// we're done :)
-echo json_encode(array(
- "status" => "ok"
- , "resourceId" => $resourceId
- , "version" => $resource->getVersion()
- , "parsedContent" => $resource->parse()->getContent()));
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/static/css/defaults.css
----------------------------------------------------------------------
diff --git a/balance/modules/puny/static/css/defaults.css b/balance/modules/puny/static/css/defaults.css
deleted file mode 100644
index 41f89c0..0000000
--- a/balance/modules/puny/static/css/defaults.css
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-@CHARSET "UTF-8";
-
-/* Puny Module Default Style */
-
-[puny] blockquote {
- margin:20px 40px;
-}
-[puny] code {
- font-family: monospace;
-}
-[puny] em {
- font-style: italic;
-}
-[puny] ol {
- list-style: decimal;
-}
-[puny] ul {
- list-style: disc;
-}
-[puny] strong {
- font-weight: bold;
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/static/css/dialog.css
----------------------------------------------------------------------
diff --git a/balance/modules/puny/static/css/dialog.css b/balance/modules/puny/static/css/dialog.css
deleted file mode 100644
index da0b083..0000000
--- a/balance/modules/puny/static/css/dialog.css
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* @control dialog */
-
-#gollum-dialog-dialog {
- display: block;
- overflow: visible;
- position: absolute;
- left: 50%;
-}
-
-#gollum-dialog-dialog.active {
- display: block;
-}
-
-#gollum-dialog-dialog-inner {
- margin: 0 0 0 -225px;
- position: relative;
- width: 450px;
-
- border: 7px solid #999;
- border: 7px solid rgba(0, 0, 0, 0.3);
- border-radius: 5px;
- -moz-border-radius: 5px;
- -webkit-border-radius: 5px;
-}
-
-#gollum-dialog-dialog-bg {
- background-color: #fff;
- overflow: hidden;
- padding: 1em;
-
- background: -webkit-gradient(linear, left top, left bottom, from(#f7f7f7), to(#ffffff));
- background: -moz-linear-gradient(top, #f7f7f7, #ffffff);
-}
-
-#gollum-dialog-dialog-inner h4 {
- border-bottom: 1px solid #ddd;
- color: #000;
- font-size: 1.8em;
- line-height: normal;
- font-weight: bold;
- margin: 0 0 0.75em 0;
- padding: 0 0 0.3em 0;
-}
-
-#gollum-dialog-dialog-body {
- font-size: 1.2em;
- line-height: 1.6em;
-}
-
-#gollum-dialog-dialog-body fieldset {
- display: block;
- border: 0;
- margin: 0;
- overflow: hidden;
- padding: 0;
-}
-
-#gollum-dialog-dialog-body fieldset .field {
- margin: 0 0 1.5em 0;
- padding: 0;
-}
-
- #gollum-dialog-dialog-body fieldset .field label {
- color: #000;
- display: block;
- font-size: 1.2em;
- font-weight: bold;
- line-height: 1.6em;
- margin: 0;
- padding: 0;
- min-width: 80px;
- }
-
- #gollum-dialog-dialog-body fieldset .field input[type="text"] {
- border: 1px solid #ddd;
- display: block;
- font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
- font-size: 1.2em;
- line-height: 1.6em;
- margin: 0.3em 0 0 0;
- padding: 0.3em 0.5em;
- width: 96.5%;
- }
-
- #gollum-dialog-dialog-body fieldset .field input.code {
- font-family: 'Monaco', 'Courier New', Courier, monospace;
- }
-
-#gollum-dialog-dialog-body fieldset .field:last-child {
- margin: 0 0 1em 0;
-}
-
-#gollum-dialog-dialog-buttons {
- border-top: 1px solid #ddd;
- overflow: hidden;
- margin: 1.5em 0 0 0;
- padding: 1em 0 0 0;
-}
-
-#gollum-dialog-dialog a.minibutton {
- float: right;
- margin-right: 0.5em;
- width: auto;
-}
-
-#gollum-dialog-dialog a.minibutton,
-#gollum-dialog-dialog a.minibutton:visited {
- background-color: #f7f7f7;
- border: 1px solid #d4d4d4;
- color: #333;
- cursor: pointer;
- display: block;
- font-size: 1.2em;
- font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
- font-weight: bold;
- margin: 0 0 0 0.8em;
- padding: 0.4em 1em;
-
- text-shadow: 0 1px 0 #fff;
-
- filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#f4f4f4', endColorstr='#ececec');
- background: -webkit-gradient(linear, left top, left bottom, from(#f4f4f4), to(#ececec));
- background: -moz-linear-gradient(top, #f4f4f4, #ececec);
-
- border-radius: 3px;
- -moz-border-radius: 3px;
- -webkit-border-radius: 3px;
-}
-
-#gollum-dialog-dialog a.minibutton:hover {
- background: #3072b3;
- border-color: #518cc6 #518cc6 #2a65a0;
- color: #fff;
- text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
- text-decoration: none;
-
- filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#599bdc', endColorstr='#3072b3');
- background: -webkit-gradient(linear, left top, left bottom, from(#599bdc), to(#3072b3));
- background: -moz-linear-gradient(top, #599bdc, #3072b3);
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/static/css/editor.css
----------------------------------------------------------------------
diff --git a/balance/modules/puny/static/css/editor.css b/balance/modules/puny/static/css/editor.css
deleted file mode 100644
index e51303b..0000000
--- a/balance/modules/puny/static/css/editor.css
+++ /dev/null
@@ -1,567 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- editor.css
- Wiki editor formatting
-*/
-
-a {
- -moz-outline: none !important;
-}
-
-.jaws {
- /* JAWS should see it, but you can't */
- display: block;
- height: 1px;
- left: -5000px;
- overflow: hidden;
- position: absolute;
- top: -5000px;
- width: 1px;
-}
-
-#gollum-editor {
- border: 1px solid #e4e4e4;
- background: #f9f9f9;
- margin: 1em 0 5em;
- overflow: hidden;
- padding: 1em 1em 0.4em;
-
- border-radius: 1em;
- -moz-border-radius: 1em;
- -webkit-border-radius: 1em;
-}
-
-.ie #gollum-editor {
- padding-bottom: 1em;
-}
-
-#gollum-editor form fieldset {
- border: 0;
- margin: 0;
- padding: 0;
- width: 100%;
-}
-
-#gollum-editor .singleline {
- display: block;
- margin: 0 0 0.7em 0;
- overflow: hidden;
-}
-
-#gollum-editor .singleline input {
- background: #fff;
- border: 1px solid #ddd;
- color: #000;
- font-size: 1.3em;
- font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
- line-height: 1.8em;
- margin: 1em 0 0.4em;
- padding: 0.5em;
- width: 98%;
-}
-
-#gollum-editor .singleline input.ph {
- color: #999;
-}
-
-#gollum-editor-title-field input#gollum-editor-page-title {
- font-weight: bold;
- margin-top: 0;
-}
-
-#gollum-editor-title-field.active {
- border-bottom: 1px solid #ddd;
- display: block;
- margin: 0 0 0.3em 0;
- padding: 0 0 0.5em 0;
-}
-
-#gollum-editor-title-field input#gollum-editor-page-title.ph {
- color: #000;
-}
-
-/* @control editor-view-tab */
-#gollum-editor #gollum-editor-type-switcher {
- display: none;
-}
-
-/* @control function-bar */
-#gollum-editor #gollum-editor-function-bar {
- border-bottom: 1px solid #ddd;
- overflow: hidden;
- padding: 0;
-}
-
-
-#gollum-editor-title-field + #gollum-editor-function-bar {
- margin-top: 0.6em;
-}
-
-#gollum-editor #gollum-editor-function-bar #gollum-editor-function-buttons {
- /* display: none; */
-}
-
-#gollum-editor #gollum-editor-function-bar.active #gollum-editor-function-buttons {
- display: block;
- float: left;
- overflow: hidden;
- padding: 0 0 1.1em 0;
-}
-
-#gollum-editor #gollum-editor-function-bar a.function-button {
- background: #f7f7f7;
- border: 1px solid #ddd;
- color: #333;
- display: block;
- float: left;
- height: 25px;
- overflow: hidden;
- margin: 0.2em 0.5em 0 0;
- /* text-indent: -5000px; */
- text-shadow: 0 1px 0 #fff;
- width: 25px;
-
- border-radius: 0.3em;
- -moz-border-radius: 0.3em;
- -webkit-border-radius: 0.3em;
-
- filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#f4f4f4', endColorstr='#ececec');
- background: -webkit-gradient(linear, left top, left bottom, from(#f4f4f4), to(#ececec));
- background: -moz-linear-gradient(top, #f4f4f4, #ececec);
-}
-
-#gollum-editor #gollum-editor-function-bar a.function-button:hover {
- color: #fff;
- text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
- text-decoration: none;
-
- filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#599bdc', endColorstr='#3072b3');
- background: -webkit-gradient(linear, left top, left bottom, from(#599bdc), to(#3072b3));
- background: -moz-linear-gradient(top, #599bdc, #3072b3);
-}
-
-#gollum-editor #gollum-editor-function-bar a span {
- background-image: url(../img/icon-sprite.png);
- background-repeat: no-repeat;
- display: block;
- height: 25px;
- overflow: hidden;
- text-indent: -5000px;
- width: 25px;
-}
-
-a#function-bold span { background-position: 0 0; }
-a#function-italic span { background-position: -27px 0; }
-a#function-underline span { background-position: -54px 0; }
-a#function-code span { background-position: -82px 0; }
-a#function-ul span { background-position: -109px 0; }
-a#function-ol span { background-position: -136px 0; }
-a#function-blockquote span { background-position: -163px 0; }
-a#function-hr span { background-position: -190px 0; }
-a#function-h1 span { background-position: -217px 0; }
-a#function-h2 span { background-position: -244px 0; }
-a#function-h3 span { background-position: -271px 0; }
-a#function-link span { background-position: -298px 0; }
-a#function-image span { background-position: -324px 0; }
-a#function-help span { background-position: -405px 0; }
-
-a#function-bold:hover span { background-position: 0 -28px; }
-a#function-italic:hover span { background-position: -27px -28px; }
-a#function-underline:hover span { background-position: -54px -28px; }
-a#function-code:hover span { background-position: -82px -28px; }
-a#function-ul:hover span { background-position: -109px -28px; }
-a#function-ol:hover span { background-position: -136px -28px; }
-a#function-blockquote:hover span { background-position: -163px -28px; }
-a#function-hr:hover span { background-position: -190px -28px; }
-a#function-h1:hover span { background-position: -217px -28px; }
-a#function-h2:hover span { background-position: -244px -28px; }
-a#function-h3:hover span { background-position: -271px -28px; }
-a#function-link:hover span { background-position: -298px -28px; }
-a#function-image:hover span { background-position: -324px -28px; }
-a#function-help:hover span { background-position: -405px -28px; }
-
-
-#gollum-editor #gollum-editor-function-bar a.disabled {
- display: none;
-}
-
-#gollum-editor #gollum-editor-function-bar span.function-divider {
- display: block;
- float: left;
- width: 0.5em;
-}
-
-#gollum-editor #gollum-editor-function-bar #gollum-editor-format-selector {
- overflow: hidden;
- padding: 0 0 1.1em 0;
-}
-
-#gollum-editor #gollum-editor-function-bar
- #gollum-editor-format-selector select {
- background-color: #f9f9f9;
- border: 1px solid transparent;
-
- float: right;
- font-size: 1.1em;
- font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
- font-weight: bold;
- line-height: 1.6em;
- padding: 0.5em 0.7em;
- margin-bottom: 0;
-
-
- border-radius: 0.5em;
- -moz-border-radius: 0.5em;
- -webkit-border-radius: 0.5em;
- -moz-outline: none;
-}
-
-#gollum-editor #gollum-editor-function-bar
- #gollum-editor-format-selector select:hover {
- background-color: #fff;
- border: 1px solid #ddd;
- -moz-outline: none;
-}
-
-#gollum-editor #gollum-editor-function-bar
- #gollum-editor-format-selector label {
- color: #999;
- float: right;
- font-size: 1.1em;
- font-weight: bold;
- line-height: 1.6em;
- padding: 0.6em 0.5em 0 0;
-}
-
-#gollum-editor #gollum-editor-function-bar
- #gollum-editor-format-selector label:after {
- content: ':';
-}
-
-
-/* @section form-fields */
-
-body {
-font: 13px Helvetica,arial,freesans,clean,sans-serif;
-line-height: 1.4;
-color: #333;
-position: relative;
-padding: 0;
-width: 100%;
-z-index: 9;
-display: block;
-margin: 0 auto;
-}
-
-#gollum-editor textarea#gollum-editor-body {
- background: #fff;
- border: 1px solid #ddd;
- font-size: 1.3em;
- font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
- line-height: 1.8em;
- margin: 1em 0 0.4em;
- padding: 0.5em; /* I don't really like mixing pct & em here� */
- width: 100%;
- height: 20em;
-}
-
-#gollum-editor input.gollum-editor-input {
- background-color: #f7f7f7;
- border: 1px solid #d4d4d4;
- color: #333;
- cursor: pointer;
- display: block;
- float: left;
- font-size: 1.2em;
- font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
- font-weight: bold;
- height: 35px;
- margin: 0 5px;
- padding: 0.4em 1em;
-
- text-shadow: 0 1px 0 #fff;
-
- filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#f4f4f4', endColorstr='#ececec');
- background: -webkit-gradient(linear, left top, left bottom, from(#f4f4f4), to(#ececec));
- background: -moz-linear-gradient(top, #f4f4f4, #ececec);
-
- border-radius: 3px;
- -moz-border-radius: 3px;
- -webkit-border-radius: 3px;
-}
-
-.webkit #gollum-editor input#gollum-editor-submit {
- padding: 0.5em 1em 0.45em;
-}
-
-.ie #gollum-editor input#gollum-editor-submit {
- padding: 0.4em 1em 0.5em;
-}
-
-#gollum-editor input#gollum-editor-submit:hover {
- background: #3072b3;
- border-color: #518cc6 #518cc6 #2a65a0;
- color: #fff;
- text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
- text-decoration: none;
-
- filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#599bdc', endColorstr='#3072b3');
- background: -webkit-gradient(linear, left top, left bottom, from(#599bdc), to(#3072b3));
- background: -moz-linear-gradient(top, #599bdc, #3072b3);
-}
-
-#gollum-editor .collapsed,
-#gollum-editor .expanded {
- border-bottom: 1px solid #ddd;
- display: block;
- overflow: hidden;
- padding: 1em 0 0.5em;
-}
-
-#gollum-editor #gollum-editor-body + .collapsed,
-#gollum-editor #gollum-editor-body + .expanded {
- border-top: 1px solid #ddd;
- margin-top: 0.7em;
-}
-
-#gollum-editor .collapsed a.button,
-#gollum-editor .expanded a.button {
- background: #f7f7f7;
- border: 1px solid #ddd;
- color: #333;
- display: block;
- float: left;
- height: 25px;
- overflow: hidden;
- margin: 0.2em 0.5em 0.75em 0;
- text-shadow: 0 1px 0 #fff;
- width: 25px;
-
- border-radius: 0.3em;
- -moz-border-radius: 0.3em;
- -webkit-border-radius: 0.3em;
-
- filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#f4f4f4', endColorstr='#ececec');
- background: -webkit-gradient(linear, left top, left bottom, from(#f4f4f4), to(#ececec));
- background: -moz-linear-gradient(top, #f4f4f4, #ececec);
-}
-
-#gollum-editor .collapsed h4,
-#gollum-editor .expanded h4 {
- font-size: 1.6em;
- float: left;
- margin: 0;
- padding: 0.4em 0 0 0.3em;
- text-shadow: 0 -1px 0 #fff;
-}
-
-#gollum-editor .collapsed a.button:hover,
-#gollum-editor .expanded h4 a.button:hover {
- color: #fff;
- text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
- text-decoration: none;
-
- filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#599bdc', endColorstr='#3072b3');
- background: -webkit-gradient(linear, left top, left bottom, from(#599bdc), to(#3072b3));
- background: -moz-linear-gradient(top, #599bdc, #3072b3);
-}
-
-#gollum-editor .collapsed a span,
-#gollum-editor .expanded a span {
- background-image: url(../img/icon-sprite.png);
- background-position: -351px -1px;
- background-repeat: no-repeat;
- display: block;
- height: 25px;
- overflow: hidden;
- text-indent: -5000px;
- width: 25px;
-}
-
-#gollum-editor .collapsed a:hover span {
- background-position: -351px -28px;
-}
-
-#gollum-editor .expanded a span {
- background-position: -378px 0;
-}
-
-#gollum-editor .expanded a:hover span {
- background-position: -378px -28px;
-}
-
-#gollum-editor .collapsed textarea {
- display: none;
-}
-
-#gollum-editor .expanded textarea {
- background-color: #fff;
- border: 1px solid #ddd;
- clear: both;
- display: block;
- font-size: 1.3em;
- font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
- height: 7em;
- line-height: 1.8em;
- margin: 0.7em 0;
- padding: 0.5em;
- width: 98%;
-}
-
-/* @control minibutton */
-
-#gollum-editor a.minibutton,
-#gollum-editor a.minibutton:visited {
- background-color: #f7f7f7;
- border: 1px solid #d4d4d4;
- color: #333;
- cursor: pointer;
- display: block;
- font-size: 1.2em;
- font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
- font-weight: bold;
- line-height: 1.2em;
- margin: 0 0 0 0.8em;
- padding: 0.5em 1em;
-
- text-shadow: 0 1px 0 #fff;
-
- filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#f4f4f4', endColorstr='#ececec');
- background: -webkit-gradient(linear, left top, left bottom, from(#f4f4f4), to(#ececec));
- background: -moz-linear-gradient(top, #f4f4f4, #ececec);
-
- border-radius: 3px;
- -moz-border-radius: 3px;
- -webkit-border-radius: 3px;
-}
-
-#gollum-editor a.minibutton:hover {
- background: #3072b3;
- border-color: #518cc6 #518cc6 #2a65a0;
- color: #fff;
- text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
- text-decoration: none;
-
- filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#599bdc', endColorstr='#3072b3');
- background: -webkit-gradient(linear, left top, left bottom, from(#599bdc), to(#3072b3));
- background: -moz-linear-gradient(top, #599bdc, #3072b3);
-}
-
-
-#gollum-editor #gollum-editor-preview {
- float: left;
- font-weight: normal;
- padding: left;
-}
-
-
-/* @section help */
-#gollum-editor-help {
- margin: 0;
- overflow: hidden;
- padding: 0;
- border: 1px solid #ddd;
- border-width: 0 1px 1px 1px;
-}
-
- #gollum-editor-help-parent,
- #gollum-editor-help-list {
- display: block;
- float: left;
- height: 17em;
- list-style-type: none;
- overflow: auto;
- margin: 0;
- padding: 1em 0;
- width: 18%;
- }
-
- #gollum-editor-help-parent {
- border-right: 1px solid #eee;
- }
-
- #gollum-editor-help-list {
- background: #fafafa;
- border-right: 1px solid #eee;
- }
-
- #gollum-editor-help-parent li,
- #gollum-editor-help-list li {
- font-size: 1.2em;
- line-height: 1.6em;
- margin: 0;
- padding: 0;
- }
-
- #gollum-editor-help-parent li a,
- #gollum-editor-help-list li a {
- border: 1px solid transparent;
- border-width: 1px 0;
- display: block;
- font-weight: bold;
- height: 10%;
- width: auto;
- padding: 0.2em 1em;
- text-shadow: 0 -1px 0 #fff;
- }
-
- #gollum-editor-help-parent li a:hover,
- #gollum-editor-help-list li a:hover {
- background: #fff;
- border-color: #f0f0f0;
- text-decoration: none;
-
- box-shadow: none;
- }
-
- #gollum-editor-help-parent li a.selected,
- #gollum-editor-help-list li a.selected {
- border: 1px solid #eee;
- border-bottom-color: #e7e7e7;
- border-width: 1px 0;
- background: #fff;
- color: #000;
-
- box-shadow: 0 1px 2px #f0f0f0;
- }
-
- #gollum-editor-help-wrapper {
- background: #fff;
- overflow: auto;
- height: 17em;
- padding: 1em;
- }
-
- #gollum-editor-help-content {
- font-size: 1.2em;
- margin: 0 1em 0 0.5em;
- padding: 0;
- line-height: 1.8em;
- }
-
- #gollum-editor-help-content p {
- margin: 0 0 1em 0;
- padding: 0;
- }
-
-/* IE */
-.ie #gollum-editor .singleline input {
- padding-top: 0.25em;
- padding-bottom: 0.75em;
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/static/css/github.css
----------------------------------------------------------------------
diff --git a/balance/modules/puny/static/css/github.css b/balance/modules/puny/static/css/github.css
deleted file mode 100644
index 96d19c1..0000000
--- a/balance/modules/puny/static/css/github.css
+++ /dev/null
@@ -1,677 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#wiki-wrapper #template blockquote {
- margin: 1em 0;
- border-left: 4px solid #ddd;
- padding-left: .8em;
- color: #555;
-}
-
-/*
- gollum.css
- A basic stylesheet for Gollum
-*/
-
-/* @section core */
-body, html {
- font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
- font-size: 10px;
- margin: 0;
- padding: 0;
-}
-
-#wiki-wrapper {
- margin: 0 auto;
- overflow: visible;
- width: 90%;
-}
-
-a:link {
- color: #4183c4;
- text-decoration: none;
-}
-
-a:hover, a:visited {
- color: #4183c4;
- text-decoration: underline;
-}
-
-
-/* @section head */
-#head {
- margin: 4.5em 0 0.5em;
- padding: 0.5em 0;
- overflow: hidden;
-}
-
- #head h1 {
- /* display: none; */
- }
-
- #head ul.actions {
- float: right;
- }
-
-/* @section content */
-#wiki-content {
- height: 1%;
- overflow: visible;
-}
-
- #wiki-content .wrap {
- height: 1%;
- overflow: auto;
- }
-
- /* @section comments */
- #wiki-body #inline-comment {
- display: none; /* todo */
- }
-
- /* @section body */
- #wiki-body {
- display: block;
- float: left;
- margin-right: 3%;
- width: 100%;
- }
-
- .has-rightbar #wiki-body {
- width: 68%;
- }
-
- /* @section rightbar */
- #wiki-rightbar {
- background-color: #f7f7f7;
- border: 1px solid #ddd;
- font-size: 13px;
- float: right;
- padding: 7px;
- width: 25%;
-
- border-radius: 0.5em;
- -moz-border-radius: 0.5em;
- -webkit-border-radius: 0.5em;
- }
-
- #wiki-rightbar p {
- margin: 13px 0 0;
- }
-
- #wiki-rightbar > p:first-child {
- margin-top: 0;
- }
-
- #wiki-rightbar p.parent {
- border-bottom: 1px solid #bbb;
- font-weight: bold;
- margin: 0 0 0.5em 0;
- padding: 0 0 0.5em 0;
- text-shadow: 0 1px 0 #fff;
- }
-
- /* Back arrow */
- #wiki-rightbar p.parent:before {
- color: #666;
- content: "<-- ";
- }
-
- #wiki-rightbar h3 {
- font-size: 1.2em;
- color: #333;
- margin: 1.2em 0 0;
- padding: 0;
- text-shadow: 0 1px 0 #fff;
- }
-
- #wiki-rightbar ul {
- margin: 0.5em 0 1em;
- padding: 0;
- }
-
- #wiki-rightbar ul li {
- color: #bbb;
- margin: 0 0 0 1em;
- padding: 0;
- line-height: 1.75em;
- list-style-position: inside;
- list-style-type: round;
- }
-
- #wiki-rightbar #nav ul li a {
- font-weight: bold;
- text-shadow: 0 1px 0 #fff;
- }
-
- /* @section footer */
- #wiki-footer {
- clear: both;
- margin: 2em 0 5em;
- }
-
- .has-rightbar #wiki-footer {
- width: 70%;
- }
-
- #wiki-footer #footer-content {
- background-color: #f7f7f7;
- border: 1px solid #ddd;
- font-size: 1.2em;
- line-height: 1.5em;
- margin-top: 1.5em;
- padding: 1em;
-
- border-radius: 0.5em;
- -moz-border-radius: 0.5em;
- -webkit-border-radius: 0.5em;
- }
-
- #wiki-footer #footer-content h3 {
- font-size: 1.2em;
- color: #333;
- margin: 0;
- padding: 0 0 0.2em;
- text-shadow: 0 1px 0 #fff;
- }
-
- #wiki-footer #footer-content p {
- margin: 0.5em 0 0;
- padding: 0;
- }
-
- #wiki-footer #footer-content ul.links {
- margin: 0.5em 0 0;
- overflow: hidden;
- padding: 0;
- }
-
- #wiki-footer #footer-content ul.links li {
- color: #999;
- float: left;
- list-style-position: inside;
- list-style-type: square;
- padding: 0;
- margin-left: 0.75em;
- }
-
- #wiki-footer #footer-content ul.links li a {
- font-weight: bold;
- text-shadow: 0 1px 0 #fff;
- }
-
- #wiki-footer #footer-content ul.links li:first-child {
- list-style-type: none;
- margin: 0;
- }
-
- .ff #wiki-footer #footer-content ul.links li:first-child {
- margin: 0 -0.75em 0 0;
- }
-
- /* @section page-footer */
- .page #footer {
- margin: 1em 0 7em;
- }
-
- #footer p#last-edit {
- font-size: .9em;
- line-height: 1.6em;
- color: #999;
- margin: 0.9em 0;
- }
-
- #footer p#last-edit span.username {
- font-weight: bold;
- }
-
-
-/* @section history */
-.history h1 {
- color: #999;
- font-weight: normal;
-}
-
- .history h1 strong {
- color: #000;
- font-weight: bold;
- }
-
-#wiki-history {
- margin-top: 3em;
-}
-
- #wiki-history fieldset {
- border: 0;
- margin: 2em 0;
- padding: 0;
- }
-
- #wiki-history table, #wiki-history tbody {
- border-collapse: collapse;
- padding: 0;
- margin: 0;
- width: 100%;
- }
-
- #wiki-history table tr {
- padding: 0;
- margin: 0;
- }
-
- #wiki-history table tr {
- background-color: #ebf2f6;
- }
-
- #wiki-history table tr td {
- border: 1px solid #c0dce9;
- font-size: 1.2em;
- line-height: 1.6em;
- margin: 0;
- padding: 0.3em 0.7em;
- }
-
- #wiki-history table tr td.checkbox {
- min-width: 2em;
- padding: 0.3em;
- }
-
- #wiki-history table tr td.checkbox input {
- cursor: pointer;
- display: block;
- padding-right: 0;
- padding-top: 0.4em;
- margin-right: -0.2em;
- }
-
- #wiki-history table tr:nth-child(2n),
- #wiki-history table tr.alt-row {
- background-color: #f3f7fa;
- }
-
- #wiki-history table tr.selected {
- background-color: #ffffea !important;
- z-index: 100;
- }
-
- #wiki-history table tr td.commit-name {
- border-left: 0;
- }
-
- #wiki-history table tr td.commit-name span.time-elapsed {
- color: #999;
- }
-
- #wiki-history table tr td.author {
- width: 20%;
- }
-
- #wiki-history table tr td.author a {
- color: #000;
- font-weight: bold;
- }
-
- #wiki-history table tr td.author a span.username {
- display: block;
- padding-top: 3px;
- }
-
- #wiki-history table tr td img {
- background-color: #fff;
- border: 1px solid #999;
- display: block;
- float: left;
- height: 18px;
- overflow: hidden;
- margin: 0 0.5em 0 0;
- width: 18px;
- padding: 2px;
- }
-
- #wiki-history table tr td.commit-name a {
- font-size: 0.9em;
- font-family: 'Monaco', 'Andale Mono', Consolas, 'Courier New', monospace;
- padding: 0 0.2em;
- }
-
-.history #wiki-history ul.actions li,
-.history #footer ul.actions li {
- margin: 0 0.6em 0 0;
-}
-
-
-/* @section edit */
-.edit h1 {
- color: #999;
- font-weight: normal;
-}
-
- .edit h1 strong {
- color: #000;
- font-weight: bold;
- }
-
-
-/* @section search */
-.results h1 {
- color: #999;
- font-weight: normal;
-}
-
- .results h1 strong {
- color: #000;
- font-weight: bold;
- }
-
- .results #results {
- border-bottom: 1px solid #ccc;
- margin-bottom: 2em;
- padding-bottom: 2em;
- }
-
- .results #results ul {
- margin: 2em 0 0 0;
- padding: 0;
- }
-
- .results #results ul li {
- font-size: 1.2em;
- line-height: 1.6em;
- list-style-position: outside;
- padding: 0.2em 0;
- }
-
- .results #results ul li span.count {
- color: #999;
- }
-
- .results p#no-results {
- font-size: 1.2em;
- line-height: 1.6em;
- margin-top: 2em;
- }
-
- .results #footer ul.actions li {
- margin: 0 1em 0 0;
- }
-
-
-/* @section compare */
-.compare h1 {
- color: #999;
- font-weight: normal;
-}
-
- .compare h1 strong {
- color: #000;
- font-weight: bold;
- }
-
- .compare #compare-content {
- margin-top: 3em;
- }
-
- .compare .data {
- border: 1px solid #ddd;
- margin-top: 1em;
- overflow: auto;
- }
-
- .compare .data pre {
- margin: 0;
- padding: 0;
- }
-
- .compare .data pre div {
- padding: 0 0 0 1em;
- }
-
- .compare .data tr td {
- font-family: "Consolas", "Monaco", "Andale Mono", "Courier New", monospace;
- font-size: 1.2em;
- line-height: 1.8em;
- margin: 0;
- padding: 0;
- }
-
- .compare .data td.line_numbers {
- background: #f7f7f7;
- border-right: 1px solid #999;
- color: #999;
- padding: 0 0 0 0.5em;
- }
-
-.compare #compare-content ul.actions li,
-.compare #footer ul.actions li {
- margin-left: 0;
- margin-right: 0.6em;
-}
-
-
-
-/* @control syntax */
-.highlight { background: #ffffff; }
-.highlight .c { color: #999988; font-style: italic }
-.highlight .err { color: #a61717; background-color: #e3d2d2 }
-.highlight .k { font-weight: bold }
-.highlight .o { font-weight: bold }
-.highlight .cm { color: #999988; font-style: italic }
-.highlight .cp { color: #999999; font-weight: bold }
-.highlight .c1 { color: #999988; font-style: italic }
-.highlight .cs { color: #999999; font-weight: bold; font-style: italic }
-.highlight .gd { color: #000000; background-color: #ffdddd }
-.highlight .gd .x { color: #000000; background-color: #ffaaaa }
-.highlight .ge { font-style: italic }
-.highlight .gr { color: #aa0000 }
-.highlight .gh { color: #999999 }
-.highlight .gi { color: #000000; background-color: #ddffdd }
-.highlight .gi .x { color: #000000; background-color: #aaffaa }
-.highlight .gc { color: #999; background-color: #EAF2F5 }
-.highlight .go { color: #888888 }
-.highlight .gp { color: #555555 }
-.highlight .gs { font-weight: bold }
-.highlight .gu { color: #aaaaaa }
-.highlight .gt { color: #aa0000 }
-
-
-/* @control minibutton */
-ul.actions {
- display: block;
- list-style-type: none;
- overflow: hidden;
- padding: 0;
-}
-
- ul.actions li {
- float: left;
- font-size: 1.2em;
- margin-left: 0.6em;
- }
-
-.minibutton a {
- background-color: #f7f7f7;
- border: 1px solid #d4d4d4;
- color: #333;
- display: block;
- font-weight: bold;
- margin: 0;
- padding: 0.4em 1em;
- height: 1.4em;
-
- text-shadow: 0 1px 0 #fff;
-
- filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#f4f4f4', endColorstr='#ececec');
- background: -webkit-gradient(linear, left top, left bottom, from(#f4f4f4), to(#ececec));
- background: -moz-linear-gradient(top, #f4f4f4, #ececec);
-
- border-radius: 3px;
- -moz-border-radius: 3px;
- -webkit-border-radius: 3px;
-}
-
-#search-submit {
- background-color: #f7f7f7;
- border: 1px solid #d4d4d4;
- color: #333;
- display: block;
- font-weight: bold;
- margin: 0;
- padding: 0.4em 1em;
-
- text-shadow: 0 1px 0 #fff;
-
- filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#f4f4f4', endColorstr='#ececec');
- background: -webkit-gradient(linear, left top, left bottom, from(#f4f4f4), to(#ececec));
- background: -moz-linear-gradient(top, #f4f4f4, #ececec);
-
- border-radius: 3px;
- -moz-border-radius: 3px;
- -webkit-border-radius: 3px;
-}
-
-.minibutton a:hover,
-#search-submit:hover {
- background: #3072b3;
- border-color: #518cc6 #518cc6 #2a65a0;
- color: #fff;
- text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
- text-decoration: none;
-
- filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#599bdc', endColorstr='#3072b3');
- background: -webkit-gradient(linear, left top, left bottom, from(#599bdc), to(#3072b3));
- background: -moz-linear-gradient(top, #599bdc, #3072b3);
-}
-
-.minibutton a:visited {
- text-decoration: none;
-}
-
-
-/* @special error */
-#wiki-wrapper.error {
- height: 1px;
- position: absolute;
- overflow: visible;
- top: 50%;
- width: 100%;
-}
-
-#error {
- background-color: #f9f9f9;
- border: 1px solid #e4e4e4;
- left: 50%;
- overflow: hidden;
- padding: 2%;
- margin: -10% 0 0 -35%;
- position: absolute;
- width: 70%;
-
- border-radius: 0.5em;
- -moz-border-radius: 0.5em;
- -webkit-border-radius: 0.5em;
-}
-
-#error h1 {
- font-size: 3em;
- line-height: normal;
- margin: 0;
- padding: 0;
-}
-
-#error p {
- font-size: 1.2em;
- line-height: 1.6em;
- margin: 1em 0 0.5em;
- padding: 0;
-}
-
-
-/* @control searchbar */
-#head #searchbar {
- float: right;
- margin: 1em 0 0 0;
- padding: 0;
- overflow: hidden;
-}
-
- #head #searchbar #searchbar-fauxtext {
- background: #fff;
- border: 1px solid #d4d4d4;
- overflow: hidden;
-
- border-radius: 0.3em;
- -moz-border-radius: 0.3em;
- -webkit-border-radius: 0.3em;
- }
-
- #head #searchbar #searchbar-fauxtext input#search-query {
- border: none;
- color: #000;
- float: left;
- font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
- font-size: 1.2em;
- height: 1.8em;
-
- -webkit-focus-ring: none;
- }
-
- .ff #head #searchbar #searchbar-fauxtext input#search-query {
- padding: 0.2em 0 0.2em 0.5em;
- }
-
- .ie #head #searchbar #searchbar-fauxtext input#search-query {
- padding: 0.4em 0 0 0.5em;
- }
-
- #head #searchbar #searchbar-fauxtext input#search-query.ph {
- color: #999;
- }
-
- #head #searchbar #searchbar-fauxtext #search-submit {
- border: 0;
- border-left: 1px solid #d4d4d4;
- cursor: pointer;
- margin: 0 !important;
- padding: 0;
- float: right;
- font-size: 1.2em;
-
- border-radius: 0 3px 3px 0;
- -moz-border-radius: 0 3px 3px 0;
- -webkit-border-radius: 0 3px 3px 0;
- }
-
- #head #searchbar #searchbar-fauxtext #search-submit span {
- background-image: url(/images/icon-sprite.png);
- background-position: -431px -1px;
- background-repeat: no-repeat;
- display: block;
- height: 2em;
- overflow: hidden;
- text-indent: -5000px;
- width: 28px;
- }
-
- .ff #head #searchbar #searchbar-fauxtext #search-submit span,
- .ie #head #searchbar #searchbar-fauxtext #search-submit span {
- height: 2.2em;
- }
-
- #head #searchbar #searchbar-fauxtext #search-submit:hover span {
- background-position: -431px -28px;
- padding: 0;
- }
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/static/css/puny.css
----------------------------------------------------------------------
diff --git a/balance/modules/puny/static/css/puny.css b/balance/modules/puny/static/css/puny.css
deleted file mode 100644
index 68b3448..0000000
--- a/balance/modules/puny/static/css/puny.css
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-@CHARSET "UTF-8";
-
-[puny] {
-
- background-color:#fcfae6 !important;
- color:#222 !important;
-
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
-}
-
-[puny] a {
- color:#225 !important;
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/static/img/icon-sprite.png
----------------------------------------------------------------------
diff --git a/balance/modules/puny/static/img/icon-sprite.png b/balance/modules/puny/static/img/icon-sprite.png
deleted file mode 100644
index 83e8c6f..0000000
Binary files a/balance/modules/puny/static/img/icon-sprite.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/static/js/editable.js
----------------------------------------------------------------------
diff --git a/balance/modules/puny/static/js/editable.js b/balance/modules/puny/static/js/editable.js
deleted file mode 100644
index 5d82c03..0000000
--- a/balance/modules/puny/static/js/editable.js
+++ /dev/null
@@ -1,1090 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * gollum.editor.js
- * A jQuery plugin that creates the Gollum Editor.
- *
- * Usage:
- * $.GollumEditor(); on DOM ready.
- */
-(function($) {
-
- // Editor options
- var DefaultOptions = {
- MarkupType: 'markdown',
- EditorMode: 'code',
- NewFile: false,
- HasFunctionBar: true,
- Debug: false,
- NoDefinitionsFor: []
- };
- var ActiveOptions = {};
-
- /**
- * $.GollumEditor
- *
- * You don't need to do anything. Just run this on DOM ready.
- */
- $.GollumEditor = function( IncomingOptions ) {
-
- ActiveOptions = $.extend( DefaultOptions, IncomingOptions );
-
- debug('GollumEditor loading');
-
- if ( EditorHas.baseEditorMarkup() ) {
-
- if ( EditorHas.titleDisplayed() ) {
- $('#gollum-editor-title-field').addClass('active');
- }
-
- if ( EditorHas.editSummaryMarkup() ) {
- $.GollumEditor.Placeholder.add($('#gollum-editor-edit-summary input'));
- $('#gollum-editor form[name="gollum-editor"]').submit(function( e ) {
- e.preventDefault();
- $.GollumEditor.Placeholder.clearAll();
- debug('submitting');
- $(this).unbind('submit');
- $(this).submit();
- });
- }
-
- if ( EditorHas.collapsibleInputs() ) {
- $('#gollum-editor .collapsed a.button, ' +
- '#gollum-editor .expanded a.button').click(function( e ) {
- e.preventDefault();
- $(this).parent().toggleClass('expanded');
- $(this).parent().toggleClass('collapsed');
- });
- }
-
- if ( EditorHas.previewButton() ) {
- var formAction =
- $('#gollum-editor #gollum-editor-preview').click(function() {
- // make a dummy form, submit to new target window
- // get form fields
- var oldAction = $('#gollum-editor form').attr('action');
- var $form = $($('#gollum-editor form').get(0));
- $form.attr('action', this.href || '/preview');
- $form.attr('target', '_blank');
- $form.submit();
-
-
- $form.attr('action', oldAction);
- $form.removeAttr('target');
- return false;
- });
- }
-
- // Initialize the function bar by loading proper definitions
- if ( EditorHas.functionBar() ) {
-
- var htmlSetMarkupLang =
- $('#gollum-editor-body').attr('data-markup-lang');
-
- if ( htmlSetMarkupLang ) {
- ActiveOptions.MarkupType = htmlSetMarkupLang;
- }
-
- // load language definition
- LanguageDefinition.setActiveLanguage( ActiveOptions.MarkupType );
- if ( EditorHas.formatSelector() ) {
- FormatSelector.init(
- $('#gollum-editor-format-selector select') );
- }
-
- if ( EditorHas.help() ) {
- $('#gollum-editor-help').hide();
- $('#gollum-editor-help').removeClass('jaws');
- }
-
- }
- // EditorHas.functionBar
- }
- // EditorHas.baseEditorMarkup
- };
-
-
-
- /**
- * $.GollumEditor.defineLanguage
- * Defines a set of language actions that Gollum can use.
- * Used by the definitions in langs/ to register language definitions.
- */
- $.GollumEditor.defineLanguage = function( language_name, languageObject ) {
- if ( typeof languageObject == 'object' ) {
- LanguageDefinition.define( language_name, languageObject );
- } else {
- debug('GollumEditor.defineLanguage: definition for ' + language_name +
- ' is not an object');
- }
- };
-
-
- /**
- * debug
- * Prints debug information to console.log if debug output is enabled.
- *
- * @param mixed Whatever you want to dump to console.log
- * @return void
- */
- var debug = function(m) {
- if ( ActiveOptions.Debug &&
- typeof console != 'undefined' ) {
- console.log( m );
- }
- };
-
-
-
- /**
- * LanguageDefinition
- * Language definition file handler
- * Loads language definition files as necessary.
- */
- var LanguageDefinition = {
-
- _ACTIVE_LANG: '',
- _LOADED_LANGS: [],
- _LANG: {},
-
- /**
- * Defines a language
- *
- * @param name string The name of the language
- * @param name object The definition object
- */
- define: function( name, definitionObject ) {
- LanguageDefinition._ACTIVE_LANG = name;
- LanguageDefinition._LOADED_LANGS.push( name );
- if ( typeof $.GollumEditor.WikiLanguage == 'object' ) {
- var definition = {};
- $.extend(definition, $.GollumEditor.WikiLanguage, definitionObject);
- LanguageDefinition._LANG[name] = definition;
- } else {
- LanguageDefinition._LANG[name] = definitionObject;
- }
- },
-
- getActiveLanguage: function() {
- return LanguageDefinition._ACTIVE_LANG;
- },
-
- setActiveLanguage: function( name ) {
- if ( !LanguageDefinition.isLoadedFor(name) ) {
- LanguageDefinition._ACTIVE_LANG = null;
- LanguageDefinition.loadFor( name, function(x, t) {
- if ( t != 'success' ) {
- debug('Failed to load language definition for ' + name);
- // well, fake it and turn everything off for this one
- LanguageDefinition.define( name, {} );
- }
-
- // update features that rely on the language definition
- if ( EditorHas.functionBar() ) {
- FunctionBar.refresh();
- }
-
- if ( LanguageDefinition.isValid() && EditorHas.formatSelector() ) {
- FormatSelector.updateSelected();
- }
-
- } );
- } else {
- LanguageDefinition._ACTIVE_LANG = name;
- FunctionBar.refresh();
- }
- },
-
-
- /**
- * gets a definition object for a specified attribute
- *
- * @param string attr The specified attribute.
- * @param string specified_lang The language to pull a definition for.
- * @return object if exists, null otherwise
- */
- getDefinitionFor: function( attr, specified_lang ) {
- if ( !specified_lang ) {
- specified_lang = LanguageDefinition._ACTIVE_LANG;
- }
-
- if ( LanguageDefinition.isLoadedFor(specified_lang) &&
- LanguageDefinition._LANG[specified_lang][attr] &&
- typeof LanguageDefinition._LANG[specified_lang][attr] == 'object' ) {
- return LanguageDefinition._LANG[specified_lang][attr];
- }
-
- return null;
- },
-
-
- /**
- * loadFor
- * Asynchronously loads a definition file for the current markup.
- * Definition files are necessary to use the code editor.
- *
- * @param string markup_name The markup name you want to load
- * @return void
- */
- loadFor: function( markup_name, on_complete ) {
- // Keep us from hitting 404s on our site, check the definition blacklist
- if ( ActiveOptions.NoDefinitionsFor.length ) {
- for ( var i=0; i < ActiveOptions.NoDefinitionsFor.length; i++ ) {
- if ( markup_name == ActiveOptions.NoDefinitionsFor[i] ) {
- // we don't have this. get out.
- if ( typeof on_complete == 'function' ) {
- on_complete( null, 'error' );
- return;
- }
- }
- }
- }
-
- // attempt to load the definition for this language
- var script_uri = '/javascript/editor/langs/' + markup_name + '.js';
- $.ajax({
- url: script_uri,
- dataType: 'script',
- complete: function( xhr, textStatus ) {
- if ( typeof on_complete == 'function' ) {
- on_complete( xhr, textStatus );
- }
- }
- });
- },
-
-
- /**
- * isLoadedFor
- * Checks to see if a definition file has been loaded for the
- * specified markup language.
- *
- * @param string markup_name The name of the markup.
- * @return boolean
- */
- isLoadedFor: function( markup_name ) {
- if ( LanguageDefinition._LOADED_LANGS.length === 0 ) {
- return false;
- }
-
- for ( var i=0; i < LanguageDefinition._LOADED_LANGS.length; i++ ) {
- if ( LanguageDefinition._LOADED_LANGS[i] == markup_name ) {
- return true;
- }
- }
- return false;
- },
-
- isValid: function() {
- return ( LanguageDefinition._ACTIVE_LANG &&
- typeof LanguageDefinition._LANG[LanguageDefinition._ACTIVE_LANG] ==
- 'object' );
- }
-
- };
-
-
- /**
- * EditorHas
- * Various conditionals to check what features of the Gollum Editor are
- * active/operational.
- */
- var EditorHas = {
-
-
- /**
- * EditorHas.baseEditorMarkup
- * True if the basic editor form is in place.
- *
- * @return boolean
- */
- baseEditorMarkup: function() {
- return ( $('#gollum-editor').length &&
- $('#gollum-editor-body').length );
- },
-
-
- /**
- * EditorHas.collapsibleInputs
- * True if the editor contains collapsible inputs for things like the
- * sidebar or footer, false otherwise.
- *
- * @return boolean
- */
- collapsibleInputs: function() {
- return $('#gollum-editor .collapsed, #gollum-editor .expanded').length;
- },
-
-
- /**
- * EditorHas.formatSelector
- * True if the editor has a format selector (for switching between
- * language types), false otherwise.
- *
- * @return boolean
- */
- formatSelector: function() {
- return $('#gollum-editor-format-selector select').length;
- },
-
-
- /**
- * EditorHas.functionBar
- * True if the Function Bar markup exists.
- *
- * @return boolean
- */
- functionBar: function() {
- return ( ActiveOptions.HasFunctionBar &&
- $('#gollum-editor-function-bar').length );
- },
-
-
- /**
- * EditorHas.ff4Environment
- * True if in a Firefox 4.0 Beta environment.
- *
- * @return boolean
- */
- ff4Environment: function() {
- var ua = new RegExp(/Firefox\/4.0b/);
- return ( ua.test( navigator.userAgent ) );
- },
-
-
- /**
- * EditorHas.editSummaryMarkup
- * True if the editor has a summary field (Gollum's commit message),
- * false otherwise.
- *
- * @return boolean
- */
- editSummaryMarkup: function() {
- return ( $('input#gollum-editor-message-field').length > 0 );
- },
-
-
- /**
- * EditorHas.help
- * True if the editor contains the inline help sector, false otherwise.
- *
- * @return boolean
- */
- help: function() {
- return ( $('#gollum-editor #gollum-editor-help').length &&
- $('#gollum-editor #function-help').length );
- },
-
-
- /**
- * EditorHas.previewButton
- * True if the editor has a preview button, false otherwise.
- *
- * @return boolean
- */
- previewButton: function() {
- return ( $('#gollum-editor #gollum-editor-preview').length );
- },
-
-
- /**
- * EditorHas.titleDisplayed
- * True if the editor is displaying a title field, false otherwise.
- *
- * @return boolean
- */
- titleDisplayed: function() {
- return ( ActiveOptions.NewFile );
- }
-
- };
-
-
- /**
- * FunctionBar
- *
- * Things the function bar does.
- */
- var FunctionBar = {
-
- isActive: false,
-
-
- /**
- * FunctionBar.activate
- * Activates the function bar, attaching all click events
- * and displaying the bar.
- *
- */
- activate: function() {
- debug('Activating function bar');
-
- // check these out
- $('#gollum-editor-function-bar a.function-button').each(function() {
- if ( LanguageDefinition.getDefinitionFor( $(this).attr('id') ) ) {
- $(this).click( FunctionBar.evtFunctionButtonClick );
- $(this).removeClass('disabled');
- }
- else if ( $(this).attr('id') != 'function-help' ) {
- $(this).addClass('disabled');
- }
- });
-
- // show bar as active
- $('#gollum-editor-function-bar').addClass( 'active' );
- FunctionBar.isActive = true;
- },
-
-
- deactivate: function() {
- $('#gollum-editor-function-bar a.function-button').unbind('click');
- $('#gollum-editor-function-bar').removeClass( 'active' );
- FunctionBar.isActive = false;
- },
-
-
- /**
- * FunctionBar.evtFunctionButtonClick
- * Event handler for the function buttons. Traps the click and
- * executes the proper language action.
- *
- * @param jQuery.Event jQuery event object.
- */
- evtFunctionButtonClick: function(e) {
- e.preventDefault();
- var def = LanguageDefinition.getDefinitionFor( $(this).attr('id') );
- if ( typeof def == 'object' ) {
- FunctionBar.executeAction( def );
- }
- },
-
-
- /**
- * FunctionBar.executeAction
- * Executes a language-specific defined action for a function button.
- *
- */
- executeAction: function( definitionObject ) {
- // get the selected text from the textarea
- var txt = $('#gollum-editor-body').val();
- // hmm, I'm not sure this will work in a textarea
- var selPos = FunctionBar
- .getFieldSelectionPosition( $('#gollum-editor-body') );
- var selText = FunctionBar.getFieldSelection( $('#gollum-editor-body') );
- var repText = selText;
- var reselect = true;
- var cursor = null;
-
- // execute a replacement function if one exists
- if ( definitionObject.exec &&
- typeof definitionObject.exec == 'function' ) {
- definitionObject.exec( txt, selText, $('#gollum-editor-body') );
- return;
- }
-
- // execute a search/replace if they exist
- var searchExp = /([^\n]+)/gi;
- if ( definitionObject.search &&
- typeof definitionObject.search == 'object' ) {
- debug('Replacing search Regex');
- searchExp = null;
- searchExp = new RegExp ( definitionObject.search );
- debug( searchExp );
- }
- debug('repText is ' + '"' + repText + '"');
- // replace text
- if ( definitionObject.replace &&
- typeof definitionObject.replace == 'string' ) {
- debug('Running replacement - using ' + definitionObject.replace);
- var rt = definitionObject.replace;
- repText = repText.replace( searchExp, rt );
- // remove backreferences
- repText = repText.replace( /\$[\d]/g, '' );
-
- if ( repText === '' ) {
- debug('Search string is empty');
-
- // find position of $1 - this is where we will place the cursor
- cursor = rt.indexOf('$1');
-
- // we have an empty string, so just remove backreferences
- repText = rt.replace( /\$[\d]/g, '' );
-
- // if the position of $1 doesn't exist, stick the cursor in
- // the middle
- if ( cursor == -1 ) {
- cursor = Math.floor( rt.length / 2 );
- }
- }
- }
-
- // append if necessary
- if ( definitionObject.append &&
- typeof definitionObject.append == 'string' ) {
- if ( repText == selText ) {
- reselect = false;
- }
- repText += definitionObject.append;
- }
-
- if ( repText ) {
- FunctionBar.replaceFieldSelection( $('#gollum-editor-body'),
- repText, reselect, cursor );
- }
-
- },
-
-
- /**
- * getFieldSelectionPosition
- * Retrieves the selection range for the textarea.
- *
- * @return object the .start and .end offsets in the string
- */
- getFieldSelectionPosition: function( $field ) {
- if ($field.length) {
- var start = 0, end = 0;
- var el = $field.get(0);
-
- if (typeof el.selectionStart == "number" &&
- typeof el.selectionEnd == "number") {
- start = el.selectionStart;
- end = el.selectionEnd;
- } else {
- var range = document.selection.createRange();
- var stored_range = range.duplicate();
- stored_range.moveToElementText( el );
- stored_range.setEndPoint( 'EndToEnd', range );
- start = stored_range.text.length - range.text.length;
- end = start + range.text.length;
-
- // so, uh, we're close, but we need to search for line breaks and
- // adjust the start/end points accordingly since IE counts them as
- // 2 characters in TextRange.
- var s = start;
- var lb = 0;
- var i;
- debug('IE: start position is currently ' + s);
- for ( i=0; i < s; i++ ) {
- if ( el.value.charAt(i).match(/\r/) ) {
- ++lb;
- }
- }
-
- if ( lb ) {
- debug('IE start: compensating for ' + lb + ' line breaks');
- start = start - lb;
- lb = 0;
- }
-
- var e = end;
- for ( i=0; i < e; i++ ) {
- if ( el.value.charAt(i).match(/\r/) ) {
- ++lb;
- }
- }
-
- if ( lb ) {
- debug('IE end: compensating for ' + lb + ' line breaks');
- end = end - lb;
- }
- }
-
- return {
- start: start,
- end: end
- };
- } // end if ($field.length)
- },
-
-
- /**
- * getFieldSelection
- * Returns the currently selected substring of the textarea.
- *
- * @param jQuery A jQuery object for the textarea.
- * @return string Selected string.
- */
- getFieldSelection: function( $field ) {
- var selStr = '';
- var selPos;
-
- if ( $field.length ) {
- selPos = FunctionBar.getFieldSelectionPosition( $field );
- selStr = $field.val().substring( selPos.start, selPos.end );
- debug('Selected: ' + selStr + ' (' + selPos.start + ', ' +
- selPos.end + ')');
- return selStr;
- }
- return false;
- },
-
-
- isShown: function() {
- return ($('#gollum-editor-function-bar').is(':visible'));
- },
-
- refresh: function() {
- if ( EditorHas.functionBar() ) {
- debug('Refreshing function bar');
- if ( LanguageDefinition.isValid() ) {
- $('#gollum-editor-function-bar a.function-button').unbind('click');
- FunctionBar.activate();
- if ( Help ) {
- Help.setActiveHelp( LanguageDefinition.getActiveLanguage() );
- }
- } else {
- debug('Language definition is invalid.');
- if ( FunctionBar.isShown() ) {
- // deactivate the function bar; it's not gonna work now
- FunctionBar.deactivate();
- }
- if ( Help.isShown() ) {
- Help.hide();
- }
- }
- }
- },
-
-
- /**
- * replaceFieldSelection
- * Replaces the currently selected substring of the textarea with
- * a new string.
- *
- * @param jQuery A jQuery object for the textarea.
- * @param string The string to replace the current selection with.
- * @param boolean Reselect the new text range.
- */
- replaceFieldSelection: function( $field, replaceText, reselect, cursorOffset ) {
- var selPos = FunctionBar.getFieldSelectionPosition( $field );
- var fullStr = $field.val();
- var selectNew = true;
- if ( reselect === false) {
- selectNew = false;
- }
-
- var scrollTop = null;
- if ( $field[0].scrollTop ) {
- scrollTop = $field[0].scrollTop;
- }
-
- $field.val( fullStr.substring(0, selPos.start) + replaceText +
- fullStr.substring(selPos.end) );
- $field[0].focus();
-
- if ( selectNew ) {
- if ( $field[0].setSelectionRange ) {
- if ( cursorOffset ) {
- $field[0].setSelectionRange(
- selPos.start + cursorOffset,
- selPos.start + cursorOffset
- );
- } else {
- $field[0].setSelectionRange( selPos.start,
- selPos.start + replaceText.length );
- }
- } else if ( $field[0].createTextRange ) {
- var range = $field[0].createTextRange();
- range.collapse( true );
- if ( cursorOffset ) {
- range.moveEnd( selPos.start + cursorOffset );
- range.moveStart( selPos.start + cursorOffset );
- } else {
- range.moveEnd( 'character', selPos.start + replaceText.length );
- range.moveStart( 'character', selPos.start );
- }
- range.select();
- }
- }
-
- if ( scrollTop ) {
- // this jumps sometimes in FF
- $field[0].scrollTop = scrollTop;
- }
- }
- };
-
-
-
- /**
- * FormatSelector
- *
- * Functions relating to the format selector (if it exists)
- */
- var FormatSelector = {
-
- $_SELECTOR: null,
-
- /**
- * FormatSelector.evtChangeFormat
- * Event handler for when a format has been changed by the format
- * selector. Will automatically load a new language definition
- * via JS if necessary.
- *
- * @return void
- */
- evtChangeFormat: function( e ) {
- var newMarkup = $(this).val();
- LanguageDefinition.setActiveLanguage( newMarkup );
- },
-
-
- /**
- * FormatSelector.init
- * Initializes the format selector.
- *
- * @return void
- */
- init: function( $sel ) {
- debug('Initializing format selector');
-
- // unbind events if init is being called twice for some reason
- if ( FormatSelector.$_SELECTOR &&
- typeof FormatSelector.$_SELECTOR == 'object' ) {
- FormatSelector.$_SELECTOR.unbind( 'change' );
- }
-
- FormatSelector.$_SELECTOR = $sel;
-
- // set format selector to the current language
- FormatSelector.updateSelected();
- FormatSelector.$_SELECTOR.change( FormatSelector.evtChangeFormat );
- },
-
-
- /**
- * FormatSelector.update
- */
- updateSelected: function() {
- var currentLang = LanguageDefinition.getActiveLanguage();
- FormatSelector.$_SELECTOR.val( currentLang );
- }
-
- };
-
-
-
- /**
- * Help
- *
- * Functions that manage the display and loading of inline help files.
- */
- var Help = {
-
- _ACTIVE_HELP: '',
- _LOADED_HELP_LANGS: [],
- _HELP: {},
-
- /**
- * Help.define
- *
- * Defines a new help context and enables the help function if it
- * exists in the Gollum Function Bar.
- *
- * @param string name The name you're giving to this help context.
- * Generally, this should match the language name.
- * @param object definitionObject The definition object being loaded from a
- * language / help definition file.
- * @return void
- */
- define: function( name, definitionObject ) {
- if ( Help.isValidHelpFormat( definitionObject ) ) {
- debug('help is a valid format');
-
- Help._ACTIVE_HELP_LANG = name;
- Help._LOADED_HELP_LANGS.push( name );
- Help._HELP[name] = definitionObject;
-
- if ( $("#function-help").length ) {
- if ( $('#function-help').hasClass('disabled') ) {
- $('#function-help').removeClass('disabled');
- }
- $('#function-help').unbind('click');
- $('#function-help').click( Help.evtHelpButtonClick );
-
- // generate help menus
- Help.generateHelpMenuFor( name );
-
- if ( $('#gollum-editor-help').length &&
- typeof $('#gollum-editor-help').attr('data-autodisplay') !== 'undefined' &&
- $('#gollum-editor-help').attr('data-autodisplay') === 'true' ) {
- Help.show();
- }
- }
- } else {
- if ( $('#function-help').length ) {
- $('#function-help').addClass('disabled');
- }
- }
- },
-
- /**
- * Help.generateHelpMenuFor
- * Generates the markup for the main help menu given a context name.
- *
- * @param string name The context name.
- * @return void
- */
- generateHelpMenuFor: function( name ) {
- if ( !Help._HELP[name] ) {
- debug('Help is not defined for ' + name.toString());
- return false;
- }
- var helpData = Help._HELP[name];
-
- // clear this shiz out
- $('#gollum-editor-help-parent').html('');
- $('#gollum-editor-help-list').html('');
- $('#gollum-editor-help-content').html('');
-
- // go go inefficient algorithm
- for ( var i=0; i < helpData.length; i++ ) {
- if ( typeof helpData[i] != 'object' ) {
- break;
- }
-
- var $newLi = $('<li><a href="#" rel="' + i + '">' +
- helpData[i].menuName + '</a></li>');
- $('#gollum-editor-help-parent').append( $newLi );
- if ( i === 0 ) {
- // select on first run
- $newLi.children('a').addClass('selected');
- }
- $newLi.children('a').click( Help.evtParentMenuClick );
- }
-
- // generate parent submenu on first run
- Help.generateSubMenu( helpData[0], 0 );
- $($('#gollum-editor-help-list li a').get(0)).click();
-
- },
-
- /**
- * Help.generateSubMenu
- * Generates the markup for the inline help sub-menu given the data
- * object for the submenu and the array index to start at.
- *
- * @param object subData The data for the sub-menu.
- * @param integer index The index clicked on (parent menu index).
- * @return void
- */
- generateSubMenu: function( subData, index ) {
- $('#gollum-editor-help-list').html('');
- $('#gollum-editor-help-content').html('');
- for ( var i=0; i < subData.content.length; i++ ) {
- if ( typeof subData.content[i] != 'object' ) {
- break;
- }
-
- var $subLi = $('<li><a href="#" rel="' + index + ':' + i + '">' +
- subData.content[i].menuName + '</a></li>');
-
-
- $('#gollum-editor-help-list').append( $subLi );
- $subLi.children('a').click( Help.evtSubMenuClick );
- }
- },
-
- hide: function() {
- if ( $.browser.msie ) {
- $('#gollum-editor-help').css('display', 'none');
- } else {
- $('#gollum-editor-help').animate({
- opacity: 0
- }, 200, function() {
- $('#gollum-editor-help')
- .animate({ height: 'hide' }, 200);
- });
- }
- },
-
- show: function() {
- if ( $.browser.msie ) {
- // bypass effects for internet explorer, since it does weird crap
- // to text antialiasing with opacity animations
- $('#gollum-editor-help').css('display', 'block');
- } else {
- $('#gollum-editor-help').animate({
- height: 'show'
- }, 200, function() {
- $('#gollum-editor-help')
- .animate({ opacity: 1 }, 300);
- });
- }
- },
-
- /**
- * Help.showHelpFor
- * Displays the actual help content given the two menu indexes, which are
- * rendered in the rel="" attributes of the help menus
- *
- * @param integer index1 parent index
- * @param integer index2 submenu index
- * @return void
- */
- showHelpFor: function( index1, index2 ) {
- var html =
- Help._HELP[Help._ACTIVE_HELP_LANG][index1].content[index2].data;
- $('#gollum-editor-help-content').html(html);
- },
-
- /**
- * Help.isLoadedFor
- * Returns true if help is loaded for a specific markup language,
- * false otherwise.
- *
- * @param string name The name of the markup language.
- * @return boolean
- */
- isLoadedFor: function( name ) {
- for ( var i=0; i < Help._LOADED_HELP_LANGS.length; i++ ) {
- if ( name == Help._LOADED_HELP_LANGS[i] ) {
- return true;
- }
- }
- return false;
- },
-
- isShown: function() {
- return ($('#gollum-editor-help').is(':visible'));
- },
-
- /**
- * Help.isValidHelpFormat
- * Does a quick check to make sure that the help definition isn't in a
- * completely messed-up format.
- *
- * @param object (Array) helpArr The help definition array.
- * @return boolean
- */
- isValidHelpFormat: function( helpArr ) {
- return ( typeof helpArr == 'object' &&
- helpArr.length &&
- typeof helpArr[0].menuName == 'string' &&
- typeof helpArr[0].content == 'object' &&
- helpArr[0].content.length );
- },
-
- /**
- * Help.setActiveHelp
- * Sets the active help definition to the one defined in the argument,
- * re-rendering the help menu to match the new definition.
- *
- * @param string name The name of the help definition.
- * @return void
- */
- setActiveHelp: function( name ) {
- if ( !Help.isLoadedFor( name ) ) {
- if ( $('#function-help').length ) {
- $('#function-help').addClass('disabled');
- }
- if ( Help.isShown() ) {
- Help.hide();
- }
- } else {
- Help._ACTIVE_HELP_LANG = name;
- if ( $("#function-help").length ) {
- if ( $('#function-help').hasClass('disabled') ) {
- $('#function-help').removeClass('disabled');
- }
- $('#function-help').unbind('click');
- $('#function-help').click( Help.evtHelpButtonClick );
- Help.generateHelpMenuFor( name );
- }
- }
- },
-
- /**
- * Help.evtHelpButtonClick
- * Event handler for clicking the help button in the function bar.
- *
- * @param jQuery.Event e The jQuery event object.
- * @return void
- */
- evtHelpButtonClick: function( e ) {
- e.preventDefault();
- if ( Help.isShown() ) {
- // turn off autodisplay if it's on
- if ( $('#gollum-editor-help').length &&
- $('#gollum-editor-help').attr('data-autodisplay') !== 'undefined' &&
- $('#gollum-editor-help').attr('data-autodisplay') === 'true' ) {
- $.post('/wiki/help?_method=delete');
- $('#gollum-editor-help').attr('data-autodisplay', '');
- }
- Help.hide(); }
- else { Help.show(); }
- },
-
- /**
- * Help.evtParentMenuClick
- * Event handler for clicking on an item in the parent menu. Automatically
- * renders the submenu for the parent menu as well as the first result for
- * the actual plain text.
- *
- * @param jQuery.Event e The jQuery event object.
- * @return void
- */
- evtParentMenuClick: function( e ) {
- e.preventDefault();
- // short circuit if we've selected this already
- if ( $(this).hasClass('selected') ) { return; }
-
- // populate from help data for this
- var helpIndex = $(this).attr('rel');
- var subData = Help._HELP[Help._ACTIVE_HELP_LANG][helpIndex];
-
- $('#gollum-editor-help-parent li a').removeClass('selected');
- $(this).addClass('selected');
- Help.generateSubMenu( subData, helpIndex );
- $($('#gollum-editor-help-list li a').get(0)).click();
- },
-
- /**
- * Help.evtSubMenuClick
- * Event handler for clicking an item in a help submenu. Renders the
- * appropriate text for the submenu link.
- *
- * @param jQuery.Event e The jQuery event object.
- * @return void
- */
- evtSubMenuClick: function( e ) {
- e.preventDefault();
- if ( $(this).hasClass('selected') ) { return; }
-
- // split index rel data
- var rawIndex = $(this).attr('rel').split(':');
- $('#gollum-editor-help-list li a').removeClass('selected');
- $(this).addClass('selected');
- Help.showHelpFor( rawIndex[0], rawIndex[1] );
- }
- };
-
- // Publicly-accessible function to Help.define
- $.GollumEditor.defineHelp = Help.define;
-
- // Dialog exists as its own thing now
- $.GollumEditor.Dialog = $.GollumDialog;
- $.GollumEditor.replaceSelection = function( repText ) {
- FunctionBar.replaceFieldSelection( $('#gollum-editor-body'), repText );
- };
-
- // Placeholder exists as its own thing now
- $.GollumEditor.Placeholder = $.GollumPlaceholder;
-
-})(jQuery);
[25/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/test/java/org/apache/oodt/cas/catalog/system/impl/TestCatalogServiceLocal.java
----------------------------------------------------------------------
diff --git a/catalog/src/test/java/org/apache/oodt/cas/catalog/system/impl/TestCatalogServiceLocal.java b/catalog/src/test/java/org/apache/oodt/cas/catalog/system/impl/TestCatalogServiceLocal.java
deleted file mode 100644
index 3c6d283..0000000
--- a/catalog/src/test/java/org/apache/oodt/cas/catalog/system/impl/TestCatalogServiceLocal.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.system.impl;
-
-//JDK imports
-
-import org.apache.commons.io.FileUtils;
-import org.apache.oodt.cas.catalog.exception.CatalogServiceException;
-import org.apache.oodt.cas.catalog.mapping.InMemoryIngestMapperFactory;
-import org.apache.oodt.cas.catalog.metadata.TransactionalMetadata;
-import org.apache.oodt.cas.catalog.page.Page;
-import org.apache.oodt.cas.catalog.page.PageInfo;
-import org.apache.oodt.cas.catalog.page.QueryPager;
-import org.apache.oodt.cas.catalog.page.TransactionReceipt;
-import org.apache.oodt.cas.catalog.query.QueryExpression;
-import org.apache.oodt.cas.catalog.query.parser.ParseException;
-import org.apache.oodt.cas.catalog.query.parser.QueryParser;
-import org.apache.oodt.cas.catalog.query.parser.TokenMgrError;
-import org.apache.oodt.cas.catalog.repository.MemoryBasedCatalogRepositoryFactory;
-import org.apache.oodt.cas.catalog.struct.impl.index.DataSourceIndexFactory;
-import org.apache.oodt.cas.catalog.struct.impl.index.InMemoryIndexFactory;
-import org.apache.oodt.cas.catalog.struct.impl.transaction.UuidTransactionIdFactory;
-import org.apache.oodt.cas.catalog.system.CatalogFactory;
-import org.apache.oodt.cas.metadata.Metadata;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Collections;
-import java.util.List;
-import java.util.Vector;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import junit.framework.TestCase;
-
-//OODT imports
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- */
-public class TestCatalogServiceLocal extends TestCase {
-
- private CatalogServiceLocal cs;
- private File testDir;
- private static Logger LOG = Logger.getLogger(TestCatalogServiceLocal.class.getName());
- public void setUp() {
- try {
- File tempFile = File.createTempFile("foo", "bar");
- tempFile.deleteOnExit();
- testDir = new File(tempFile.getParentFile(), "cas-catalog");
-
- CatalogServiceLocalFactory factory = new CatalogServiceLocalFactory();
- factory
- .setCatalogRepositoryFactory(new MemoryBasedCatalogRepositoryFactory());
- factory.setIngestMapperFactory(this
- .getOracleIngestMapperFactory(testDir.getAbsolutePath() + "/mapper"));
- factory.setOneCatalogFailsAllFail(true);
- factory.setSimplifyQueries(true);
- factory.setPluginStorageDir("/dev/null");
- factory.setRestrictIngestPermissions(false);
- factory.setRestrictQueryPermissions(false);
- factory.setTransactionIdFactory(UuidTransactionIdFactory.class
- .getCanonicalName());
- cs = factory.createCatalogService();
-
- CatalogFactory catalogFactory = new CatalogFactory();
- catalogFactory.setCatalogId("TestCatalog1");
- catalogFactory.setDictionaryFactories(null);
- catalogFactory
- .setIndexFactory(getInMemoryDSFactory(testDir.getAbsolutePath() + "/index/1/"));
- catalogFactory.setRestrictIngestPermissions(false);
- catalogFactory.setRestrictQueryPermissions(false);
- cs.addCatalog(catalogFactory.createCatalog());
- catalogFactory.setCatalogId("TestCatalog2");
- catalogFactory
- .setIndexFactory(getInMemoryDSFactory(testDir.getAbsolutePath() + "/index/2/"));
- cs.addCatalog(catalogFactory.createCatalog());
- }catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- TestCase.fail(e.getMessage());
- }
- }
-
- public void tearDown() {
- try {
- FileUtils.forceDelete(this.testDir);
- } catch (IOException e) {
- LOG.log(Level.SEVERE, e.getMessage());
- TestCase.fail(e.getMessage());
- }
- }
-
- public void testDataSourceCatalogIngestQueryAndDelete()
- throws CatalogServiceException, ParseException, TokenMgrError {
- // test ingest
- Metadata m = new Metadata();
- m.addMetadata("testkey1", "testval1");
- TransactionReceipt tr = cs.ingest(m);
- Vector<TransactionReceipt> receipts = new Vector<TransactionReceipt>();
- receipts.add(tr);
- List<TransactionalMetadata> metadatas = cs.getMetadata(receipts);
- assertEquals(metadatas.size(), 1);
- Metadata ingestedMetadata = metadatas.get(0).getMetadata();
- assertEquals(ingestedMetadata.getMetadata("testkey1"), "testval1");
- assertEquals(ingestedMetadata.getAllMetadata("testkey1").size(), 2);
-
- // test ingest update
- m.replaceMetadata(
- CatalogServiceLocal.CATALOG_SERVICE_TRANSACTION_ID_MET_KEY, tr.getTransactionId().toString());
- m.replaceMetadata(CatalogServiceLocal.ENABLE_UPDATE_MET_KEY, "true");
- tr = cs.ingest(m);
- receipts = new Vector<TransactionReceipt>();
- receipts.add(tr);
- metadatas = cs.getMetadata(receipts);
- assertEquals(metadatas.size(), 1);
- ingestedMetadata = metadatas.get(0).getMetadata();
- assertEquals(ingestedMetadata.getMetadata("testkey1"), "testval1");
- assertEquals(ingestedMetadata.getAllMetadata("testkey1").size(), 2);
-
- // test query using querypager
- QueryExpression qe = QueryParser
- .parseQueryExpression("testkey1 == 'testval1'");
- QueryPager pager = cs.query(qe);
- metadatas = cs.getNextPage(pager);
- assertEquals(metadatas.size(), 1);
- ingestedMetadata = metadatas.get(0).getMetadata();
- assertEquals(ingestedMetadata.getMetadata("testkey1"), "testval1");
- assertEquals(ingestedMetadata.getAllMetadata("testkey1").size(), 2);
-
- // test query using std paging
- qe = QueryParser.parseQueryExpression("testkey1 == 'testval1'");
- Page page = cs.getPage(new PageInfo(20, PageInfo.FIRST_PAGE), qe);
- metadatas = cs.getMetadata(page);
- assertEquals(metadatas.size(), 1);
- ingestedMetadata = metadatas.get(0).getMetadata();
- assertEquals(ingestedMetadata.getMetadata("testkey1"), "testval1");
- assertEquals(ingestedMetadata.getAllMetadata("testkey1").size(), 2);
-
- // test query using std paging with catalog restriction
- qe = QueryParser.parseQueryExpression("testkey1 == 'testval1'");
- page = cs.getPage(new PageInfo(20, PageInfo.FIRST_PAGE), qe,
- Collections.singleton("TestCatalog1"));
- metadatas = cs.getMetadata(page);
- assertEquals(metadatas.size(), 1);
- ingestedMetadata = metadatas.get(0).getMetadata();
- assertEquals(ingestedMetadata.getMetadata("testkey1"), "testval1");
- assertEquals(ingestedMetadata.getAllMetadata("testkey1").size(), 1);
-
- // test delete
- m = new Metadata();
- m.addMetadata(CatalogServiceLocal.CATALOG_SERVICE_TRANSACTION_ID_MET_KEY, tr.getTransactionId().toString());
- cs.delete(m);
- assertEquals(cs.getMetadata(Collections.singletonList(tr)).size(), 0);
- }
-
- private InMemoryIngestMapperFactory getOracleIngestMapperFactory(
- String tmpDirPath) {
- String user = "sa";
- String pass = "";
- String driver = "org.hsqldb.jdbcDriver";
- String url = "jdbc:hsqldb:file:" + tmpDirPath + ";shutdown=true";
-
- InMemoryIngestMapperFactory factory = new InMemoryIngestMapperFactory();
- factory.setDriver(driver);
- factory.setJdbcUrl(url);
- factory.setPass(pass);
- factory.setUser(user);
- factory.setTablesFile(this.getClass().getResource("/test-mapper-cat.sql").getPath());
- return factory;
- }
-
- private DataSourceIndexFactory getInMemoryDSFactory(String tmpDirPath) {
- String user = "sa";
- String pass = "";
- String driver = "org.hsqldb.jdbcDriver";
- String url = "jdbc:hsqldb:file:" + tmpDirPath + ";shutdown=true";
-
- InMemoryIndexFactory indexFactory = new InMemoryIndexFactory();
- indexFactory.setDriver(driver);
- indexFactory.setJdbcUrl(url);
- indexFactory.setPass(pass);
- indexFactory.setUser(user);
- indexFactory.setTablesFile(this.getClass().getResource("/test-index-cat.sql").getPath());
- return indexFactory;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/test/resources/test-index-cat.sql
----------------------------------------------------------------------
diff --git a/catalog/src/test/resources/test-index-cat.sql b/catalog/src/test/resources/test-index-cat.sql
deleted file mode 100644
index fbbd46e..0000000
--- a/catalog/src/test/resources/test-index-cat.sql
+++ /dev/null
@@ -1,32 +0,0 @@
- -- Licensed to the Apache Software Foundation (ASF) under one or more
- -- contributor license agreements. See the NOTICE file distributed with
- -- this work for additional information regarding copyright ownership.
- -- The ASF licenses this file to You under the Apache License, Version 2.0
- -- (the "License"); you may not use this file except in compliance with
- -- the License. You may obtain a copy of the License at
- --
- -- http://www.apache.org/licenses/LICENSE-2.0
- --
- -- Unless required by applicable law or agreed to in writing, software
- -- distributed under the License is distributed on an "AS IS" BASIS,
- -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- -- See the License for the specific language governing permissions and
- -- limitations under the License.
-
-DROP TABLE transactions IF EXISTS;
-DROP TABLE transaction_terms IF EXISTS;
-
-CREATE TABLE transactions
-(
- transaction_id varchar(256) NOT NULL,
- transaction_date varchar(256) NOT NULL
-);
-
-CREATE TABLE transaction_terms
-(
- transaction_id varchar(256) NOT NULL,
- bucket_name varchar(256) NOT NULL,
- term_name varchar(256) NOT NULL,
- term_value varchar(1000) NOT NULL
-);
-
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/test/resources/test-mapper-cat.sql
----------------------------------------------------------------------
diff --git a/catalog/src/test/resources/test-mapper-cat.sql b/catalog/src/test/resources/test-mapper-cat.sql
deleted file mode 100644
index 571a36e..0000000
--- a/catalog/src/test/resources/test-mapper-cat.sql
+++ /dev/null
@@ -1,26 +0,0 @@
- -- Licensed to the Apache Software Foundation (ASF) under one or more
- -- contributor license agreements. See the NOTICE file distributed with
- -- this work for additional information regarding copyright ownership.
- -- The ASF licenses this file to You under the Apache License, Version 2.0
- -- (the "License"); you may not use this file except in compliance with
- -- the License. You may obtain a copy of the License at
- --
- -- http://www.apache.org/licenses/LICENSE-2.0
- --
- -- Unless required by applicable law or agreed to in writing, software
- -- distributed under the License is distributed on an "AS IS" BASIS,
- -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- -- See the License for the specific language governing permissions and
- -- limitations under the License.
-
-DROP TABLE CatalogServiceMapper IF EXISTS;
-
-CREATE TABLE CatalogServiceMapper (
- CAT_SERV_TRANS_ID VARCHAR(255) NOT NULL ,
- CAT_SERV_TRANS_FACTORY VARCHAR(255) NOT NULL ,
- CAT_TRANS_ID VARCHAR(255) NOT NULL ,
- CAT_TRANS_FACTORY VARCHAR(255) NOT NULL ,
- CAT_TRANS_DATE VARCHAR(255) NOT NULL ,
- CATALOG_ID VARCHAR(255) NOT NULL
-);
-
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/docker/Dockerfile
----------------------------------------------------------------------
diff --git a/docker/Dockerfile b/docker/Dockerfile
deleted file mode 100644
index 3180f57..0000000
--- a/docker/Dockerfile
+++ /dev/null
@@ -1,22 +0,0 @@
-FROM ubuntu:latest
-MAINTAINER Tom Barber
-
-ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/
-
-RUN apt-get update
-RUN apt-get install -y openjdk-8-jre-headless openjdk-8-jre maven curl
-#RUN sudo apt-get install maven2
-WORKDIR /usr/src
-
-RUN curl -s http://svn.apache.org/repos/asf/oodt/trunk/mvn/archetypes/radix/src/main/resources/bin/radix | bash
-RUN mv oodt oodt-src; cd oodt-src; mvn package
-RUN mkdir /usr/src/oodt; tar -xvf /usr/src/oodt-src/distribution/target/oodt-distribution-0.1-bin.tar.gz -C /usr/src/oodt
-
-EXPOSE 8080
-EXPOSE 9000
-EXPOSE 2001
-EXPOSE 9001
-EXPOSE 9200
-EXPOSE 9002
-
-CMD cd /usr/src/oodt/bin/ && ./oodt start && tail -f /usr/src/oodt/tomcat/logs/catalina.out
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/grid/pom.xml
----------------------------------------------------------------------
diff --git a/grid/pom.xml b/grid/pom.xml
deleted file mode 100644
index 59a355d..0000000
--- a/grid/pom.xml
+++ /dev/null
@@ -1,138 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more contributor
-license agreements. See the NOTICE.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>
- <parent>
- <groupId>org.apache.oodt</groupId>
- <artifactId>oodt-core</artifactId>
- <version>1.1-SNAPSHOT</version>
- <relativePath>../core/pom.xml</relativePath>
- </parent>
- <artifactId>web-grid</artifactId>
- <packaging>war</packaging>
- <name>OODT Web Grid</name>
- <description>The OODT grid services (product and profile services) use CORBA or
- RMI as their underlying network transport. However, limitations
- of CORBA and RMI make them inappropriate for large-scale
- deployments. For one, both are procedural mechanisms, providing a
- remote interface that resembles a method call. This makes
- streaming of data from a service impossible, because there are
- limitations to the sizes of data structures that can be passed
- over a remote method call. Instead, repeated calls must be made
- to retrieve each block of a product, making transfer speeds
- horribly slow compared to HTTP or FTP. (Block-based retrieval of
- profiles was never implemented, resulting in out of memory
- conditions for large profile results, which is another problem.)
- Second, both CORBA and RMI rely on a central name registry. The
- registry makes an object independent of its network location,
- enabling a client to call it by name (looking up its last known
- location in the registry). However, this requires that server
- objects be able to make outbound network calls to the registry
- (through any outbound firewall), and that the registry accept
- those registrations (through any inbound firewall). This required
- administrative action at institutions hosting server objects and
- at the institution hosting the registry. Often, these firewall
- exceptions would change without notice as system adminstrators
- changed at each location (apparently firewall exceptions are
- poorly documented everywhere). Further, in the two major
- deployments of OODT (PDS and EDRN), server objects have almost
- never moved, nullifying any benefit of the registry. This
- project, OODT Web Grid Services, avoids the prolems of CORBA and
- RMI by using HTTP as the transport mechanism for products and
- profiles. Further, it provides a password-protected mechanism to
- add new sets of product and profile query handlers, enabling
- seamless activation of additional capabilities.</description>
- <!-- All dependencies should be listed in core/pom.xml and be ordered alphabetically by package and artifact.
- Once the dependency is in the core pom, it can then be used in other modules without the version tags.
- For example, within core/pom.xml:
-
- <dependency>
- <groupId>com.amazonaws</groupId>
- <artifactId>aws-java-sdk</artifactId>
- <version>1.7.4</version>
- </dependency>
-
- Elsewhere in the platform:
- <dependency>
- <groupId>com.amazonaws</groupId>
- <artifactId>aws-java-sdk</artifactId>
- </dependency>
-
- Where possible the same dependency version should be used across the whole platform but if required the version
- can be overridden in a specific pom and should have a comment explaing why the version has been overridden
- -->
- <dependencies>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jena</groupId>
- <artifactId>apache-jena-libs</artifactId>
- <type>pom</type>
- </dependency>
- <dependency>
- <groupId>org.apache.oodt</groupId>
- <artifactId>oodt-commons</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.oodt</groupId>
- <artifactId>oodt-product</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.oodt</groupId>
- <artifactId>oodt-profile</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.oodt</groupId>
- <artifactId>oodt-xmlquery</artifactId>
- </dependency>
- <dependency>
- <groupId>xalan</groupId>
- <artifactId>xalan</artifactId>
- </dependency>
- <dependency>
- <groupId>xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-war-plugin</artifactId>
- <version>2.5</version>
- <configuration>
- <webResources />
- <warSourceDirectory>src/main/webapp</warSourceDirectory>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <scm>
- <!--<connection>scm:svn:https://svn.apache.org/repos/asf/oodt/trunk/grid</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/oodt/trunk/grid</developerConnection>
- <url>http://svn.apache.org/viewvc/oodt/trunk/grid</url>-->
- <tag>0.13-SNAPSHOT</tag>
- </scm>
-</project>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/grid/src/main/java/org/apache/oodt/grid/AuthenticationRequiredException.java
----------------------------------------------------------------------
diff --git a/grid/src/main/java/org/apache/oodt/grid/AuthenticationRequiredException.java b/grid/src/main/java/org/apache/oodt/grid/AuthenticationRequiredException.java
deleted file mode 100755
index 3c152b8..0000000
--- a/grid/src/main/java/org/apache/oodt/grid/AuthenticationRequiredException.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.grid;
-
-/**
- * Exception thrown to indicate that authentication is required to continue.
- */
-public class AuthenticationRequiredException extends Exception {
- /**
- * Creates a new <code>AuthenticationRequiredException</code> instance.
- */
- public AuthenticationRequiredException() {
- super("Authentication required");
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/grid/src/main/java/org/apache/oodt/grid/ConfigBean.java
----------------------------------------------------------------------
diff --git a/grid/src/main/java/org/apache/oodt/grid/ConfigBean.java b/grid/src/main/java/org/apache/oodt/grid/ConfigBean.java
deleted file mode 100755
index ef4ca62..0000000
--- a/grid/src/main/java/org/apache/oodt/grid/ConfigBean.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.grid;
-
-import java.io.Serializable;
-import java.util.List;
-import java.util.Properties;
-
-/**
- * Bean containing login status for and configuration info.
- */
-public class ConfigBean implements Serializable {
- /**
- * Return true is administrator is authenticated.
- *
- * @return True if authentic, false otherwise.
- */
- public boolean isAuthentic() {
- return authentic;
- }
-
- /**
- * Set whether the administrator's been authenticated.
- *
- * @param authentic
- * True if authentic, false otherwise.
- */
- void setAuthentic(boolean authentic) {
- this.authentic = authentic;
- }
-
- /**
- * Get any message to display. This should never be null.
- *
- * @return A message to display
- */
- public String getMessage() {
- return message;
- }
-
- /**
- * Set the message to display.
- *
- * @param message
- * Message to display.
- */
- public void setMessage(String message) {
- if (message == null) {
- throw new IllegalArgumentException("message cannot be null");
- }
- this.message = message;
- }
-
- /**
- * Get the configuration of web-grid.
- *
- * @return a <code>Configuration</code> value.
- * @throws AuthenticationRequiredException
- * if the administrator's not authenticated.
- */
- public Configuration getConfiguration()
- throws AuthenticationRequiredException {
- checkAuthenticity();
- return configuration;
- }
-
- /**
- * Tell if HTTPS is required to access the web-grid configuration.
- *
- * @return True if HTTPS is required to access the web-grid configuration.
- * @throws AuthenticationRequiredException
- * if the administrator's not authenticated.
- */
- public boolean isHttpsRequired() throws AuthenticationRequiredException {
- checkAuthenticity();
- return configuration.isHTTPSrequired();
- }
-
- /**
- * Tell if admin access can come only from the localhost.
- *
- * @return True if admin access can come only from the localhost.
- * @throws AuthenticationRequiredException
- * if the administrator's not authenticated.
- */
- public boolean isLocalhostRequired() throws AuthenticationRequiredException {
- checkAuthenticity();
- return configuration.isLocalhostRequired();
- }
-
- /**
- * Get the list of {@link ProductServer}s that have been installed in this
- * container.
- *
- * @return a <code>List</code> of {@link ProductServer}s.
- * @throws AuthenticationRequiredException
- * if the administrator's not authenticated.
- */
- public List getProductServers() throws AuthenticationRequiredException {
- checkAuthenticity();
- return configuration.getProductServers();
- }
-
- /**
- * Get the list of {@link ProfileServer}s that have been installed in this
- * container.
- *
- * @return a <code>List</code> of {@link ProfileServer}s.
- * @throws AuthenticationRequiredException
- * if the administrator's not authenticated.
- */
- public List getProfileServers() throws AuthenticationRequiredException {
- checkAuthenticity();
- return configuration.getProfileServers();
- }
-
- /**
- * Set the configuration this bean will use.
- *
- * @param configuration
- * a <code>Configuration</code> value.
- */
- void setConfiguration(Configuration configuration) {
- this.configuration = configuration;
- }
-
- /**
- * Get the properties defined for this container.
- *
- * @return a <code>Properties</code> value.
- * @throws AuthenticationRequiredException
- * if the administrator's not authenticated.
- */
- public Properties getProperties() throws AuthenticationRequiredException {
- checkAuthenticity();
- return configuration.getProperties();
- }
-
- /**
- * Check if the administrator is authentic. This method does nothing if the
- * administrator is authentic, but throws an exception if not.
- *
- * @throws AuthenticationRequiredException
- * if the administrator's not authenticated.
- */
- private void checkAuthenticity() throws AuthenticationRequiredException {
- if (isAuthentic() && configuration != null) {
- return;
- }
- message = "";
- throw new AuthenticationRequiredException();
- }
-
- /** True if administrator is authentic. */
- private boolean authentic;
-
- /** Any message to display. */
- private String message = "";
-
- /** The configuration for this container. */
- private transient Configuration configuration;
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/grid/src/main/java/org/apache/oodt/grid/ConfigServlet.java
----------------------------------------------------------------------
diff --git a/grid/src/main/java/org/apache/oodt/grid/ConfigServlet.java b/grid/src/main/java/org/apache/oodt/grid/ConfigServlet.java
deleted file mode 100755
index 8a5b0a3..0000000
--- a/grid/src/main/java/org/apache/oodt/grid/ConfigServlet.java
+++ /dev/null
@@ -1,309 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.grid;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * Controller servlet for making changes to configuration.
- */
-public class ConfigServlet extends GridServlet {
- /**
- * Handle updates to a configuration by saving them and directing back to the
- * config page.
- *
- * @param req
- * a <code>HttpServletRequest</code> value.
- * @param res
- * a <code>HttpServletResponse</code> value.
- * @throws ServletException
- * if an error occurs.
- * @throws IOException
- * if an error occurs.
- */
- public void doPost(HttpServletRequest req, HttpServletResponse res)
- throws ServletException, IOException {
- Configuration config = getConfiguration(); // Get the singleton
- // configuration
- if (!approveAccess(config, req, res)) {
- return; // Check if the user can access this page
- }
-
- ConfigBean cb = getConfigBean(req); // Get the bean
- cb.setMessage(""); // Clear out any message
- if (!cb.isAuthentic()) {
- throw new ServletException(new AuthenticationRequiredException());
- }
- boolean needSave = false; // Assume no changes for now
-
- String newPass = req.getParameter("password"); // See if she wants to change
- // password
- if (newPass != null && newPass.length() > 0) { // Got a password, and it's
- // not empty?
- config.setPassword(newPass.getBytes()); // Yes, set its bytes
- needSave = true; // We need to save
- }
-
- boolean https = config.isHTTPSrequired(); // Are we currently using https?
- String httpsParam = req.getParameter("https"); // Get her https param
- boolean newHttps = httpsParam != null && "on".equals(httpsParam); // See if
- // she
- // wants
- // to use
- // https
- // or not
- if (https != newHttps) { // Different?
- config.setHTTPSrequired(newHttps); // Yes, set the new state
- needSave = true; // We need to save
- }
-
- boolean local = config.isLocalhostRequired(); // Are we requiring localhost?
- String localhostParam = req.getParameter("localhost"); // Get her localhost
- // param
- boolean newLocal = localhostParam != null && "on".equals(localhostParam); // See
- // if
- // she
- // wants
- // to
- // require
- // localhost
- if (local != newLocal) { // Different?
- config.setLocalhostRequired(newLocal); // Yes, set the new state
- needSave = true; // We need to save
- }
-
- String newKey = req.getParameter("newkey"); // See if she's got a new
- // property
- if (newKey != null && newKey.length() > 0) { // And make sure it's nonempty
- String newVal = req.getParameter("newval"); // Got one, get its value
- if (newVal == null) {
- newVal = ""; // Make sure it's at least an empty string
- }
- config.getProperties().setProperty(newKey, newVal); // Set the new
- // property
- needSave = true; // We need to save
- }
-
- needSave |= updateProperties(config.getProperties(), // Make any updates to
- // existing property
- req.getParameterMap()); // values, and see note if we need to save
- try {
- needSave |= updateServers(config, req.getParameterMap(), 'd'); // Same
- // goes for
- // product
- // servers
- needSave |= updateServers(config, req.getParameterMap(), 'm'); // And
- // profile
- // servers
- needSave |= updateCodeBases(config, req.getParameterMap()); // And for
- // code bases
- } catch (MalformedURLException ex) { // Make sure code base URLs are OK
- cb.setMessage("Code bases must be valid URLs (" // Not OK?
- + ex.getMessage() + "); no changes made"); // Let user know via a
- // message
- req.getRequestDispatcher("config.jsp").forward(req, res); // And make no
- // changes until
- // she fixes it
- return;
- }
-
- if (needSave) { // Do we need to save?
- config.save(); // Then do it already!
- cb.setMessage("Changes saved."); // And let the user know
- } else {
- cb.setMessage("No changes made."); // Oh, no changes were made, let user
- // know
- }
- req.getRequestDispatcher("config.jsp").forward(req, res); // Back to the
- // config page
- }
-
- /**
- * Update changes to the code bases.
- *
- * @param config
- * a <code>Configuration</code> value.
- * @param params
- * a <code>Map</code> value.
- * @return True if changes need to be saved.
- * @throws MalformedURLException
- * if an error occurs.
- */
- private boolean updateCodeBases(Configuration config, Map params)
- throws MalformedURLException {
- boolean needSave = false; // Assume no change
- List codeBases = config.getCodeBases(); // Get the current code bases
-
- List toRemove = new ArrayList(); // Hold indexes of code bases to remove
- for (Object o : params.entrySet()) { // For each
- // parameter
- Map.Entry entry = (Map.Entry) o; // Get its entry
- String key = (String) entry.getKey(); // And its name
- String value = ((String[]) entry.getValue())[0]; // And its zeroth value
- if (key.startsWith("delcb-") && "on".equals(value)) { // If it's checked
- Integer index = Integer.valueOf(key.substring(6)); // Parse out the index
- toRemove.add(index); // Add it to the list
- }
- }
- if (!toRemove.isEmpty()) { // And if we have any indexes
- Collections.sort(toRemove); // Sort 'em and put 'em in reverse ...
- Collections.reverse(toRemove); // ... order so we can safely remove them
- for (Object aToRemove : toRemove) { // For each index
- // to remove
- int index = (Integer) aToRemove; // Get the index value
- codeBases.remove(index); // And buh-bye.
- }
- needSave = true; // Definitely need to save changes now
- }
-
- String[] newCBs = (String[]) params.get("newcb"); // Was there a new code
- // base specified?
- if (newCBs != null && newCBs.length == 1) { // And was there exactly one
- // value?
- String newCB = newCBs[0]; // Get that exactly one value
- if (newCB != null && newCB.length() > 0) { // Is it nonnull and nonempty?
- URL newURL = new URL(newCB); // Treat is as an URL
- codeBases.add(newURL); // Add it to the list
- needSave = true; // Ad we gotta save
- }
- }
- return needSave;
- }
-
- /**
- * Update the list of product/profile servers based on request parameters.
- *
- * @param config
- * System configuration
- * @param params
- * Request parameters.
- * @param type
- * <code>d</code> (data) if product servers, <code>m</code>
- * (metadata) if profile servers
- * @return True if any changes were made, false if no changes were made
- */
- private boolean updateServers(Configuration config, Map params, char type) {
- List servers = type == 'd' ? config.getProductServers() : config
- .getProfileServers();
- boolean needSave = false; // Assume no changes for now
-
- List toRemove = new ArrayList(); // Start with empty list of indexes to
- // remove
- for (Object o : params.entrySet()) { // Go
- // through
- // each
- // parameter
- Map.Entry entry = (Map.Entry) o; // Get its key/value
- String name = (String) entry.getKey(); // The key is a String
- if (name.startsWith(type + "rm-")) { // Is it an "drm-" or "mrm-"?
- Integer index = Integer.valueOf(name.substring(4)); // Yes, get it sindex
- toRemove.add(index); // Add it to the list
- }
- }
-
- if (!toRemove.isEmpty()) { // Got any to remove?
- Collections.sort(toRemove); // We need to go through them in reverse ord-
- Collections.reverse(toRemove); // -er, so that removals don't shift
- // indexes
- for (Object aToRemove : toRemove) { // For each index
- int index = (Integer) aToRemove; // Get its int value
- servers.remove(index); // and buh-bye
- }
- needSave = true; // Gotta save after all that, whew.
- }
-
- if (params.containsKey(type + "-newcn")) { // Adding a new server?
- String[] newClasses = (String[]) params.get(type + "-newcn"); // And the
- // new class
- // name
- if (newClasses != null && newClasses.length == 1) { // Are present and
- // there's only one of
- // each
- String newClass = newClasses[0]; // Get the new class
- if (newClass != null && newClass.length() > 0) { // And nonempty
- Server server;
- if (type == 'd') // If it's data
- {
- server = new ProductServer(config, newClass); // It's a product
- }
-// server
- else
- // otherwise it's metadata
- {
- server = new ProfileServer(config, newClass); // Which is a profile
- }
- // server
- servers.add(server); // Add it to the set of servers
- needSave = true; // And after all this, we need to save!
- }
- }
- }
-
- return needSave;
- }
-
- /**
- * Update properties based on request parameters.
- *
- * @param props
- * <code>Properties</code> to update
- * @param params
- * Request parameters
- * @return True if changes need to be saved, false otherwise
- */
- private boolean updateProperties(Properties props, Map params) {
- boolean needSave = false; // Assume no save for now
- for (Object o : params.entrySet()) { // Go
- // through
- // each
- // request
- // parameter
- Map.Entry entry = (Map.Entry) o; // Get the key/value
- String name = (String) entry.getKey(); // Key is always a string
- String newValue = ((String[]) entry.getValue())[0]; // Value is String[],
- // get the zeroth
- if (name.startsWith("val-")) { // If the param is "val-"
- String key = name.substring(4); // Then find the key
- if (props.containsKey(key)) { // If that key exists
- String value = props.getProperty(key); // Find its value
- if (value == null || !value.equals(newValue)) {// Are they different?
- props.setProperty(key, newValue); // Yes, set the new value
- needSave = true; // And we need to save
- }
- }
- } else if (name.startsWith("del-")) { // If the param is "del-"
- String key = name.substring(4); // Then find the key
- if (props.containsKey(key)) { // If that key exists
- props.remove(key); // Then remove its mapping
- needSave = true; // And we need to save
- }
- }
- }
- return needSave;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/grid/src/main/java/org/apache/oodt/grid/Configuration.java
----------------------------------------------------------------------
diff --git a/grid/src/main/java/org/apache/oodt/grid/Configuration.java b/grid/src/main/java/org/apache/oodt/grid/Configuration.java
deleted file mode 100755
index ed82943..0000000
--- a/grid/src/main/java/org/apache/oodt/grid/Configuration.java
+++ /dev/null
@@ -1,463 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.grid;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.Serializable;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Text;
-import org.xml.sax.SAXException;
-
-import org.apache.oodt.commons.util.Base64;
-
-/**
- * web-grid configuration. This holds all the runtime configuration of profile servers,
- * product servers, properties, and other settings for the web-grid container.
- *
- */
-public class Configuration implements Serializable {
- /**
- * Creates a new <code>Configuration</code> instance.
- *
- * @param file File containing the serialized configuration.
- * @throws IOException if an I/O error occurs.
- * @throws SAXException if the file can't be parsed.
- */
- public Configuration(File file) throws IOException, SAXException {
- this.file = file;
- if (file.isFile() && file.length() > 0) {
- parse(file);
- }
- }
-
- /**
- * Convert the configuration to XML.
- *
- * @param owner Owning document.
- * @return XML representation of this configuration.
- */
- public Node toXML(Document owner) {
- Element elem = owner.createElement("configuration"); // <configuration>
- elem.setAttribute("xmlns", NS); // Set default namespace
- elem.setAttribute("https", httpsRequired? "true" : "false"); // Add https attribute
- elem.setAttribute("localhost", localhostRequired? "true" : "false"); // Add localhost attribute
-
- if (password != null && password.length > 0) // If we have a password
- {
- elem.setAttribute("password", encode(password)); // Add passowrd attribute
- }
-
- for (Object productServer : productServers) { // For each product server
- ProductServer ps = (ProductServer) productServer; // Get the product server
- elem.appendChild(ps.toXML(owner)); // And add it under <configuration>
- }
-
- for (Object profileServer : profileServers) { // For each profile server
- ProfileServer ps = (ProfileServer) profileServer; // Get the profile server
- elem.appendChild(ps.toXML(owner)); // And add it under the <configuration>
- }
-
- if (!codeBases.isEmpty()) { // Got any code bases?
- Element cbs = owner.createElement("codeBases"); // Boo yah. Make a parent for 'em
- elem.appendChild(cbs); // Add parent
- for (Object codeBase : codeBases) { // Then, for each code base
- URL url = (URL) codeBase; // Get the URL to it
- Element cb = owner.createElement("codeBase"); // And make a <codeBase> for it
- cb.setAttribute("url", url.toString()); // And an "url" attribute
- cbs.appendChild(cb); // Add it
- }
- }
-
- if (!properties.isEmpty()) { // If we have any properties>
- Element props = owner.createElement("properties"); // Add <properties> under <configuration>
- props.setAttribute("xml:space", "preserve"); // And make sure space is properly preserved
- elem.appendChild(props); // Add the space attribute
- for (Map.Entry<Object, Object> objectObjectEntry : properties.entrySet()) { // For each property
- Map.Entry entry =
- (Map.Entry) objectObjectEntry; // Get the property key/value pair
- String key = (String) entry.getKey(); // Key is always a String
- String value = (String) entry.getValue(); // So is the value
- Element prop = owner.createElement("property"); // Create a <property> element
- props.appendChild(prop); // Add it under the <properties>
- prop.setAttribute("key", key); // Set the key as an attribute
- Text text = owner.createTextNode(value); // Make text to hold the value
- prop.appendChild(text); // Add it under the <property>
- }
- }
- return elem;
- }
-
- /**
- * Get the properties.
- *
- * @return a <code>Properties</code> value.
- */
- public Properties getProperties() {
- return properties;
- }
-
- /**
- * Is localhost access required for the configuration?
- *
- * @return True if the configuration must be accessed from the localhost, false otherwise.
- */
- public boolean isLocalhostRequired() {
- return localhostRequired;
- }
-
- /**
- * Is https access required for the configuration?
- *
- * @return True if the configuration must be accessed via https, false if http is OK.
- */
- public boolean isHTTPSrequired() {
- return httpsRequired;
- }
-
- /**
- * Set if https is required to access the configuration.
- *
- * @param required True if the configuration must be accessed via https, false if http is OK.
- */
- public void setHTTPSrequired(boolean required) {
- httpsRequired = required;
- }
-
- /**
- * Set if localhost is required to access the configuration.
- *
- * @param required True if the configuration must be accessed from the localhost, false otherwise.
- */
- public void setLocalhostRequired(boolean required) {
- localhostRequired = required;
- }
-
- /**
- * Return the code bases.
- *
- * @return a <code>List</code> of {@link URL}s.
- */
- public List getCodeBases() {
- return codeBases;
- }
-
- /**
- * Get the product servers.
- *
- * @return a <code>List</code> of {@link ProductServer}s.
- */
- public List getProductServers() {
- return productServers;
- }
-
- /**
- * Get the profile servers.
- *
- * @return a <code>List</code> of {@link ProfileServer}s.
- */
- public List getProfileServers() {
- return profileServers;
- }
-
- /**
- * Get the administrator password.
- *
- * @return Administrator password.
- */
- public byte[] getPassword() {
- return password;
- }
-
- /**
- * Set the administrator password.
- *
- * @param password Administrator password.
- */
- public void setPassword(byte[] password) {
- if (password == null) {
- throw new IllegalArgumentException("Non-null passwords not allowed");
- }
- this.password = password;
- }
-
- /**
- * Save the configuration.
- *
- * @throws IOException if an I/O error occurs.
- */
- public synchronized void save() throws IOException {
- BufferedWriter writer = null; // Start w/no writer
- try { // Then try ...
- writer = new BufferedWriter(new FileWriter(file)); // Create a writer
- Document doc; // As for the doc...
- synchronized (DOCUMENT_BUILDER) { // Using the document builder...
- doc = DOCUMENT_BUILDER.newDocument(); // Create an empty document
- }
- Node root = toXML(doc); // Convert this config to XML
- doc.appendChild(root); // Add it to the doc
- DOMSource source = new DOMSource(doc); // Use the source Luke
- StreamResult result = new StreamResult(writer); // And serialize it to the writer
- TRANSFORMER.transform(source, result); // Serialize
- } catch (TransformerException ex) {
- throw new IllegalStateException("Unexpected TransformerException: " + ex.getMessage());
- } finally {
- if (writer != null) {
- try { // And if we got a writer, try ...
- writer.close(); // to close it
- } catch (IOException ignore) {
- } // Ignoring any error
- }
- }
- }
-
- /**
- * Parse a serialized configuration document.
- *
- * @param file File to parse
- * @throws IOException if an I/O error occurs.
- * @throws SAXException if a parse error occurs.
- */
- private void parse(File file) throws IOException, SAXException {
- Document doc; // Start with a doc ...
- synchronized (DOCUMENT_BUILDER) { // And using the DOCUMENT_BUILDER
- doc = DOCUMENT_BUILDER.parse(file); // Try to parse the file
- }
- Element root = doc.getDocumentElement(); // Assume the root element is <configuration>
-
- String httpsAttr = root.getAttribute("https"); // Get the https attribute
- httpsRequired = httpsAttr != null && "true".equals(httpsAttr); // See if it's "true"
-
- String localhostAttr = root.getAttribute("localhost"); // Get the localhost attribute
- localhostRequired = localhostAttr != null && "true".equals(localhostAttr); // See if it's "true"
-
- String passwordAttr = root.getAttribute("password"); // Get the password attribute
- if (passwordAttr != null && passwordAttr.length() > 0) // If it's there, and non-empty
- {
- password = decode(passwordAttr); // Then decode it
- }
-
- NodeList children = root.getChildNodes(); // Get the child nodes
- for (int i = 0; i < children.getLength(); ++i) { // For each child node
- Node child = children.item(i); // Get the child
- if (child.getNodeType() == Node.ELEMENT_NODE) { // An element?
- if ("server".equals(child.getNodeName())) { // A <server>?
- Server server = Server.create(this, (Element) child); // Create the correct server
-
- // Keep these in separate sets?
- if (server instanceof ProductServer) // Is a product server?
- {
- productServers.add(server); // Add to product servers
- } else if (server instanceof ProfileServer) // Is a profile server?
- {
- profileServers.add(server); // Add to profile servers
- } else {
- throw new IllegalArgumentException("Unexpected server type " + server + " in " + file);
- }
- } else if ("properties".equals(child.getNodeName())) { // Is it a <properties>?
- NodeList props = child.getChildNodes(); // Get its children
- for (int j = 0; j < props.getLength(); ++j) { // For each child
- Node node = props.item(j); // Get the chld
- if (node.getNodeType() == Node.ELEMENT_NODE // And element?
- && "property".equals(node.getNodeName())) { // And it's <property>?
- Element propNode = (Element) node; // Great, use it as an element
- String key = propNode.getAttribute("key"); // Get its key attribute
- if (key == null || key.length() == 0) // Make sure it's there
- {
- throw new SAXException("Required 'key' attribute missing from "
- + "<property> element");
- }
- properties.setProperty(key, text(propNode)); // And set it
- }
- }
- } else if ("codeBases".equals(child.getNodeName())) { // And yadda
- NodeList cbs = child.getChildNodes(); // yadda
- for (int j = 0; j < cbs.getLength(); ++j) { // yadda.
- Node node = cbs.item(j);
- if (node.getNodeType() == Node.ELEMENT_NODE
- && "codeBase".equals(node.getNodeName())) {
- Element cbNode = (Element) node;
- String u = cbNode.getAttribute("url");
- if (u == null || u.length() == 0) {
- throw new SAXException("Required 'url' attribute missing from "
- + "<codeBase> element");
- }
- try {
- codeBases.add(new URL(u));
- } catch (MalformedURLException ex) {
- throw new SAXException("url attribute " + u + " isn't a valid URL");
- }
- }
- }
- }
- }
- }
- }
-
- /**
- * Encode a password. This just hides it so it's not plain text, but it's just as
- * easy to decode it if you have a base-64 decoder handy.
- *
- * @param password a <code>byte[]</code> value.
- * @return a <code>String</code> value.
- */
- static String encode(byte[] password) {
- return new String(Base64.encode(password));
- }
-
- /**
- * Decode a password.
- *
- * @param password a <code>String</code> value.
- * @return a <code>byte[]</code> value.
- */
- static byte[] decode(String password) {
- return Base64.decode(password.getBytes());
- }
-
- /**
- * Get the text under an XML node.
- *
- * @param node a <code>Node</code> value.
- * @return a <code>String</code> value.
- */
- private static String text(Node node) {
- StringBuffer b = new StringBuffer();
- text0(node, b);
- return b.toString();
- }
-
- /**
- * Get the text from an XML node into a StringBuffer.
- *
- * @param node a <code>Node</code> value.
- * @param b a <code>StringBuffer</code> value.
- */
- private static void text0(Node node, StringBuffer b) {
- NodeList children = node.getChildNodes();
- for (int i = 0; i < children.getLength(); ++i) {
- text0(children.item(i), b);
- }
- short type = node.getNodeType();
- if (type == Node.CDATA_SECTION_NODE || type == Node.TEXT_NODE) {
- b.append(node.getNodeValue());
- }
- }
-
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- }
- if (obj instanceof Configuration) {
- Configuration rhs = (Configuration) obj;
- return codeBases.equals(rhs.codeBases) && productServers.equals(rhs.productServers)
- && profileServers.equals(rhs.profileServers) && Arrays.equals(password, rhs.password)
- && httpsRequired == rhs.httpsRequired && localhostRequired == rhs.localhostRequired
- && properties.equals(rhs.properties);
- }
- return false;
- }
-
- public int hashCode() {
- return codeBases.hashCode() ^ productServers.hashCode() ^ profileServers.hashCode();
- }
-
- /** List of {@link URL}s to code bases. */
- private List codeBases = new ArrayList();
-
- /** List of {@link ProductServer}s. */
- private List productServers = new ArrayList();
-
- /** List of {@link ProfileServer}s. */
- private List profileServers = new ArrayList();
-
- /** Admin password. */
- private byte[] password = DEFAULT_PASSWORD;
-
- /** True if https is requried. */
- private boolean httpsRequired;
-
- /** True if localhost access is required. */
- private boolean localhostRequired;
-
- /** Properties to set. */
- private Properties properties = new Properties();
-
- /** Where to save the file. */
- private transient File file;
-
- /** Default password. */
- static final byte[] DEFAULT_PASSWORD = { (byte)'h', (byte)'a', (byte)'n', (byte)'a', (byte)'l', (byte)'e', (byte)'i' };
-
- /** XML namespace */
- public static final String NS = "http://oodt.jpl.nasa.gov/web-grid/ns/";
-
- /** Sole document builder we'll need. */
- private static final DocumentBuilder DOCUMENT_BUILDER;
-
- /** Sole transfomer we'll need. */
- private static final Transformer TRANSFORMER;
-
- static {
- try {
- DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
- documentBuilderFactory.setNamespaceAware(true);
- documentBuilderFactory.setValidating(false);
- documentBuilderFactory.setIgnoringElementContentWhitespace(false);
- documentBuilderFactory.setExpandEntityReferences(true);
- documentBuilderFactory.setIgnoringComments(true);
- documentBuilderFactory.setCoalescing(true);
- DOCUMENT_BUILDER = documentBuilderFactory.newDocumentBuilder();
-
- TransformerFactory transformerFactory = TransformerFactory.newInstance();
- TRANSFORMER = transformerFactory.newTransformer();
- TRANSFORMER.setOutputProperty(OutputKeys.METHOD, "xml");
- TRANSFORMER.setOutputProperty(OutputKeys.VERSION, "1.0");
- TRANSFORMER.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
- TRANSFORMER.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
- TRANSFORMER.setOutputProperty(OutputKeys.INDENT, "yes");
- TRANSFORMER.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
- } catch (ParserConfigurationException ex) {
- throw new IllegalStateException("Cannot create document builder");
- } catch (TransformerConfigurationException ex) {
- throw new IllegalStateException("Cannot create transformer");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/grid/src/main/java/org/apache/oodt/grid/GridServlet.java
----------------------------------------------------------------------
diff --git a/grid/src/main/java/org/apache/oodt/grid/GridServlet.java b/grid/src/main/java/org/apache/oodt/grid/GridServlet.java
deleted file mode 100755
index 8f5ccdd..0000000
--- a/grid/src/main/java/org/apache/oodt/grid/GridServlet.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.grid;
-
-import java.io.File;
-import java.io.IOException;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-import org.xml.sax.SAXException;
-
-/**
- * Grid servlet is an abstract servlet that provides basic behavior (configuration access)
- * for grid servlets.
- */
-public abstract class GridServlet extends HttpServlet {
- /**
- * By default, grid servlets are POST only, so GETs get you the welcome page.
- *
- * @param req a <code>HttpServletRequest</code> value.
- * @param res a <code>HttpServletResponse</code> value.
- * @throws IOException if an error occurs.
- * @throws ServletException if an error occurs.
- */
- public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException {
- req.getRequestDispatcher("index.html").forward(req, res);
- }
-
- /**
- * Get the configuration.
- *
- * @return a <code>Configuration</code> value.
- * @throws ServletException if an error occurs.
- * @throws IOException if an error occurs.
- */
- protected Configuration getConfiguration() throws ServletException, IOException {
- if (configuration != null) {
- return configuration;
- }
- String path = getServletContext().getInitParameter("org.apache.oodt.grid.GridServlet.config");
- if (path == null) {
- path = getServletContext().getRealPath("/WEB-INF/config.xml");
- }
- if (path == null) {
- throw new ServletException("The config.xml file can't be accessed. Are we running from a war file!??!");
- }
- File file = new File(path);
- Configuration c;
- try {
- c = new Configuration(file);
- } catch (SAXException ex) {
- throw new ServletException("Cannot parse config.xml file", ex);
- }
- synchronized (GridServlet.class) {
- while (configuration == null) {
- configuration = c;
- }
- }
- return configuration;
- }
-
- /**
- * Get the config bean.
- *
- * @param req a <code>HttpServletRequest</code> value.
- * @return a <code>ConfigBean</code> value.
- * @throws ServletException if an error occurs.
- * @throws IOException if an error occurs.
- */
- protected ConfigBean getConfigBean(HttpServletRequest req) throws ServletException, IOException {
- HttpSession session = req.getSession(/*create*/true);
- ConfigBean cb = (ConfigBean) session.getAttribute("cb");
- if (cb == null) {
- cb = new ConfigBean();
- session.setAttribute("cb", cb);
- }
- Configuration config = getConfiguration();
- cb.setConfiguration(config);
- return cb;
- }
-
- /**
- * Check if administrative access is allowed. This examines the request scheme
- * (http, ftp, https, etc.) and sees if https is required by the configuration.
- * It also checks the remote host and sees if localhost access is required.
- *
- * @param config a <code>Configuration</code> value.
- * @param req a <code>HttpServletRequest</code> value.
- * @param res a <code>HttpServletResponse</code> value.
- * @return True if access is approved, false otherwise.
- * @throws IOException if an error occurs.
- */
- protected boolean approveAccess(Configuration config, HttpServletRequest req, HttpServletResponse res) throws IOException {
- if (config.isHTTPSrequired() && !"https".equals(req.getScheme())) {
- res.sendError(HttpServletResponse.SC_FORBIDDEN, "https required");
- return false;
- }
-
- if (config.isLocalhostRequired() && !Utility.isLocalhost(req.getRemoteHost())) {
- res.sendError(HttpServletResponse.SC_FORBIDDEN, "localhost access only");
- return false;
- }
-
- return true;
- }
-
- /** Singleton configuration. */
- private static volatile Configuration configuration;
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/grid/src/main/java/org/apache/oodt/grid/LoginServlet.java
----------------------------------------------------------------------
diff --git a/grid/src/main/java/org/apache/oodt/grid/LoginServlet.java b/grid/src/main/java/org/apache/oodt/grid/LoginServlet.java
deleted file mode 100755
index 01e186a..0000000
--- a/grid/src/main/java/org/apache/oodt/grid/LoginServlet.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.grid;
-
-import java.io.IOException;
-import java.util.Arrays;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * Controller servlet that authenticates the administrator password.
- *
- */
-public class LoginServlet extends GridServlet {
- /**
- * Handle authentication from an administrator.
- *
- * @param req a <code>HttpServletRequest</code> value.
- * @param res a <code>HttpServletResponse</code> value.
- * @throws ServletException if an error occurs.
- * @throws IOException if an error occurs.
- */
- public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
- Configuration config = getConfiguration(); // Get configuration
- if (!approveAccess(config, req, res)) {
- return; // Do https, localhost checking first
- }
-
- ConfigBean cb = getConfigBean(req); // Get bean
- if (cb.isAuthentic()) { // Already authentic?
- req.getRequestDispatcher("config.jsp").forward(req, res); // Back to the config page with you!
- return;
- }
-
- String password = req.getParameter("password"); // Get submitted password
- if (password == null) {
- password = ""; // If none, use an empty string
- }
- byte[] bytes = password.getBytes(); // Get the bytes
- if (!Arrays.equals(config.getPassword(), bytes)) { // Compare to stored password bytes
- cb.setMessage("Password incorrect"); // Not equal! Set message.
- throw new ServletException(new AuthenticationRequiredException());
- } else {
- cb.setMessage(""); // Equal, clear message
- cb.setAuthentic(true); // You are now authenticated
- req.getRequestDispatcher("config.jsp").forward(req, res); // To the config page with you!
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/grid/src/main/java/org/apache/oodt/grid/ProductQueryServlet.java
----------------------------------------------------------------------
diff --git a/grid/src/main/java/org/apache/oodt/grid/ProductQueryServlet.java b/grid/src/main/java/org/apache/oodt/grid/ProductQueryServlet.java
deleted file mode 100755
index 20408af..0000000
--- a/grid/src/main/java/org/apache/oodt/grid/ProductQueryServlet.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.grid;
-
-import org.apache.oodt.product.HttpRedirectException;
-import org.apache.oodt.product.LargeProductQueryHandler;
-import org.apache.oodt.product.ProductException;
-import org.apache.oodt.product.QueryHandler;
-import org.apache.oodt.product.Retriever;
-import org.apache.oodt.xmlquery.LargeResult;
-import org.apache.oodt.xmlquery.Result;
-import org.apache.oodt.xmlquery.XMLQuery;
-
-import java.io.BufferedInputStream;
-import java.io.IOException;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-
-/**
- * Product query servlet handles product queries. It always returns the first matching
- * product, if any. If no handler can provide a product, it returns 404 Not Found. If
- * there are no query handlers, it returns 404 Not Found.
- *
- */
-public class ProductQueryServlet extends QueryServlet {
-
- public static final int INT = 512;
-
- /** {@inheritDoc} */
- protected List getServers(Configuration config) {
- return config.getProductServers();
- }
-
- /** {@inheritDoc} */
- protected void handleQuery(XMLQuery query, List handlers, HttpServletRequest req, HttpServletResponse res)
- throws IOException {
- if (handlers.isEmpty()) {
- res.sendError(HttpServletResponse.SC_NOT_FOUND, "no query handlers available to handle query");
- return;
- }
-
- try { // OK, let's try
- for (Object handler1 : handlers) { // Try each query handler
- QueryHandler handler = (QueryHandler) handler1; // Get the query handler
- query = handler.query(query); // Give it the query
- if (!query.getResults().isEmpty()) { // Did it give any result?
- Result result = (Result) query.getResults().get(0); // Yes, get the result
- deliverResult(handler, result, res); // And deliver it
- return; // Done!
- }
- }
- } catch (ProductException ex) {
- if (ex instanceof HttpRedirectException) {
- HttpRedirectException hre = (HttpRedirectException) ex;
- res.sendRedirect(hre.getLocation());
- } else {
- res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, ex.getMessage());
- }
- return;
- }
-
- res.sendError(HttpServletResponse.SC_NOT_FOUND, "no matching products from any query handler");
- }
-
- /**
- * Deliver a result. This streams the product data.
- *
- * @param handler Which handler produced the result.
- * @param result The result.
- * @param res The HTTP response to which to send the result data.
- * @throws IOException if an error occurs.
- */
- private void deliverResult(QueryHandler handler, Result result, HttpServletResponse res) throws IOException {
- characterize(handler, result, res); // First, describe it using HTTP headers
- if (result instanceof LargeResult) { // Is it a large result?
- LargeResult lr = (LargeResult) result; // Yes, this is gonna take some special work
- LargeProductQueryHandler lpqh = (LargeProductQueryHandler) handler; // First treat 'em as large
- ProductRetriever retriever = new ProductRetriever(lpqh); // Large ones need a retriever
- lr.setRetriever(retriever); // Set the retriever
- }
- BufferedInputStream in = null; // Start with no input stream
- try { // Then try ...
- in = new BufferedInputStream(result.getInputStream()); // To open the input stream
- byte[] buf = new byte[INT]; // And a byte buffer for data
- int num; // And a place to count data
- while ((num = in.read(buf)) != -1) // While we read
- {
- res.getOutputStream().write(buf, 0, num); // We write
- }
- res.getOutputStream().flush(); // Flush to commit response
- } finally { // And finally
- if (in != null) {
- try { // If we opened it
- in.close(); // Close it
- } catch (IOException ignore) {
- } // Ignoring any error during closing
- }
- } // Because come on, it's just closing!
- } // For fsck's sake!
-
- /**
- * Characterize a result by using HTTP headers.
- *
- * @param result Result to characterize.
- * @param res HTTP response to set headers in.
- */
- private void characterize(QueryHandler handler, Result result, HttpServletResponse res) {
- String contentType = result.getMimeType(); // Grab the content type
- res.setContentType(contentType); // Set it
- long size = result.getSize(); // Grab the size
- if (size >= 0) {
- res.addHeader("Content-Length", String.valueOf(size)); // Don't use setContentLength(int)
- }
- if (!displayable(contentType)) // Finally, if a browser can't show it
- {
- this.suggestFilename(handler, result, res); // Then suggest a save-as filename
- }
- }
-
- /**
- * Tell if a result is displayable. This compares its MIME type to a list of MIME
- * types commonly displayble by browsers.
- *
- * @param contentType MIME type.
- * @return a <code>boolean</code> value.
- */
- protected static boolean displayable(String contentType) {
- for (String DISPLAYABLE_TYPE : DISPLAYABLE_TYPES) {
- if (DISPLAYABLE_TYPE.equals(contentType)) {
- return true; // Does it match?
- }
- }
- return false; // None of 'em do, it's not displayable
- }
-
- /**
- * We can suggest a filename (if the client happens to be a browser) using a
- * content-disposition header.
- *
- * @param res a <code>HttpServletResponse</code> value.
- */
- protected void suggestFilename(QueryHandler handler, Result result, HttpServletResponse res) {
-
- String resource = result.getResourceID();
- if (resource == null || resource.length() == 0) {
- resource = "product.dat";
- }
-
- // suggest some names based on resource mime type
- String contentType = res.getContentType();
-
- // "zip" mime types
- if (contentType!=null) {
- if (contentType.equals("application/x-compressed") ||
- contentType.equals("application/x-zip-compressed") ||
- contentType.equals("application/zip") ||
- contentType.equals("multipart/x-zip") ) {
-
- // resource = resource.replaceAll("\\..+",".zip"); // replace extension with .zip
- resource = "products_" + resource + ".zip";
- }
- }
-
- // set "Content-disposition" header
- res.addHeader("Content-disposition", "attachment; filename=\"" + resource + "\"");
-
- }
-
- /**
- * MIME types commonly displayable by browsers.
- */
- private static final String[] DISPLAYABLE_TYPES = {
- "text/plain", "text/richtext", "text/enriched", "text/tab-separated-values", "text/html", "text/xml", "text/rtf",
- "message/rfc822", "message/partial", "message/external-body", "message/news", "message/http",
- "message/delivery-status", "message/disposition-notification", "message/s-http", "application/rtf",
- "application/pdf", "image/jpeg", "image/gif", "image/tiff", "image/png", "audio/basic", "audio/32kadpcm",
- "audio/mpeg", "video/mpeg", "video/quicktime"
- };
-
- /**
- * Retriever that retrieves product data over a method call boundary to a large
- * product query handler.
- */
- private static class ProductRetriever implements Retriever {
- /**
- * Creates a new <code>ProductRetriever</code> instance.
- *
- * @param handler a <code>LargeProductQueryHandler</code> value.
- */
- public ProductRetriever(LargeProductQueryHandler handler) {
- this.handler = handler;
- }
-
- /** {@inheritDoc} */
- public byte[] retrieveChunk(String id, long offset, int len) throws ProductException {
- return handler.retrieveChunk(id, offset, len);
- }
-
- /** {@inheritDoc} */
- public void close(String id) {
- handler.close(id);
- }
-
- /** Handler to use. */
- private LargeProductQueryHandler handler;
- }
-}
-
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/grid/src/main/java/org/apache/oodt/grid/ProductServer.java
----------------------------------------------------------------------
diff --git a/grid/src/main/java/org/apache/oodt/grid/ProductServer.java b/grid/src/main/java/org/apache/oodt/grid/ProductServer.java
deleted file mode 100755
index ad16ff4..0000000
--- a/grid/src/main/java/org/apache/oodt/grid/ProductServer.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.grid;
-
-import org.apache.oodt.product.QueryHandler;
-
-/**
- * A product server.
- *
- */
-public class ProductServer extends Server {
- /**
- * Creates a new <code>ProductServer</code> instance.
- *
- * @param configuration System configuration.
- * @param className Class name of query handler.
- */
- public ProductServer(Configuration configuration, String className) {
- super (configuration, className);
- }
-
- /** {@inheritDoc} */
- protected String getType() {
- return "product";
- }
-
- public int hashCode() {
- return super.hashCode() ^ 0xaaaaaaaa;
- }
-
- public boolean equals(Object obj) {
- return super.equals(obj) && obj instanceof ProductServer;
- }
-
- public String toString() {
- return "ProductServer[" + super.toString() + "]";
- }
-
- /**
- * Create a query handler from this server.
- *
- * @return a <code>QueryHandler</code> value.
- * @throws ClassNotFoundException if the class can't be found.
- * @throws InstantiationException if the handler can't be instantiated.
- * @throws IllegalAccessException if the handler has no public constructor.
- */
- public QueryHandler createQueryHandler() throws ClassNotFoundException, InstantiationException, IllegalAccessException {
- return (QueryHandler) createHandler();
- }
-}
[17/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/gui/pstructs/ProfileElementPrinter.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/gui/pstructs/ProfileElementPrinter.java b/profile/src/main/java/org/apache/oodt/profile/gui/pstructs/ProfileElementPrinter.java
deleted file mode 100755
index 3c443ca..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/gui/pstructs/ProfileElementPrinter.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * Created on Jun 25, 2004
- *
- * TODO To change the template for this generated file go to
- * Window - Preferences - Java - Code Generation - Code and Comments
- */
-package org.apache.oodt.profile.gui.pstructs;
-
-import org.apache.oodt.profile.ProfileElement;
-
-/**
- * @author mattmann
- *
- * TODO To change the template for this generated type comment go to
- * Window - Preferences - Java - Code Generation - Code and Comments
- */
-public class ProfileElementPrinter {
- private ProfileElement myProfileElement=null;
-
- /**
- *
- */
- public ProfileElementPrinter(ProfileElement pe) {
- super();
- // TODO Auto-generated constructor stub
- myProfileElement = pe;
- }
-
- public String toXMLString(){
- StringBuilder rStr= new StringBuilder();
-
- rStr.append("<profElement>\n");
- rStr.append("\t<elemName>").append(myProfileElement.getName()).append("</elemName>\n");
- rStr.append("\t<elemMaxOccurrence>").append(myProfileElement.getMaxOccurrence())
- .append("</elemMaxOccurrence>\n");
- rStr.append("\t<elemMaxValue>").append(myProfileElement.getMaxValue()).append("</elemMaxValue>\n");
- rStr.append("\t<elemMinValue>").append(myProfileElement.getMinValue()).append("</elemMinValue>\n");
-
- for (Object o : myProfileElement.getValues()) {
- String theValue = (String) o;
- rStr.append("<elemValue>").append(theValue).append("</elemValue>\n");
- }
- rStr.append("\t<elemComment>").append(myProfileElement.getComments()).append("</elemComment>\n");
- rStr.append("</profElement>\n");
- return rStr.toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/gui/pstructs/ProfilePrinter.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/gui/pstructs/ProfilePrinter.java b/profile/src/main/java/org/apache/oodt/profile/gui/pstructs/ProfilePrinter.java
deleted file mode 100755
index 77989df..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/gui/pstructs/ProfilePrinter.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * Created on Jun 25, 2004
- *
- * TODO To change the template for this generated file go to
- * Window - Preferences - Java - Code Generation - Code and Comments
- */
-package org.apache.oodt.profile.gui.pstructs;
-
-
-import org.apache.oodt.profile.Profile;
-import org.apache.oodt.profile.ProfileElement;
-
-
-/**
- * @author mattmann
- *
- * TODO To change the template for this generated type comment go to
- * Window - Preferences - Java - Code Generation - Code and Comments
- */
-public class ProfilePrinter {
-
- private Profile myProfile=null;
- private String dtdUrl=null;
-
- /**
- * Pretty printing class for a profile, using lightweight, string
- * concatenation classes and methods
- */
- public ProfilePrinter(Profile p,String profDTDURL) {
- super();
- // TODO Auto-generated constructor stub
- myProfile = p;
- dtdUrl = profDTDURL;
- }
-
- public String toXMLString(){
- StringBuilder rStr = new StringBuilder("<?xml version=\"1.0\" ?>\n");
- rStr.append("<!DOCTYPE profile SYSTEM \"").append(dtdUrl).append("\">\n\n");
- rStr.append("<profile>\n");
-
-
- ProfileAttributesPrinter pap = new ProfileAttributesPrinter(myProfile.getProfileAttributes());
- rStr.append(pap.toXMLString());
-
-
- ResourceAttributesPrinter rap = new ResourceAttributesPrinter(myProfile.getResourceAttributes());
- rStr.append(rap.toXMLString());
-
-
- for (String profElemName : myProfile.getProfileElements().keySet()) {
- ProfileElement pe = (ProfileElement) myProfile.getProfileElements().get(profElemName);
- ProfileElementPrinter pPrinter = new ProfileElementPrinter(pe);
- rStr.append(pPrinter.toXMLString());
- }
-
- rStr.append("</profile>\n");
-
- return rStr.toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/gui/pstructs/ResourceAttributesPrinter.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/gui/pstructs/ResourceAttributesPrinter.java b/profile/src/main/java/org/apache/oodt/profile/gui/pstructs/ResourceAttributesPrinter.java
deleted file mode 100755
index 7b9e617..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/gui/pstructs/ResourceAttributesPrinter.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * Created on Jun 18, 2004
- *
- * TODO To change the template for this generated file go to
- * Window - Preferences - Java - Code Generation - Code and Comments
- */
-package org.apache.oodt.profile.gui.pstructs;
-
-import org.apache.oodt.profile.ResourceAttributes;
-
-/**
- * @author mattmann
- *
- * TODO To change the template for this generated type comment go to
- * Window - Preferences - Java - Code Generation - Code and Comments
- */
-public class ResourceAttributesPrinter {
-
- private ResourceAttributes resAttr=null;
-
- /**
- * <p>Constructs a new Resource Attributes printer from a {@link ResourceAttributes}
- * object.</p>
- */
- public ResourceAttributesPrinter(ResourceAttributes r) {
- super();
- // TODO Auto-generated constructor stub
- resAttr = r;
-
- }
-
- public void setResourceAttributes(ResourceAttributes r){resAttr=r;}
- public ResourceAttributes getResourceAttributes(){return resAttr;}
-
- public String toXMLString(){
- StringBuilder rStr=new StringBuilder();
-
- rStr.append("<resAttributes>\n");
-
- rStr.append("\t<Identifier>").append(resAttr.getIdentifier()).append("</Identifier>\n");
- rStr.append("\t<Title>").append(resAttr.getTitle()).append("</Title>\n");
- rStr.append("\t<resClass>").append(resAttr.getResClass()).append("</resClass>\n");
- rStr.append("\t<resAggregation>").append(resAttr.getResAggregation()).append("</resAggregation>\n");
-
- for (String theRight : resAttr.getRights()) {
- rStr.append("\t<Right>").append(theRight).append("</Right>\n");
- }
-
- for (String theSource : resAttr.getSources()) {
- rStr.append("\t<Source>").append(theSource).append("</Source>\n");
- }
-
- for (String theSubject : resAttr.getSubjects()) {
- rStr.append("\t<Subject>").append(theSubject).append("</Subject>\n");
- }
-
- for (String theFormat : resAttr.getFormats()) {
- rStr.append("\t<Format>").append(theFormat).append("</Format>\n");
- }
-
- for (String theCreator : resAttr.getCreators()) {
- rStr.append("\t<Creator>").append(theCreator).append("</Creator>\n");
- }
-
- for (String thePublisher : resAttr.getPublishers()) {
- rStr.append("\t<Publisher>").append(thePublisher).append("</Publisher>\n");
- }
-
- for (String theType : resAttr.getTypes()) {
- rStr.append("\t<Type>").append(theType).append("</Type>\n");
- }
-
- for (String theContext : resAttr.getResContexts()) {
- rStr.append("\t<resContext>").append(theContext).append("</resContext>\n");
- }
-
- for (String theLocation : resAttr.getResLocations()) {
- rStr.append("\t<resLocation>").append(theLocation).append("</resLocation>\n");
- }
-
- for (String theContributor : resAttr.getContributors()) {
- rStr.append("\t<Contributor>").append(theContributor).append("</Contributor>\n");
- }
-
- for (String theCoverage : resAttr.getCoverages()) {
- rStr.append("\t<Coverage>").append(theCoverage).append("</Coverage>\n");
- }
-
- for (String theLang : resAttr.getLanguages()) {
- rStr.append("\t<Language>").append(theLang).append("</Language>\n");
- }
-
- for (String theRelation : resAttr.getRelations()) {
- rStr.append("\t<Relation>").append(theRelation).append("</Relation>\n");
- }
-
- rStr.append("</resAttributes>\n");
-
- return rStr.toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/handlers/DatabaseProfileManager.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/handlers/DatabaseProfileManager.java b/profile/src/main/java/org/apache/oodt/profile/handlers/DatabaseProfileManager.java
deleted file mode 100755
index 6bc5b3c..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/handlers/DatabaseProfileManager.java
+++ /dev/null
@@ -1,277 +0,0 @@
-// 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.
-
-package org.apache.oodt.profile.handlers;
-
-import org.apache.oodt.commons.util.XML;
-import org.apache.oodt.profile.Profile;
-import org.apache.oodt.profile.ProfileException;
-import org.apache.oodt.profile.ProfileSQLException;
-import org.apache.oodt.xmlquery.XMLQuery;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Node;
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.SQLException;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Properties;
-
-/**********************************************************************************
-**
-** DatabaseProfileManager.java
-**
-** @author Dan Crichton
-**
-** date: 11/10/2000
-**
-** description: Map a profile into/out of a relational database
-**
-***********************************************************************************/
-
-public abstract class DatabaseProfileManager implements ProfileManager
-{
- /** Add an element to the given node in an XML document.
- *
- * @param node To what node to add a new element.
- * @param name What the new element should be named.
- * @param value What string value the element should contain; if null, then don't add the element.
- * @throws DOMException If an error occurs.
- */
- private static void add(Node node, String name, String value) throws DOMException {
- if (value == null) {
- return;
- }
- XML.add(node, name, value.trim());
- }
-
- /** Dump profiles in the database.
- *
- * This returns a list containing the contents of the profiles.
- *
- * @return The profiles in the database, as a list.
- * @throws ProfileException If an error occurs.
- */
- public abstract List getProfiles(Connection conn);
-
- Connection conn;
- Properties props;
-
-
- /**********************************************************************
- **
- ** DatabaseProfileManager
- **
- **
- ***********************************************************************/
-
- public DatabaseProfileManager(Properties props) throws Exception {
- this(props, openConnection(props));
- }
-
- public DatabaseProfileManager (Properties props, Connection conn)
- {
- this.conn = conn;
- this.props = props;
- }
-
-
- /**********************************************************************
- **
- ** findProfiles
- **
- ** Returns a list of matching profiles
- **
- ***********************************************************************/
- public List findProfiles(XMLQuery query) throws DOMException, ProfileException
- {
- try
- {
- return(findProfiles(conn, query));
- }
- catch (Exception e)
- {
- throw new ProfileException (e.getMessage());
- }
- }
-
- public abstract List findProfiles(Connection conn, XMLQuery query) throws DOMException;
-
-
- public void add(Profile profile) throws ProfileException {
-
- try
- {
- add(conn, profile);
- conn.commit();
- }
- catch (SQLException e)
- {
- throw new ProfileSQLException (e);
- }
- }
- public abstract void add(Connection conn, Profile profile);
-
-
- public void addAll(Collection collection) throws ProfileException
- {
- try
- {
- addAll(conn, collection);
- conn.commit();
- }
- catch (Exception e)
- {
- try {
- conn.rollback();
- }catch (SQLException se) {
- throw new ProfileSQLException(se);
- }
- throw new ProfileException(e.getMessage());
- }
- }
-
- public abstract void addAll(Connection conn,Collection collection);
-
- public abstract void clear(Connection conn);
-
- public void clear() throws ProfileException
- {
- // Create database connection
-
- try
- {
- clear(conn);
- conn.commit();
- }
- catch (SQLException e)
- {
- throw new ProfileSQLException (e);
- }
- }
- public boolean contains(Profile profile) {
- throw new UnsupportedOperationException("Not yet implemented");
- }
- public boolean containsAll(Collection collection) {
- throw new UnsupportedOperationException("Not yet implemented");
- }
-
- public abstract Profile get(Connection conn, String profID);
-
- public Profile get(String profId) throws ProfileException {
- // Create database connection
-
- return(get(conn, profId));
- }
-
- public Collection getAll() {
- throw new UnsupportedOperationException("Not yet implemented");
- }
- public boolean isEmpty() {
- throw new UnsupportedOperationException("Not yet implemented");
- }
- public Iterator iterator() {
- throw new UnsupportedOperationException("Not yet implemented");
- }
-
- public abstract boolean remove(Connection conn, String profId, String version)
- ;
-
- public abstract boolean remove(Connection conn, String profId);
-
-
- public boolean remove(String profId, String version) throws ProfileException
- {
- // Create database connection
-
- try
- {
- boolean status = remove(conn, profId, version);
- conn.commit();
- return(status);
- }
- catch (SQLException e)
- {
- throw new ProfileSQLException (e);
- }
- }
-
- public boolean remove(String profId) throws ProfileException {
- // Create database connection
-
- try
- {
- boolean status = remove(conn, profId);
- conn.commit();
- return(status);
- }
- catch (SQLException e)
- {
- throw new ProfileSQLException (e);
- }
- }
-
- public int size() {
- return(size(conn));
-
- }
-
- public abstract int size(Connection conn);
-
- public void replace(Profile profile) throws ProfileException {
- // Create database connection
-
- try
- {
- replace(conn, profile);
- conn.commit();
- }
- catch (Exception e)
- {
- throw new ProfileException(e.getMessage());
- }
- }
- public abstract void replace(Connection conn, Profile profile);
-
- protected static Connection openConnection(Properties props) throws SQLException, ProfileException
- {
- // load JDBC driver
- String driver = props.getProperty("org.apache.oodt.util.JDBC_DB.driver","oracle.jdbc.driver.OracleDriver");
- try {
- System.err.println("Attempting to load class " + driver);
- Class.forName(driver);
- System.err.println("Loaded " + driver);
- } catch (ClassNotFoundException e) {
- throw new ProfileException("Can't load JDBC driver \"" + driver + "\": " +e.getMessage());
- }
-
- // get connection
- String url = props.getProperty("org.apache.oodt.util.JDBC_DB.url", "jdbc:oracle:@");
- String database = props.getProperty("org.apache.oodt.util.JDBC_DB.database");
- if(database != null) {
- url += database;
- }
-
- Connection conn = DriverManager.getConnection(url,
- props.getProperty("org.apache.oodt.util.JDBC_DB.user"),
- props.getProperty("org.apache.oodt.util.JDBC_DB.password"));
-
- conn.setAutoCommit(false);
- return conn;
- }
-}
-
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/handlers/ProfileHandler.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/handlers/ProfileHandler.java b/profile/src/main/java/org/apache/oodt/profile/handlers/ProfileHandler.java
deleted file mode 100644
index b7cf85a..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/handlers/ProfileHandler.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile.handlers;
-
-import org.apache.oodt.profile.Profile;
-import org.apache.oodt.profile.ProfileException;
-import org.apache.oodt.xmlquery.XMLQuery;
-
-import java.util.List;
-
-/**
- * Interface of a profile handler.
- *
- * A profile handler can search for profiles or retrieve a single profile by its ID.
- *
- * @author Kelly
- * @version $Revision: 1.2 $
- */
-public interface ProfileHandler {
- /**
- * Find a set of profiles that match the given <var>query</var>.
- *
- * This method searchs the profiles provided by this profile service provider
- * based on criteria in the <var>query</var>. It returns an XML document
- * describing the profiles and profile elements that match.
- *
- * @param query Search criteria.
- * @return List of matching {@link Profile} objects.
- * @throws ProfileException If any other error occurs.
- */
- List findProfiles(XMLQuery query) throws ProfileException;
-
- /**
- * Get a profile.
- *
- * @param profID ID of the profile to get.
- * @return The profile with the given <var>profID</var>, or null if it's not found.
- * @throws ProfileException If any error occurs.
- */
- Profile get(String profID) throws ProfileException;
-
- /**
- * Get my ID.
- *
- * @return A string that identifies this profile handler in some way.
- */
- String getID();
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/handlers/ProfileManager.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/handlers/ProfileManager.java b/profile/src/main/java/org/apache/oodt/profile/handlers/ProfileManager.java
deleted file mode 100755
index ea628cb..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/handlers/ProfileManager.java
+++ /dev/null
@@ -1,149 +0,0 @@
-// 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.
-
-package org.apache.oodt.profile.handlers;
-
-import org.apache.oodt.profile.Profile;
-import org.apache.oodt.profile.ProfileException;
-
-import java.util.Collection;
-import java.util.Iterator;
-
-/**
- * Interface of a profile manager.
- *
- * A profile manager can manage profiles by adding, removing, and manipulating them---in
- * addition to searching them.
- *
- * @author Kelly
- * @version $Revision: 1.1.1.1 $
- */
-public interface ProfileManager extends ProfileHandler {
- /**
- * Add a profile into the set of profiles managed by this profile server.
- *
- * @param profile The profile to add or replace.
- * @throws ProfileException If any error occurs.
- */
- void add(Profile profile) throws ProfileException;
-
- /**
- * Add all of the profiles in the given collection to the set managed by this
- * server.
- *
- * Any profiles that already exist (as identified by their profile IDs) are replaced.
- *
- * @param collection Collection of {@link Profile}s to add.
- * @throws ProfileException If any error occurs.
- */
- void addAll(Collection collection) throws ProfileException;
-
- /**
- * Clear all profiles.
- *
- * This irrevocably removes all profiles from the server, leaving it with none.
- *
- * @throws ProfileException If any error occurs.
- */
- void clear() throws ProfileException;
-
- /**
- * Tell if the given profile is managed by this server.
- *
- * @param profile The profile to check.
- * @return True if <var>profile</var> is present in the server, false otherwise.
- * @throws ProfileException If any error occurs.
- */
- boolean contains(Profile profile);
-
- /**
- * Tell if the given collection of profiles are managed by this server.
- *
- * @param collection The collection of {@link Profile}s to check.
- * @return True if every {@link Profile} in <var>collection</var> are present in
- * the server, false otherwise.
- * @throws ProfileException If any error occurs.
- */
- boolean containsAll(Collection collection);
-
- /**
- * Get all profiles.
- *
- * @return A collection of profiles
- * @throws ProfileException If any error occurs.
- */
- Collection getAll();
-
- /**
- * Tell if the set of profiles managed by this server is empty.
- *
- * @return True if there are no profiles in this server.
- * @throws ProfileException If any error occurs.
- */
- boolean isEmpty();
-
- /**
- * Iterate over the available profiles.
- *
- * Each call to <code>next</code> yields a copy of the next {@link Profile} object
- * managed by this server. Updates to profile objects are not backed by the
- * server; make your updates and then call {@link #add}.
- *
- * @return An iterator over {@link Profile}s.
- * @throws ProfileException If any error occurs.
- */
- Iterator iterator();
-
- /**
- * Remove the profile with the given ID.
- *
- * This removes forever the given profile from the set of profiles managed by this
- * server.
- *
- * @param profID What profile to remove.
- * @param version What version of the the profile identified by <var>profID</var> to remove.
- * @return True if thie profile was actually present and removed; false if it wasn't present.
- * @throws ProfileException If any error occurs.
- */
- boolean remove(String profID, String version) throws ProfileException;
-
- /**
- * Remove the profile with the given ID.
- *
- * This removes forever the given profile from the set of profiles managed by this
- * server.
- *
- * @param profID ID of profile to remove.
- * @return True if thie profile was actually present and removed; false if it wasn't present.
- * @throws ProfileException If any error occurs.
- */
- boolean remove(String profID) throws ProfileException;
-
- /**
- * Get the size of the set of profiles managed by this server.
- *
- * @return The number of available profiles.
- * @throws ProfileException If any error occurs.
- */
- int size();
-
- /**
- * Replace a profile into the set of profiles managed by this profile server.
- *
- * @param profile The profile to add or replace.
- * @throws ProfileException If any error occurs.
- */
- void replace(Profile profile) throws ProfileException;
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/handlers/cas/CASProfileHandler.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/handlers/cas/CASProfileHandler.java b/profile/src/main/java/org/apache/oodt/profile/handlers/cas/CASProfileHandler.java
deleted file mode 100644
index c1997ec..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/handlers/cas/CASProfileHandler.java
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile.handlers.cas;
-
-//CAS imports
-import org.apache.oodt.cas.filemgr.structs.*;
-import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient;
-import org.apache.oodt.cas.metadata.Metadata;
-import org.apache.oodt.profile.Profile;
-import org.apache.oodt.profile.ProfileException;
-import org.apache.oodt.profile.handlers.ProfileHandler;
-import org.apache.oodt.profile.handlers.cas.util.ProfileUtils;
-import org.apache.oodt.xmlquery.QueryElement;
-import org.apache.oodt.xmlquery.XMLQuery;
-
-import java.net.URL;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-//JDK imports
-//OODT imports
-
-/**
- * @author mattmann
- * @version $Revision$
- *
- * <p>
- * An OODT {@link ProfileHandler} that queries a backend OODT File Management
- * component, and converts {@link Product}s and their {@link Metadata} into
- * OODT {@link Profile}s.
- * </p>
- */
-public class CASProfileHandler implements ProfileHandler {
-
- /* our log stream */
- private static final Logger LOG = Logger.getLogger(CASProfileHandler.class
- .getName());
-
- /* our filemgr client */
- private XmlRpcFileManagerClient fmClient = null;
-
- /* the base URL to the data delivery servlet for products */
- /* AKA our "web-ified" product server */
- private String dataDelivBaseUrlStr = null;
-
- /* product type filter: a list of product types to query across */
- private List productTypeFilter = null;
-
- public CASProfileHandler() throws InstantiationException {
- // need to read in the system property
- // telling us which filemgr to communicate with
-
- String filemgrUrlStr = System.getProperty(
- "org.apache.oodt.cas.profile.fmUrl", "http://localhost:9000");
-
- try {
- fmClient = new XmlRpcFileManagerClient(new URL(filemgrUrlStr));
- } catch (Exception e) {
- throw new InstantiationException(
- "Error communicating with the filemgr: [" + filemgrUrlStr
- + "]: message: " + e.getMessage());
- }
-
- // read in data deliv base url
- dataDelivBaseUrlStr = System.getProperty(
- "org.apache.oodt.cas.profile.dataDelivBaseUrl",
- "http://localhost:8080/filemgr/data");
-
- productTypeFilter = buildFilter(System
- .getProperty("org.apache.oodt.cas.profile.product.types"));
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.oodt.profile.handlers.ProfileHandler#findProfiles(org.apache.oodt.xmlquery.XMLQuery)
- */
- public List findProfiles(XMLQuery query) throws ProfileException {
- List profs = new Vector();
-
- if (productTypeFilter != null && productTypeFilter.size() > 0) {
- for (Object aProductTypeFilter : productTypeFilter) {
- ProductType type = (ProductType) aProductTypeFilter;
- Query cQuery = convertQuery(query);
-
- profs.addAll(queryAndBuildProfiles(type, cQuery));
- }
- }
-
- return profs;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.oodt.profile.handlers.ProfileHandler#get(java.lang.String)
- */
- public Profile get(String arg0) throws ProfileException {
- throw new ProfileException("Method not implemented yet");
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.oodt.profile.handlers.ProfileHandler#getID()
- */
- public String getID() {
- return "CAS Filemgr Profile Handler";
- }
-
- private List safeGetProductTypes() {
- List types = null;
-
- try {
- types = fmClient.getProductTypes();
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- }
-
- return types;
- }
-
- private List safeGetProducts(ProductType type) {
- List products = null;
-
- try {
- products = fmClient.getProductsByProductType(type);
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- }
-
- return products;
- }
-
- private ProductType safeGetProductTypeByName(String name) {
- ProductType type = null;
-
- try {
- type = fmClient.getProductTypeByName(name);
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- }
-
- return type;
- }
-
- private Metadata safeGetMetadata(Product p) {
- Metadata met = null;
-
- try {
- met = fmClient.getMetadata(p);
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- }
-
- return met;
- }
-
- private List safeGetProductReferences(Product p) {
- List references = null;
-
- try {
- references = fmClient.getProductReferences(p);
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- }
-
- return references;
- }
-
- private Element safeGetElementByName(String name) {
- Element elem = null;
-
- try {
- elem = fmClient.getElementByName(name);
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- }
-
- return elem;
- }
-
- private List buildFilter(String productTypeNames) {
- List typeFilter = new Vector();
- if (productTypeNames == null) {
- typeFilter = safeGetProductTypes(); // just grab them all
- } else {
- // split the string on ","
- String[] typeNames = productTypeNames.split(",");
-
- for (String typeName : typeNames) {
- ProductType type = safeGetProductTypeByName(typeName);
- typeFilter.add(type);
- }
- }
-
- return typeFilter;
- }
-
- private Query convertQuery(XMLQuery xmlQuery) {
- // here's the dumbed down algorithm
- // iterate over the whereSet
- // when you find a elemName, grab the next query element
- // ensure it's a literal, if so, there's your term query
-
- // that's all we'll support for now
- Query query = new Query();
-
- if (xmlQuery.getWhereElementSet() != null
- && xmlQuery.getWhereElementSet().size() > 0) {
- for (Iterator i = xmlQuery.getWhereElementSet().iterator(); i
- .hasNext();) {
- QueryElement elem = (QueryElement) i.next();
- if (elem.getRole().equals("elemName")) {
- String elemName = elem.getValue();
-
- // to get the elem value, we need to grab the next elem
- // ensure it's a literal, and then grab it
- QueryElement litElem = (QueryElement) i.next();
- if (!litElem.getRole().equals("LITERAL")) {
- LOG.log(Level.WARNING,
- "next element not literal: element: ["
- + litElem + "]: malformed xml query!");
- break;
- }
- String elemValue = litElem.getValue();
- TermQueryCriteria crit = new TermQueryCriteria();
- crit.setElementName(elemName);
- crit.setValue(elemValue);
- query.addCriterion(crit);
- }
- }
- }
-
- return query;
- }
-
- private List queryAndBuildProfiles(ProductType type, Query query) {
- List profiles = new Vector();
-
- List products;
-
- try {
- products = fmClient.query(query, type);
-
- if (products != null && products.size() > 0) {
- for (Object product : products) {
- Product p = (Product) product;
- p.setProductReferences(safeGetProductReferences(p));
- Metadata met = safeGetMetadata(p);
- try {
- profiles.add(ProfileUtils.buildProfile(p, met,
- dataDelivBaseUrlStr));
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- }
-
- }
- }
- } catch (Exception e) {
- LOG.log(Level.SEVERE,
- "Exception querying the file manager for products: Message: "
- + e.getMessage());
- }
-
- return profiles;
-
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/handlers/cas/util/ProfileUtils.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/handlers/cas/util/ProfileUtils.java b/profile/src/main/java/org/apache/oodt/profile/handlers/cas/util/ProfileUtils.java
deleted file mode 100644
index 6f0958e..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/handlers/cas/util/ProfileUtils.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile.handlers.cas.util;
-
-//CAS imports
-import java.util.List;
-
-import org.apache.oodt.cas.filemgr.structs.Product;
-import org.apache.oodt.cas.metadata.Metadata;
-
-//OODT imports
-import org.apache.oodt.profile.EnumeratedProfileElement;
-import org.apache.oodt.profile.Profile;
-import org.apache.oodt.profile.ProfileAttributes;
-import org.apache.oodt.profile.ResourceAttributes;
-
-/**
- * @author mattmann
- * @version $Revision$
- *
- * <p>
- * A set of utility methods to aid in CAS Filemgr vocabulary conversion to OODT
- * {@link Profile} vocabulary.
- * </p>
- */
-public final class ProfileUtils {
-
- private static final String PROF_ID_PRE = "urn:oodt:profile:";
-
- private static final String PROF_TYPE = "profile";
-
- private ProfileUtils() throws InstantiationException {
- throw new InstantiationException("Don't construct utility classes!");
- }
-
- /**
- * Builds a {@link Profile} from the given {@link Product}, and its
- * {@link Metadata}.
- *
- * @param p
- * The given {@link Product}.
- * @param met
- * The given {@link Metadata}.
- * @param dataDelivBaseUrl
- * A string representation of a {@link URL} to the data delivery
- * service for this particular {@link Product}. This is used, in
- * combination with the {@link Product}'s ID, to populate the
- * {@link ResourceAttributes} <code>resLocation</code> field.
- * @return An OODT {@link Profile} representation pointing at the given
- * {@link Product}.
- */
- public static Profile buildProfile(Product p, Metadata met,
- String dataDelivBaseUrl) {
-
- Profile prof = new Profile();
-
- ProfileAttributes profAttrs = new ProfileAttributes();
- profAttrs.setID(PROF_ID_PRE + p.getProductId());
- profAttrs.setRegAuthority("CAS");
- profAttrs.setType(PROF_TYPE);
-
- prof.setProfileAttributes(profAttrs);
-
- ResourceAttributes resAttrs = new ResourceAttributes();
- resAttrs.setDescription(p.getProductType().getDescription());
- resAttrs.setIdentifier(p.getProductId());
- resAttrs.setResClass(p.getProductType().getName());
- resAttrs.setTitle(p.getProductName());
- resAttrs.getPublishers().add("CAS");
- resAttrs.getResLocations().add(
- dataDelivBaseUrl + "?productID=" + p.getProductId());
-
- prof.setResourceAttributes(resAttrs);
-
- // build up profile elements
- for (String key : met.getMap().keySet()) {
- List vals = met.getAllMetadata(key);
-
- EnumeratedProfileElement elem = new EnumeratedProfileElement(prof);
- System.out.println("Adding [" + key + "]=>" + vals);
- elem.setName(key);
- elem.getValues().addAll(vals);
- prof.getProfileElements().put(key, elem);
- }
-
-
- return prof;
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/AndExpression.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/AndExpression.java b/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/AndExpression.java
deleted file mode 100644
index d64f2a7..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/AndExpression.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile.handlers.lightweight;
-
-import java.util.Map;
-
-/**
- * An "and" component of a where-expression.
- *
- * This component evaluates a result that's the intersection of the left and right
- * expressions.
- *
- * @author Kelly
- */
-class AndExpression implements WhereExpression {
- /**
- * Construct an "and" where-expression.
- *
- * @param lhs Left-hand side
- * @param rhs Right-hand side.
- */
- public AndExpression(WhereExpression lhs, WhereExpression rhs) {
- this.lhs = lhs;
- this.rhs = rhs;
- }
-
- public Result result(SearchableResourceAttributes resAttr, Map elements) {
- return new Intersection(lhs.result(resAttr, elements), rhs.result(resAttr, elements));
- }
-
- public WhereExpression simplify() {
- // Simplify the left and right sides, and keep this node.
- lhs = lhs.simplify();
- rhs = rhs.simplify();
- return this;
- }
-
- public WhereExpression negate() {
- return new OrExpression(lhs.negate(), rhs.negate());
- }
-
- public String toString() {
- return "and[" + lhs + "," + rhs + "]";
- }
-
- /** Left-hand side of the expression. */
- private WhereExpression lhs;
-
- /** Right-hand side of the expression. */
- private WhereExpression rhs;
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/ConstantExpression.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/ConstantExpression.java b/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/ConstantExpression.java
deleted file mode 100644
index 6998c9e..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/ConstantExpression.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile.handlers.lightweight;
-
-import java.util.HashSet;
-import java.util.Map;
-
-/**
- * A constant expression.
- *
- * This expression yields either all the elements (if it's a constant true) or none (if
- * it's a constant false).
- *
- * @author Kelly
- */
-class ConstantExpression implements WhereExpression {
- /**
- * Construct a constant where-expression.
- *
- * @param value Truth value of this expression.
- */
- public ConstantExpression(boolean value) {
- this.value = value;
- }
-
- public Result result(SearchableResourceAttributes resAttr, Map elements) {
- if (value) {
- return new MatchingResult(new HashSet(elements.values()));
- } else {
- return FalseResult.INSTANCE;
- }
- }
-
- public WhereExpression simplify() {
- // Can't get simpler than this.
- return this;
- }
-
- public WhereExpression negate() {
- return new ConstantExpression(!value);
- }
-
- public String toString() {
- return "constant[" + value + "]";
- }
-
- /** Truth value. */
- private boolean value;
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/FalseResult.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/FalseResult.java b/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/FalseResult.java
deleted file mode 100644
index 127de29..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/FalseResult.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile.handlers.lightweight;
-
-import java.util.Set;
-import java.util.Collections;
-
-/**
- * A constant false result.
- *
- * This result never contains any matching elements.
- *
- * <p>Don't create elements of this object. Just use the {@link #INSTANCE} field, since
- * only one is any program will ever need.
- *
- * @author Kelly
- */
-class FalseResult implements Result {
- /**
- * Construct a false result.
- */
- private FalseResult() {}
-
- /** The single false result any program will ever need. */
- public static final FalseResult INSTANCE = new FalseResult();
-
- public String toString() {
- return "falseResult";
- }
-
- public Set matchingElements() {
- return Collections.EMPTY_SET;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/Intersection.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/Intersection.java b/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/Intersection.java
deleted file mode 100644
index 4ef52f4..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/Intersection.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile.handlers.lightweight;
-
-import java.util.Set;
-import org.apache.oodt.profile.ProfileElement;
-
-/**
- * Intersection of the two sets is the result.
- *
- * This result takes the intersection of two other results.
- *
- * @author Kelly
- */
-class Intersection implements Result {
- /**
- * Construct an intersection.
- *
- * @param lhs Left-hand side
- * @param rhs Right-hand side.
- */
- public Intersection(Result lhs, Result rhs) {
- this.lhs = lhs;
- this.rhs = rhs;
- }
-
- public Set matchingElements() {
- Set intersection = ProfileElement.profiles(lhs.matchingElements());
- intersection.retainAll(ProfileElement.profiles(rhs.matchingElements()));
- Set rc = ProfileElement.elements(intersection, lhs.matchingElements());
- rc.addAll(ProfileElement.elements(intersection, rhs.matchingElements()));
- return rc;
- }
-
- public String toString() {
- return "intersection[" + lhs + "," + rhs + "]";
- }
-
- /** Left-hand side of the result. */
- private Result lhs;
-
- /** Right-hand side of the result. */
- private Result rhs;
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/LightweightProfileServer.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/LightweightProfileServer.java b/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/LightweightProfileServer.java
deleted file mode 100644
index bf70670..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/LightweightProfileServer.java
+++ /dev/null
@@ -1,306 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile.handlers.lightweight;
-
-import org.apache.oodt.commons.util.DOMParser;
-import org.apache.oodt.commons.util.XML;
-import org.apache.oodt.profile.Profile;
-import org.apache.oodt.profile.ProfileException;
-import org.apache.oodt.profile.handlers.ProfileHandler;
-import org.apache.oodt.xmlquery.QueryElement;
-import org.apache.oodt.xmlquery.XMLQuery;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.Stack;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * A lightweight profile server.
- *
- * A lightweight profile server is lightweight because it doesn't rely on any external
- * database or other search/retrieval mechanism.
- *
- * @author Kelly
- */
-final public class LightweightProfileServer implements ProfileHandler {
- /**
- * Create a lightweight profile server using defaults.
- *
- * @throws IOException If an I/O error occurs.
- * @throws SAXException If an error occurs parsing the profile file.
- */
- public LightweightProfileServer() throws IOException, SAXException, URISyntaxException {
- this(System.getProperties());
- }
-
- /**
- * Create a lightweight profile server using the given properties.
- *
- * The property we use is
- * <code>profiles.url</code>,
- * which is the URL of the file containing profile definitions that this server
- * will read and serve.
- *
- * @param props Properties.
- * @throws IOException If an I/O error occurs.
- * @throws SAXException If an error occurs parsing the profile file.
- * @throws MalformedURLException If the URL to the profile file is malformed.
- */
- public LightweightProfileServer(Properties props)
- throws IOException, SAXException, URISyntaxException {
- this(new URI(props.getProperty("org.apache.oodt.profile.handlers.LightweightProfileServer.profiles.url",
- props.getProperty("org.apache.oodt.profile.webServer.baseURL", "http://eda.jpl.nasa.gov")
- + "/profiles.xml")),
- props.getProperty("org.apache.oodt.profile.handlers.LightweightProfileServer.id", "lightweight"));
- }
-
- /**
- * Create a lightweight profile server using the given URL.
- *
- * @param url URL of the file containing profile definitions that this server will read and serve.
- * @param id Identifier to report for when this handler is queried by name.
- * @throws IOException If an I/O error occurs.
- * @throws SAXException If an error occurs parsing the profile file.
- */
- public LightweightProfileServer(URI url, String id) throws IOException, SAXException {
- this.id = id;
-
- // Get the list of profiles from the cache, if it's there.
- profiles = (List) cache.get(url);
- if (profiles != null) {
- return;
- }
-
- // It wasn't in the cache, so create a parser to parse the file. We only
- // deal with correct files, so turn on validation and install an error
- // handler that will throw an exception.
- profiles = new ArrayList();
- DOMParser parser = XML.createDOMParser();
- parser.setErrorHandler(new ErrorHandler() {
- public void error(SAXParseException ex) throws SAXParseException {
- System.err.println("Parse error line " + ex.getLineNumber() + " column "
- + ex.getColumnNumber() + ": " + ex.getMessage());
- throw ex;
- }
- public void warning(SAXParseException ex) {
- System.err.println("Parse warning: " + ex.getMessage());
- }
- public void fatalError(SAXParseException ex) throws SAXParseException {
- throw ex;
- }
- });
-
- // Parse the file.
- InputSource inputSource = new InputSource(url.toString());
- parser.parse(inputSource);
- Document doc = parser.getDocument();
-
- // Normalize it and get the document element, and from that, create a list
- // of profiles, and add it to the cache.
- doc.normalize();
- Element root = doc.getDocumentElement();
- profiles = Profile.createProfiles(root, new SearchableObjectFactory());
- cache.put(url, profiles);
-
- System.err.println("LightweightProfileServer ready");
- }
-
- public List findProfiles(XMLQuery query) throws ProfileException {
- // Compute the where-expression based on the query string, and start off
- // with an empty set of results.
- Set matchingProfiles = new HashSet();
- WhereExpression whereExpression = createWhereExpression(query);
-
- // Search each profile, and add the results of the search to the set of results.
- for (Object profile1 : profiles) {
- SearchableProfile profile = (SearchableProfile) profile1;
-
- // Search the profile with the where-expression.
- Result result = profile.search(whereExpression);
-
- // If there are any matching elements, add the profile to the set.
- if (!result.matchingElements().isEmpty()) {
- matchingProfiles.add(profile);
- }
- }
-
- // Convert from set to list.
- return new ArrayList(matchingProfiles);
- }
-
- /**
- * Get a single profile matching the given ID.
- *
- * @param profID a {@link String} value.
- * @return a {@link Profile} value.
- */
- public Profile get(String profID) {
- if (profID == null) {
- return null;
- }
- Profile rc = null;
- for (Object profile : profiles) {
- Profile p = (Profile) profile;
- if (p.getProfileAttributes().getID().equals(profID)) {
- rc = p;
- break;
- }
- }
- return rc;
- }
-
- /**
- * Convert the XML query to a where expression.
- *
- * @param query The query to convert
- * @return The equivalent, simplified where expression.
- */
- private static WhereExpression createWhereExpression(XMLQuery query) {
- Stack stack = new Stack();
-
- // Collect together the where- and from-sets, joined with an "and".
- List allElements = new ArrayList(query.getWhereElementSet());
- List fromElements = query.getFromElementSet();
- if (!fromElements.isEmpty()) {
- allElements.addAll(fromElements);
- allElements.add(new QueryElement("LOGOP", "AND"));
- }
-
- // For each item in the where-set
- for (Object allElement : allElements) {
- QueryElement queryElement = (QueryElement) allElement;
-
- // Get the keyword and its type.
- String keyword = queryElement.getValue();
- String type = queryElement.getRole();
-
- if (type.equals("elemName")) {
- // It's an element name, so push the element name.
- stack.push(keyword);
- } else if (type.equals("LITERAL")) {
- // It's a literal value, so push the value.
- stack.push(keyword);
- } else if (type.equals("LOGOP")) {
- // It's a logical operator. Pop the operands off the
- // stack and push the appropriate operator back on.
- if (keyword.equals("AND")) {
- stack.push(new AndExpression((WhereExpression) stack.pop(), (WhereExpression) stack.pop()));
- } else if (keyword.equals("OR")) {
- stack.push(new OrExpression((WhereExpression) stack.pop(), (WhereExpression) stack.pop()));
- } else if (keyword.equals("NOT")) {
- stack.push(new NotExpression((WhereExpression) stack.pop()));
- } else {
- throw new IllegalArgumentException("Illegal operator \"" + keyword + "\" in query");
- }
- } else if (type.equals("RELOP")) {
- // It's a relational operator. Pop the element name and
- // literal value off the stack, and push the operator
- // expression on with the given operator.
- stack.push(new OperatorExpression((String) stack.pop(), (String) stack.pop(), keyword));
- }
- }
-
- // If there's nothing on the stack, we're given nothing, so give back everything.
- if (stack.size() == 0) {
- return new ConstantExpression(true);
- } else if (stack.size() > 1) {
- throw new IllegalStateException("Imbalanced expression in query");
- }
-
- // Simplify/optimize the where-expression and return it.
- return ((WhereExpression) stack.pop()).simplify();
- }
-
- /** {@inheritDoc} */
- public String getID() {
- return id;
- }
-
- /** Profiles I serve. */
- private List profiles;
-
- /**
- * Cache of profiles.
- *
- * This is a mapping from {@link java.net.URL} of the profile source to the {@link
- * List} of profiles. We do this so we don't have to keep rereading and reparsing
- * the possibly huge profile file each time an object of this class is
- * instantiated.
- *
- * <p><em>Question:</em> Since when are multiple LightweightProfileServers being
- * constructed anyway? There's just one per profile server process, and it's
- * using just the one file, so there should be no need for this cache. Who added
- * this? And if it were me, what was I smoking?
- */
- private static Map cache = new ConcurrentHashMap();
-
- /** My ID. */
- private String id;
-
- /**
- * Application execution entry point.
- *
- * This lets you try out a query to the Lightweight Profile server.
- *
- * @param argv Command-line arguments.
- * @throws Exception Should any error occur.
- */
- public static void main(String[] argv) throws Exception {
- if (argv.length == 0) {
- System.err.println("Usage: <query>...");
- System.exit(1);
- }
-
- // Create the profile
- LightweightProfileServer lp = new LightweightProfileServer();
-
- // Gather together the command-line arguments into a single long string.
- StringBuilder b = new StringBuilder();
- for (String anArgv : argv) {
- b.append(anArgv).append(' ');
- }
-
- // Create the query object from the expression.
- XMLQuery query = new XMLQuery(b.toString().trim(), /*id*/"cli1", /*title*/"CmdLine-1",
- /*desc*/"This is a query entered on the command-line", /*ddId*/null, /*resultModeId*/null,
- /*propType*/null, /*propLevels*/null, XMLQuery.DEFAULT_MAX_RESULTS);
-
- // Display the results.
- System.out.println(lp.findProfiles(query));
-
- // All done.
- System.exit(0);
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/MatchingResult.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/MatchingResult.java b/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/MatchingResult.java
deleted file mode 100644
index c1d499f..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/MatchingResult.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile.handlers.lightweight;
-
-import java.util.Collections;
-import java.util.Set;
-import org.apache.oodt.profile.ProfileElement;
-
-/**
- * A matching result.
- *
- * This result matches profile elements.
- *
- * @author Kelly
- */
-class MatchingResult implements Result {
- /**
- * Construct a matching result.
- *
- * @param element The profile element that matches.
- */
- public MatchingResult(ProfileElement element) {
- this.elements = Collections.singleton(element);
- }
-
- /**
- * Construct a matching result.
- *
- * @param elements The profile elements that all match.
- */
- public MatchingResult(Set elements) {
- this.elements = elements;
- }
-
- public Set matchingElements() {
- return elements;
- }
-
- public String toString() {
- return "match[" + elements + "]";
- }
-
- /** The matching elements. */
- private Set elements;
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/NotExpression.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/NotExpression.java b/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/NotExpression.java
deleted file mode 100644
index b6929d7..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/NotExpression.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile.handlers.lightweight;
-
-import java.util.Map;
-
-/**
- * A "not" component of a where-expression.
- *
- * This expression component negates its given operand.
- *
- * @author Kelly
- */
-class NotExpression implements WhereExpression {
- /**
- * Construct a "not" where-expression.
- *
- * @param operand The operand.
- */
- public NotExpression(WhereExpression operand) {
- this.operand = operand;
- }
-
- public Result result(SearchableResourceAttributes resAttr, Map elements) {
- throw new IllegalStateException("Not-nodes must be simplified out since they cannot yield results");
- }
-
- public WhereExpression simplify() {
- // Negate my operand right now, then simplify it, and drop myself out.
- return operand.negate().simplify();
- }
-
- public WhereExpression negate() {
- return new NotExpression(operand.negate());
- }
-
- public String toString() {
- return "not[" + operand + "]";
- }
-
- /** Expression to negate. */
- private WhereExpression operand;
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/OperatorExpression.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/OperatorExpression.java b/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/OperatorExpression.java
deleted file mode 100644
index 51c18d5..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/OperatorExpression.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile.handlers.lightweight;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * A operator component of a where-expression.
- *
- * This component applies an operator, like <, =, ≥, etc., to a element name and a
- * literal value.
- *
- * @author Kelly
- */
-class OperatorExpression implements WhereExpression {
- /**
- * Construct an operator where-expression.
- *
- * @param value Value to which to compare.
- * @param name Name of element to match.
- * @param operator What operator to use
- */
- public OperatorExpression(String value, String name, String operator) {
- if (Arrays.binarySearch(VALID_OPERATORS, operator) < 0) {
- throw new IllegalArgumentException("Invalid operator \"" + operator + "\"");
- }
-
- this.name = name;
- this.value = value;
- this.operator = operator;
- }
-
- public Result result(SearchableResourceAttributes resAttr, Map elements) {
- // Is it a "from" relation or a "where" relation?
- if (FROM_TOKENS.contains(name)) {
- // "From." So let the resource attributes take care of it.
- return resAttr.result(name, value, operator);
- } else if (RESOURCE_ATTRIBUTES.contains(name)) {
- // Resource attributes in "Where"
- // let the resource attributes take care of it.
- return resAttr.result(name, value, operator);
- } else {
- // "Where." See if our keyword is present in the given set.
- SearchableProfileElement element = (SearchableProfileElement) elements.get(name);
-
- // Nope. We can only give a false result.
- if (element == null) {
- return FalseResult.INSTANCE;
- }
-
- // Yep. Ask the element to yield the result.
- return element.result(value, operator);
- }
- }
-
- public WhereExpression simplify() {
- // Can't get simpler than this.
- return this;
- }
-
- public WhereExpression negate() {
- String negated;
- if (operator.equals("EQ")) {
- negated = "NE";
- } else if (operator.equals("NE")) {
- negated = "EQ";
- } else if (operator.equals("LT")) {
- negated = "GE";
- } else if (operator.equals("GT")) {
- negated = "LE";
- } else if (operator.equals("LE")) {
- negated = "GT";
- } else if (operator.equals("LIKE")) {
- negated = "NE";
- } else if (operator.equals("NOTLIKE")) {
- negated = "EQ";
- } else {
- negated = "LT";
- }
- return new OperatorExpression(value, name, negated);
- }
-
- public String toString() {
- return "operator[" + name + " " + operator + " " + value + "]";
- }
-
- /** Name of element to match. */
- private String name;
-
- /** Value to compare. */
- private String value;
-
- /** Operator to use. */
- private String operator;
-
- /**
- * Valid operators.
- *
- * <strong>KEEP THIS IN ORDER!</strong> We binary search on them!
- */
- private static final String[] VALID_OPERATORS = {
- "EQ", "GE", "GT", "LE", "LIKE", "LT", "NE", "NOTLIKE"
- };
-
- /**
- * Relational operations performed on the "from" part of a query instead of the
- * "where" part. These work off the resource attributes rather than the profile
- * elements.
- */
- private static final Set FROM_TOKENS = new HashSet(Arrays.asList(org.apache.oodt.xmlquery.XMLQuery.FROM_TOKENS));
-
- /**
- * Resource attributes that are parsed into WHERE part of the xmlquery
- */
- private static final Set RESOURCE_ATTRIBUTES = new HashSet(Arrays.asList(
- new String[]{
- "Identifier", "Title", "Format", "Description", "Creator",
- "Subject", "Publisher", "Contributor", "Date", "Type",
- "Source", "Language", "Relation", "Coverage", "Rights",
- "resContext", "resClass", "resLocation" }));
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/OrExpression.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/OrExpression.java b/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/OrExpression.java
deleted file mode 100644
index 31ab17f..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/OrExpression.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile.handlers.lightweight;
-
-import java.util.Map;
-
-/**
- * An "or" component of a where-expression.
- *
- * This component yields a result that's the union of the results of the left and right
- * sides.
- *
- * @author Kelly
- */
-class OrExpression implements WhereExpression {
- /**
- * Construct an "or" where-expression.
- *
- * @param lhs Left-hand side
- * @param rhs Right-hand side.
- */
- public OrExpression(WhereExpression lhs, WhereExpression rhs) {
- this.lhs = lhs;
- this.rhs = rhs;
- }
-
- public Result result(SearchableResourceAttributes resAttr, Map elements) {
- return new Union(lhs.result(resAttr, elements), rhs.result(resAttr, elements));
- }
-
- public WhereExpression simplify() {
- // Simplify the left and right sides, and keep this node.
- lhs = lhs.simplify();
- rhs = rhs.simplify();
- return this;
- }
-
- public WhereExpression negate() {
- return new AndExpression(lhs.negate(), rhs.negate());
- }
-
- public String toString() {
- return "or[" + lhs + "," + rhs + "]";
- }
-
- /** Left-hand side of the expression. */
- private WhereExpression lhs;
-
- /** Right-hand side of the expression. */
- private WhereExpression rhs;
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/Result.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/Result.java b/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/Result.java
deleted file mode 100644
index 6c4ceb3..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/Result.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile.handlers.lightweight;
-
-import java.util.Set;
-
-/**
- * A result of a profile match.
- *
- * @author Kelly
- */
-interface Result {
- /**
- * Get the set of matching elements.
- *
- * If the set is empty, it means no elements matched.
- */
- Set matchingElements();
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableEnumeratedProfileElement.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableEnumeratedProfileElement.java b/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableEnumeratedProfileElement.java
deleted file mode 100644
index 85f93b6..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableEnumeratedProfileElement.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile.handlers.lightweight;
-
-import org.apache.oodt.profile.EnumeratedProfileElement;
-import java.util.List;
-
-/**
- * Searchable, enumerated, profile element.
- *
- * @author Kelly
- * @version $Revision: 1.1.1.1 $
- */
-public class SearchableEnumeratedProfileElement extends EnumeratedProfileElement implements SearchableProfileElement {
- public SearchableEnumeratedProfileElement(SearchableProfile profile, String name, String id, String desc, String type,
- String unit, List synonyms, boolean obligation, int maxOccurrence, String comment, List values) {
- super(profile, name, id, desc, type, unit, synonyms, obligation, maxOccurrence, comment, values);
- }
-
- public Result result(String value, String operator) {
- Result rc = FalseResult.INSTANCE;
- if (operator.equals("EQ") || operator.equals("LE") || operator.equals("GE") ||
- operator.equals("LIKE")) {
- if (values.contains(value)) {
- rc = new MatchingResult(this);
- }
- } else if (operator.equals("NE") || operator.equals("NOTLIKE")) {
- if (!values.contains(value)) {
- rc = new MatchingResult(this);
- }
- }
- return rc;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableObjectFactory.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableObjectFactory.java b/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableObjectFactory.java
deleted file mode 100644
index aed4e9a..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableObjectFactory.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile.handlers.lightweight;
-
-import java.util.List;
-import org.apache.oodt.profile.EnumeratedProfileElement;
-import org.apache.oodt.profile.ObjectFactory;
-import org.apache.oodt.profile.Profile;
-import org.apache.oodt.profile.ProfileAttributes;
-import org.apache.oodt.profile.RangedProfileElement;
-import org.apache.oodt.profile.ResourceAttributes;
-import org.apache.oodt.profile.UnspecifiedProfileElement;
-import org.w3c.dom.Element;
-
-/**
- * Factory that yields searchable profile objects.
- *
- * @author Kelly
- * @version $Revision: 1.1.1.1 $
- */
-class SearchableObjectFactory implements ObjectFactory {
- public RangedProfileElement createRangedProfileElement(Profile profile, String name, String id, String desc, String type,
- String unit, List synonyms, boolean obligation, int maxOccurrence, String comments, String min, String max) {
- return new SearchableRangedProfileElement((SearchableProfile) profile, name, id, desc, type, unit, synonyms,
- obligation, maxOccurrence, comments, min, max);
- }
- public UnspecifiedProfileElement createUnspecifiedProfileElement(Profile profile, String name, String id, String desc,
- String type, String unit, List synonyms, boolean obligation, int maxOccurrence, String comments) {
- return new SearchableUnspecifiedProfileElement((SearchableProfile) profile, name, id, desc, type, unit, synonyms,
- obligation, maxOccurrence, comments);
- }
- public EnumeratedProfileElement createEnumeratedProfileElement(Profile profile, String name, String id, String desc,
- String type, String unit, List synonyms, boolean obligation, int maxOccurrence, String comments, List values) {
- return new SearchableEnumeratedProfileElement((SearchableProfile) profile, name, id, desc, type, unit, synonyms,
- obligation, maxOccurrence, comments, values);
- }
- public Profile createProfile(Element node) {
- return new SearchableProfile(node, this);
- }
- public ProfileAttributes createProfileAttributes(Element node) {
- return new ProfileAttributes(node);
- }
- public ResourceAttributes createResourceAttributes(Profile profile, Element node) {
- return new SearchableResourceAttributes((SearchableProfile) profile, node);
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableProfile.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableProfile.java b/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableProfile.java
deleted file mode 100644
index be9a108..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableProfile.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile.handlers.lightweight;
-
-import org.apache.oodt.profile.ObjectFactory;
-import org.apache.oodt.profile.Profile;
-import org.w3c.dom.Element;
-
-/**
- * A profile that can be searched.
- *
- * @author Kelly
- * @version $Revision: 1.1.1.1 $
- */
-public class SearchableProfile extends Profile {
- public SearchableProfile(Element node, ObjectFactory factory) {
- super(node, factory);
- }
-
- /**
- * Search this profile.
- *
- * @param expression Statement of what to retrieve.
- */
- public Result search(WhereExpression expression) {
- return expression.result((SearchableResourceAttributes) resAttr, elements);
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableProfileElement.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableProfileElement.java b/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableProfileElement.java
deleted file mode 100644
index 141de78..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableProfileElement.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile.handlers.lightweight;
-
-
-/**
- * A profile element that can be searched.
- *
- * @author Kelly
- * @version $Revision: 1.1.1.1 $
- */
-interface SearchableProfileElement {
- /** Produce a search result.
- *
- * @param value The desired value.
- * @param operator What operator to use for comparison.
- * @return A search result.
- */
- Result result(String value, String operator);
-}
[39/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/profile/static/js/jquery.validate.pack.js
----------------------------------------------------------------------
diff --git a/balance/modules/profile/static/js/jquery.validate.pack.js b/balance/modules/profile/static/js/jquery.validate.pack.js
deleted file mode 100644
index 8ec2fb7..0000000
--- a/balance/modules/profile/static/js/jquery.validate.pack.js
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * jQuery validation plug-in 1.7
- *
- * http://bassistance.de/jquery-plugins/jquery-plugin-validation/
- * http://docs.jquery.com/Plugins/Validation
- *
- * Copyright (c) 2006 - 2008 Jörn Zaefferer
- *
- * $Id: jquery.validate.js 6403 2009-06-17 14:27:16Z joern.zaefferer $
- *
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
- */
-eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(7($){$.H($.2L,{17:7(d){l(!6.F){d&&d.2q&&2T.1z&&1z.52("3y 3p, 4L\'t 17, 64 3y");8}p c=$.19(6[0],\'v\');l(c){8 c}c=2w $.v(d,6[0]);$.19(6[0],\'v\',c);l(c.q.3x){6.3s("1w, 3i").1o(".4E").3e(7(){c.3b=w});l(c.q.35){6.3s("1w, 3i").1o(":2s").3e(7(){c.1Z=6})}6.2s(7(b){l(c.q.2q)b.5J();7 1T(){l(c.q.35){l(c.1Z){p a=$("<1w 1V=\'5r\'/>").1s("u",c.1Z.u).33(c.1Z.Z).51(c.U)}c.q.35.V(c,c.U);l(c.1Z){a.3D()}8 N}8 w}l(c.3b){c.3b=N;8 1T()}l(c.L()){l(c.1b){c.1l=w;8 N}8 1T()}12{c.2l();8 N}})}8 c},J:7(){l($(6[0]).2W(\'L\')){8 6.17().L()}12{p b=w;p a=$(6[0].L).17();6.P(7(){b&=a.I(6)});8 b}},4D:7(c){p d={},$I=6;$.P(c.1I(/\\s/),7(a,b){d[b]=$I.1s(b);$I.6d(b)});8 d},1i:7(h,k){p f=6[0];l(h){p
i=$.19(f.L,\'v\').q;p d=i.1i;p c=$.v.36(f);23(h){1e"1d":$.H(c,$.v.1X(k));d[f.u]=c;l(k.G)i.G[f.u]=$.H(i.G[f.u],k.G);31;1e"3D":l(!k){T d[f.u];8 c}p e={};$.P(k.1I(/\\s/),7(a,b){e[b]=c[b];T c[b]});8 e}}p g=$.v.41($.H({},$.v.3Y(f),$.v.3V(f),$.v.3T(f),$.v.36(f)),f);l(g.15){p j=g.15;T g.15;g=$.H({15:j},g)}8 g}});$.H($.5p[":"],{5n:7(a){8!$.1p(""+a.Z)},5g:7(a){8!!$.1p(""+a.Z)},5f:7(a){8!a.4h}});$.v=7(b,a){6.q=$.H(w,{},$.v.3d,b);6.U=a;6.3I()};$.v.W=7(c,b){l(R.F==1)8 7(){p a=$.3F(R);a.4V(c);8 $.v.W.1Q(6,a)};l(R.F>2&&b.2c!=3B){b=$.3F(R).4Q(1)}l(b.2c!=3B){b=[b]}$.P(b,7(i,n){c=c.1u(2w 3t("\\\\{"+i+"\\\\}","g"),n)});8 c};$.H($.v,{3d:{G:{},2a:{},1i:{},1c:"3r",28:"J",2F:"4P",2l:w,3o:$([]),2D:$([]),3x:w,3l:[],3k:N,4O:7(a){6.3U=a;l(6.q.4K&&!6.4J){6.q.1K&&6.q.1K.V(6,a,6.q.1c,6.q.28);6.1M(a).2A()}},4C:7(a){l(!6.1E(a)&&(a.u 11 6.1a||!6.K(a))){6.I(a)}},6c:7(a){l(a.u 11 6.1a||a==6.4A){6.I(a)}},68:7(a){l(a.u 11 6.1a)6.I(a);12 l(a.4x.u 11 6.1a)6.I(a.4x)},39:7(a,c,b){$(a).22(c).2v(b)},1K:7(a,c,b){$(a).2v(c).2
2(b)}},63:7(a){$.H($.v.3d,a)},G:{15:"61 4r 2W 15.",1q:"M 2O 6 4r.",1J:"M O a J 1J 5X.",1B:"M O a J 5W.",1A:"M O a J 1A.",2j:"M O a J 1A (5Q).",1G:"M O a J 1G.",1P:"M O 5O 1P.",2f:"M O a J 5L 5I 1G.",2o:"M O 47 5F Z 5B.",43:"M O a Z 5z a J 5x.",18:$.v.W("M O 3K 5v 2X {0} 2V."),1y:$.v.W("M O 5t 5s {0} 2V."),2i:$.v.W("M O a Z 3W {0} 3O {1} 2V 5o."),2r:$.v.W("M O a Z 3W {0} 3O {1}."),1C:$.v.W("M O a Z 5j 2X 46 3M 3L {0}."),1t:$.v.W("M O a Z 5d 2X 46 3M 3L {0}.")},3J:N,5a:{3I:7(){6.24=$(6.q.2D);6.4t=6.24.F&&6.24||$(6.U);6.2x=$(6.q.3o).1d(6.q.2D);6.1a={};6.54={};6.1b=0;6.1h={};6.1f={};6.21();p f=(6.2a={});$.P(6.q.2a,7(d,c){$.P(c.1I(/\\s/),7(a,b){f[b]=d})});p e=6.q.1i;$.P(e,7(b,a){e[b]=$.v.1X(a)});7 2N(a){p b=$.19(6[0].L,"v"),3c="4W"+a.1V.1u(/^17/,"");b.q[3c]&&b.q[3c].V(b,6[0])}$(6.U).2K(":3E, :4U, :4T, 2e, 4S","2d 2J 4R",2N).2K(":3C, :3A, 2e, 3z","3e",2N);l(6.q.3w)$(6.U).2I("1f-L.17",6.q.3w)},L:7(){6.3v();$.H(6.1a,6.1v);6.1f=$.H({},6.1v);l(!6.J())$(6.U).3u("1f-L",[6]);6.1m();8 6.J()},3v:7
(){6.2H();Q(p i=0,14=(6.2b=6.14());14[i];i++){6.29(14[i])}8 6.J()},I:7(a){a=6.2G(a);6.4A=a;6.2P(a);6.2b=$(a);p b=6.29(a);l(b){T 6.1f[a.u]}12{6.1f[a.u]=w}l(!6.3q()){6.13=6.13.1d(6.2x)}6.1m();8 b},1m:7(b){l(b){$.H(6.1v,b);6.S=[];Q(p c 11 b){6.S.27({1j:b[c],I:6.26(c)[0]})}6.1n=$.3n(6.1n,7(a){8!(a.u 11 b)})}6.q.1m?6.q.1m.V(6,6.1v,6.S):6.3m()},2S:7(){l($.2L.2S)$(6.U).2S();6.1a={};6.2H();6.2Q();6.14().2v(6.q.1c)},3q:7(){8 6.2k(6.1f)},2k:7(a){p b=0;Q(p i 11 a)b++;8 b},2Q:7(){6.2C(6.13).2A()},J:7(){8 6.3j()==0},3j:7(){8 6.S.F},2l:7(){l(6.q.2l){3Q{$(6.3h()||6.S.F&&6.S[0].I||[]).1o(":4N").3g().4M("2d")}3f(e){}}},3h:7(){p a=6.3U;8 a&&$.3n(6.S,7(n){8 n.I.u==a.u}).F==1&&a},14:7(){p a=6,2B={};8 $([]).1d(6.U.14).1o(":1w").1L(":2s, :21, :4I, [4H]").1L(6.q.3l).1o(7(){!6.u&&a.q.2q&&2T.1z&&1z.3r("%o 4G 3K u 4F",6);l(6.u 11 2B||!a.2k($(6).1i()))8 N;2B[6.u]=w;8 w})},2G:7(a){8 $(a)[0]},2z:7(){8 $(6.q.2F+"."+6.q.1c,6.4t)},21:7(){6.1n=[];6.S=[];6.1v={};6.1k=$([]);6.13=$([]);6.2b=$([])},2H:7(){6.21();6.13=6
.2z().1d(6.2x)},2P:7(a){6.21();6.13=6.1M(a)},29:7(d){d=6.2G(d);l(6.1E(d)){d=6.26(d.u)[0]}p a=$(d).1i();p c=N;Q(Y 11 a){p b={Y:Y,2n:a[Y]};3Q{p f=$.v.1N[Y].V(6,d.Z.1u(/\\r/g,""),d,b.2n);l(f=="1S-1Y"){c=w;6g}c=N;l(f=="1h"){6.13=6.13.1L(6.1M(d));8}l(!f){6.4B(d,b);8 N}}3f(e){6.q.2q&&2T.1z&&1z.6f("6e 6b 6a 69 I "+d.4z+", 29 47 \'"+b.Y+"\' Y",e);67 e;}}l(c)8;l(6.2k(a))6.1n.27(d);8 w},4y:7(a,b){l(!$.1H)8;p c=6.q.3a?$(a).1H()[6.q.3a]:$(a).1H();8 c&&c.G&&c.G[b]},4w:7(a,b){p m=6.q.G[a];8 m&&(m.2c==4v?m:m[b])},4u:7(){Q(p i=0;i<R.F;i++){l(R[i]!==20)8 R[i]}8 20},2u:7(a,b){8 6.4u(6.4w(a.u,b),6.4y(a,b),!6.q.3k&&a.62||20,$.v.G[b],"<4s>60: 5Z 1j 5Y Q "+a.u+"</4s>")},4B:7(b,a){p c=6.2u(b,a.Y),37=/\\$?\\{(\\d+)\\}/g;l(1g c=="7"){c=c.V(6,a.2n,b)}12 l(37.16(c)){c=1F.W(c.1u(37,\'{$1}\'),a.2n)}6.S.27({1j:c,I:b});6.1v[b.u]=c;6.1a[b.u]=c},2C:7(a){l(6.q.2t)a=a.1d(a.4q(6.q.2t));8 a},3m:7(){Q(p i=0;6.S[i];i++){p a=6.S[i];6.q.39&&6.q.39.V(6,a.I,6.q.1c,6.q.28);6.2E(a.I,a.1j)}l(6.S.F){6.1k=6.1k.1d(6.2x)}l(6.q.1x){
Q(p i=0;6.1n[i];i++){6.2E(6.1n[i])}}l(6.q.1K){Q(p i=0,14=6.4p();14[i];i++){6.q.1K.V(6,14[i],6.q.1c,6.q.28)}}6.13=6.13.1L(6.1k);6.2Q();6.2C(6.1k).4o()},4p:7(){8 6.2b.1L(6.4n())},4n:7(){8 $(6.S).4m(7(){8 6.I})},2E:7(a,c){p b=6.1M(a);l(b.F){b.2v().22(6.q.1c);b.1s("4l")&&b.4k(c)}12{b=$("<"+6.q.2F+"/>").1s({"Q":6.34(a),4l:w}).22(6.q.1c).4k(c||"");l(6.q.2t){b=b.2A().4o().5V("<"+6.q.2t+"/>").4q()}l(!6.24.5S(b).F)6.q.4j?6.q.4j(b,$(a)):b.5R(a)}l(!c&&6.q.1x){b.3E("");1g 6.q.1x=="1D"?b.22(6.q.1x):6.q.1x(b)}6.1k=6.1k.1d(b)},1M:7(a){p b=6.34(a);8 6.2z().1o(7(){8 $(6).1s(\'Q\')==b})},34:7(a){8 6.2a[a.u]||(6.1E(a)?a.u:a.4z||a.u)},1E:7(a){8/3C|3A/i.16(a.1V)},26:7(d){p c=6.U;8 $(4i.5P(d)).4m(7(a,b){8 b.L==c&&b.u==d&&b||4g})},1O:7(a,b){23(b.4f.4e()){1e\'2e\':8 $("3z:3p",b).F;1e\'1w\':l(6.1E(b))8 6.26(b.u).1o(\':4h\').F}8 a.F},4d:7(b,a){8 6.32[1g b]?6.32[1g b](b,a):w},32:{"5N":7(b,a){8 b},"1D":7(b,a){8!!$(b,a.L).F},"7":7(b,a){8 b(a)}},K:7(a){8!$.v.1N.15.V(6,$.1p(a.Z),a)&&"1S-1Y"},4c:7(a){l(!6.1h[a.u])
{6.1b++;6.1h[a.u]=w}},4b:7(a,b){6.1b--;l(6.1b<0)6.1b=0;T 6.1h[a.u];l(b&&6.1b==0&&6.1l&&6.L()){$(6.U).2s();6.1l=N}12 l(!b&&6.1b==0&&6.1l){$(6.U).3u("1f-L",[6]);6.1l=N}},2h:7(a){8 $.19(a,"2h")||$.19(a,"2h",{2M:4g,J:w,1j:6.2u(a,"1q")})}},1R:{15:{15:w},1J:{1J:w},1B:{1B:w},1A:{1A:w},2j:{2j:w},4a:{4a:w},1G:{1G:w},49:{49:w},1P:{1P:w},2f:{2f:w}},48:7(a,b){a.2c==4v?6.1R[a]=b:$.H(6.1R,a)},3V:7(b){p a={};p c=$(b).1s(\'5H\');c&&$.P(c.1I(\' \'),7(){l(6 11 $.v.1R){$.H(a,$.v.1R[6])}});8 a},3T:7(c){p a={};p d=$(c);Q(Y 11 $.v.1N){p b=d.1s(Y);l(b){a[Y]=b}}l(a.18&&/-1|5G|5C/.16(a.18)){T a.18}8 a},3Y:7(a){l(!$.1H)8{};p b=$.19(a.L,\'v\').q.3a;8 b?$(a).1H()[b]:$(a).1H()},36:7(b){p a={};p c=$.19(b.L,\'v\');l(c.q.1i){a=$.v.1X(c.q.1i[b.u])||{}}8 a},41:7(d,e){$.P(d,7(c,b){l(b===N){T d[c];8}l(b.2R||b.2p){p a=w;23(1g b.2p){1e"1D":a=!!$(b.2p,e.L).F;31;1e"7":a=b.2p.V(e,e);31}l(a){d[c]=b.2R!==20?b.2R:w}12{T d[c]}}});$.P(d,7(a,b){d[a]=$.44(b)?b(e):b});$.P([\'1y\',\'18\',\'1t\',\'1C\'],7(){l(d[6]){d[6]=2Z(d[6])}});
$.P([\'2i\',\'2r\'],7(){l(d[6]){d[6]=[2Z(d[6][0]),2Z(d[6][1])]}});l($.v.3J){l(d.1t&&d.1C){d.2r=[d.1t,d.1C];T d.1t;T d.1C}l(d.1y&&d.18){d.2i=[d.1y,d.18];T d.1y;T d.18}}l(d.G){T d.G}8 d},1X:7(a){l(1g a=="1D"){p b={};$.P(a.1I(/\\s/),7(){b[6]=w});a=b}8 a},5A:7(c,a,b){$.v.1N[c]=a;$.v.G[c]=b!=20?b:$.v.G[c];l(a.F<3){$.v.48(c,$.v.1X(c))}},1N:{15:7(c,d,a){l(!6.4d(a,d))8"1S-1Y";23(d.4f.4e()){1e\'2e\':p b=$(d).33();8 b&&b.F>0;1e\'1w\':l(6.1E(d))8 6.1O(c,d)>0;5y:8 $.1p(c).F>0}},1q:7(f,h,j){l(6.K(h))8"1S-1Y";p g=6.2h(h);l(!6.q.G[h.u])6.q.G[h.u]={};g.40=6.q.G[h.u].1q;6.q.G[h.u].1q=g.1j;j=1g j=="1D"&&{1B:j}||j;l(g.2M!==f){g.2M=f;p k=6;6.4c(h);p i={};i[h.u]=f;$.2U($.H(w,{1B:j,3Z:"2Y",3X:"17"+h.u,5w:"5u",19:i,1x:7(d){k.q.G[h.u].1q=g.40;p b=d===w;l(b){p e=k.1l;k.2P(h);k.1l=e;k.1n.27(h);k.1m()}12{p a={};p c=(g.1j=d||k.2u(h,"1q"));a[h.u]=$.44(c)?c(f):c;k.1m(a)}g.J=b;k.4b(h,b)}},j));8"1h"}12 l(6.1h[h.u]){8"1h"}8 g.J},1y:7(b,c,a){8 6.K(c)||6.1O($.1p(b),c)>=a},18:7(b,c,a){8 6.K(c)||6.1O($.1p(b),c)<=a},2i:
7(b,d,a){p c=6.1O($.1p(b),d);8 6.K(d)||(c>=a[0]&&c<=a[1])},1t:7(b,c,a){8 6.K(c)||b>=a},1C:7(b,c,a){8 6.K(c)||b<=a},2r:7(b,c,a){8 6.K(c)||(b>=a[0]&&b<=a[1])},1J:7(a,b){8 6.K(b)||/^((([a-z]|\\d|[!#\\$%&\'\\*\\+\\-\\/=\\?\\^X`{\\|}~]|[\\E-\\B\\C-\\x\\A-\\y])+(\\.([a-z]|\\d|[!#\\$%&\'\\*\\+\\-\\/=\\?\\^X`{\\|}~]|[\\E-\\B\\C-\\x\\A-\\y])+)*)|((\\3S)((((\\2m|\\1W)*(\\30\\3R))?(\\2m|\\1W)+)?(([\\3P-\\5q\\45\\42\\5D-\\5E\\3N]|\\5m|[\\5l-\\5k]|[\\5i-\\5K]|[\\E-\\B\\C-\\x\\A-\\y])|(\\\\([\\3P-\\1W\\45\\42\\30-\\3N]|[\\E-\\B\\C-\\x\\A-\\y]))))*(((\\2m|\\1W)*(\\30\\3R))?(\\2m|\\1W)+)?(\\3S)))@((([a-z]|\\d|[\\E-\\B\\C-\\x\\A-\\y])|(([a-z]|\\d|[\\E-\\B\\C-\\x\\A-\\y])([a-z]|\\d|-|\\.|X|~|[\\E-\\B\\C-\\x\\A-\\y])*([a-z]|\\d|[\\E-\\B\\C-\\x\\A-\\y])))\\.)+(([a-z]|[\\E-\\B\\C-\\x\\A-\\y])|(([a-z]|[\\E-\\B\\C-\\x\\A-\\y])([a-z]|\\d|-|\\.|X|~|[\\E-\\B\\C-\\x\\A-\\y])*([a-z]|[\\E-\\B\\C-\\x\\A-\\y])))\\.?$/i.16(a)},1B:7(a,b){8 6.K(b)||/^(5h?|5M):\\/\\/(((([a-z]|\\d|-|\\.|X|~|[\\E-\\B\\C-\\x\\A-\\y])|(%
[\\1U-f]{2})|[!\\$&\'\\(\\)\\*\\+,;=]|:)*@)?(((\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5]))|((([a-z]|\\d|[\\E-\\B\\C-\\x\\A-\\y])|(([a-z]|\\d|[\\E-\\B\\C-\\x\\A-\\y])([a-z]|\\d|-|\\.|X|~|[\\E-\\B\\C-\\x\\A-\\y])*([a-z]|\\d|[\\E-\\B\\C-\\x\\A-\\y])))\\.)+(([a-z]|[\\E-\\B\\C-\\x\\A-\\y])|(([a-z]|[\\E-\\B\\C-\\x\\A-\\y])([a-z]|\\d|-|\\.|X|~|[\\E-\\B\\C-\\x\\A-\\y])*([a-z]|[\\E-\\B\\C-\\x\\A-\\y])))\\.?)(:\\d*)?)(\\/((([a-z]|\\d|-|\\.|X|~|[\\E-\\B\\C-\\x\\A-\\y])|(%[\\1U-f]{2})|[!\\$&\'\\(\\)\\*\\+,;=]|:|@)+(\\/(([a-z]|\\d|-|\\.|X|~|[\\E-\\B\\C-\\x\\A-\\y])|(%[\\1U-f]{2})|[!\\$&\'\\(\\)\\*\\+,;=]|:|@)*)*)?)?(\\?((([a-z]|\\d|-|\\.|X|~|[\\E-\\B\\C-\\x\\A-\\y])|(%[\\1U-f]{2})|[!\\$&\'\\(\\)\\*\\+,;=]|:|@)|[\\5e-\\5T]|\\/|\\?)*)?(\\#((([a-z]|\\d|-|\\.|X|~|[\\E-\\B\\C-\\x\\A-\\y])|(%[\\1U-f]{2})|[!\\$&\'\\(\\)\\*\\+,;=]|:|@)|\\/|\\?)*)?$/i.16(a)},1A:7(a,b){8 6.K(b)||!/
5U|5c/.16(2w 5b(a))},2j:7(a,b){8 6.K(b)||/^\\d{4}[\\/-]\\d{1,2}[\\/-]\\d{1,2}$/.16(a)},1G:7(a,b){8 6.K(b)||/^-?(?:\\d+|\\d{1,3}(?:,\\d{3})+)(?:\\.\\d+)?$/.16(a)},1P:7(a,b){8 6.K(b)||/^\\d+$/.16(a)},2f:7(b,e){l(6.K(e))8"1S-1Y";l(/[^0-9-]+/.16(b))8 N;p a=0,d=0,2g=N;b=b.1u(/\\D/g,"");Q(p n=b.F-1;n>=0;n--){p c=b.59(n);p d=58(c,10);l(2g){l((d*=2)>9)d-=9}a+=d;2g=!2g}8(a%10)==0},43:7(b,c,a){a=1g a=="1D"?a.1u(/,/g,\'|\'):"57|56?g|55";8 6.K(c)||b.65(2w 3t(".("+a+")$","i"))},2o:7(c,d,a){p b=$(a).66(".17-2o").2I("3H.17-2o",7(){$(d).J()});8 c==b.33()}}});$.W=$.v.W})(1F);(7($){p c=$.2U;p d={};$.2U=7(a){a=$.H(a,$.H({},$.53,a));p b=a.3X;l(a.3Z=="2Y"){l(d[b]){d[b].2Y()}8(d[b]=c.1Q(6,R))}8 c.1Q(6,R)}})(1F);(7($){l(!1F.1r.38.2d&&!1F.1r.38.2J&&4i.3G){$.P({3g:\'2d\',3H:\'2J\'},7(b,a){$.1r.38[a]={50:7(){6.3G(b,2y,w)},4Z:7(){6.4Y(b,2y,w)},2y:7(e){R[0]=$.1r.2O(e);R[0].1V=a;8 $.1r.1T.1Q(6,R)}};7 2y(e){e=$.1r.2O(e);e.1V=a;8 $.1r.1T.V(6,e)}})};$.H($.2L,{2K:7(d,e,c){8 6.2I(e,7(a){p b=$(a.4X);l(b.2W(d)){8 c.1Q
(b,R)}})}})})(1F);',62,389,'||||||this|function|return|||||||||||||if||||var|settings||||name|validator|true|uFDCF|uFFEF||uFDF0|uD7FF|uF900||u00A0|length|messages|extend|element|valid|optional|form|Please|false|enter|each|for|arguments|errorList|delete|currentForm|call|format|_|method|value||in|else|toHide|elements|required|test|validate|maxlength|data|submitted|pendingRequest|errorClass|add|case|invalid|typeof|pending|rules|message|toShow|formSubmitted|showErrors|successList|filter|trim|remote|event|attr|min|replace|errorMap|input|success|minlength|console|date|url|max|string|checkable|jQuery|number|metadata|split|email|unhighlight|not|errorsFor|methods|getLength|digits|apply|classRuleSettings|dependency|handle|da|type|x09|normalizeRule|mismatch|submitButton|undefined|reset|addClass|switch|labelContainer||findByName|push|validClass|check|groups|currentElements|constructor|focusin|select|creditcard|bEven|previousValue|rangelength|dateISO|objectLength|focusInvalid|x20|parameters|equa
lTo|depends|debug|range|submit|wrapper|defaultMessage|removeClass|new|containers|handler|errors|hide|rulesCache|addWrapper|errorLabelContainer|showLabel|errorElement|clean|prepareForm|bind|focusout|validateDelegate|fn|old|delegate|fix|prepareElement|hideErrors|param|resetForm|window|ajax|characters|is|than|abort|Number|x0d|break|dependTypes|val|idOrName|submitHandler|staticRules|theregex|special|highlight|meta|cancelSubmit|eventType|defaults|click|catch|focus|findLastActive|button|size|ignoreTitle|ignore|defaultShowErrors|grep|errorContainer|selected|numberOfInvalids|error|find|RegExp|triggerHandler|checkForm|invalidHandler|onsubmit|nothing|option|checkbox|Array|radio|remove|text|makeArray|addEventListener|blur|init|autoCreateRanges|no|to|equal|x7f|and|x01|try|x0a|x22|attributeRules|lastActive|classRules|between|port|metadataRules|mode|originalMessage|normalizeRules|x0c|accept|isFunction|x0b|or|the|addClassRules|numberDE|dateDE|stopRequest|startRequest|depend|toLowerCase|nodeName|nu
ll|checked|document|errorPlacement|html|generated|map|invalidElements|show|validElements|parent|field|strong|errorContext|findDefined|String|customMessage|parentNode|customMetaMessage|id|lastElement|formatAndAdd|onfocusout|removeAttrs|cancel|assigned|has|disabled|image|blockFocusCleanup|focusCleanup|can|trigger|visible|onfocusin|label|slice|keyup|textarea|file|password|unshift|on|target|removeEventListener|teardown|setup|appendTo|warn|ajaxSettings|valueCache|gif|jpe|png|parseInt|charAt|prototype|Date|NaN|greater|uE000|unchecked|filled|https|x5d|less|x5b|x23|x21|blank|long|expr|x08|hidden|least|at|json|more|dataType|extension|default|with|addMethod|again|524288|x0e|x1f|same|2147483647|class|card|preventDefault|x7e|credit|ftp|boolean|only|getElementsByName|ISO|insertAfter|append|uF8FF|Invalid|wrap|URL|address|defined|No|Warning|This|title|setDefaults|returning|match|unbind|throw|onclick|checking|when|occured|onkeyup|removeAttr|exception|log|continue'.split('|'),0,{}))
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/profile/views/changePwd.php
----------------------------------------------------------------------
diff --git a/balance/modules/profile/views/changePwd.php b/balance/modules/profile/views/changePwd.php
deleted file mode 100644
index 04abcbb..0000000
--- a/balance/modules/profile/views/changePwd.php
+++ /dev/null
@@ -1,76 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Profile Manager:
- * This view allows user to change password
- */
-$module = App::Get()->loadModule();
-
-?>
-
- <div class="breadcrumbs">
- <a href="<?php echo SITE_ROOT?>/">Home</a>
- </div>
-
- <div class='span-22 append-1 prepend-1 last' id='profile_container'>
- <h1>Change Password</h1>
- <div id="submenu">
- <p>
- <a href="<?php echo $module->moduleRoot?>/manage"> Manage Profile</a>
- |
- <a href="<?php echo $module->moduleRoot?>/changePwd">Change Password</a>
- |
- <a href="<?php echo $module->moduleRoot?>/groups">Groups</a>
- </p>
- </div>
-
- <br class="space"/>
-
- <fieldset id='profile_fieldset'>
- <form id="signupform" autocomplete="off" method="post" action="<?php echo $module->moduleRoot?>/changePwd.do">
- <br class="space"/>
-
- <div class="span-4 prepend-1">
- <label for="password">Choose a password</label>
- </div>
- <div id="form_input" class="span-12">
- <input class="profile_input" id="password" name="password" type="password" maxlength="50" value="" />
- </div>
-
- <br class="space"/>
-
- <div class="span-4 prepend-1">
- <label for="password_confirm">Confirm password</label>
- </div>
- <div id="form_input" class="span-12">
- <input class="profile_input" id="password_confirm" name="password_confirm" type="password" maxlength="50" value="" />
- </div>
-
- <br class="space"/>
- <br class="space"/>
-
- <div class="span-10" align="center">
- <input class="profile_input" id="button_passwdReset" type="submit" value="Submit">
- </div>
-
- <br class="space"/>
- </form>
- </fieldset>
-
- </div>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/profile/views/createUser.php
----------------------------------------------------------------------
diff --git a/balance/modules/profile/views/createUser.php b/balance/modules/profile/views/createUser.php
deleted file mode 100644
index ebace80..0000000
--- a/balance/modules/profile/views/createUser.php
+++ /dev/null
@@ -1,184 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Profile Manager:
- * This view will allow user to create profile
- * includes validation
- *
- * This depends on the access granted by underlying directory service
- */
-$module = App::Get()->loadModule();
-
-?>
-
-<script type="text/javascript">
-
- $(document).ready(function() {
- // validate signup form on keyup and submit
- var validator = $("#signupform").validate({
- rules: {
- firstname: "required",
- lastname: "required",
- username: {
- required: true,
- minlength: 2,
- },
- password: {
- required: true,
- minlength: 5
- },
- password_confirm: {
- required: true,
- minlength: 5,
- equalTo: "#password"
- },
- email: {
- required: true,
- email: true,
- }
- },
- messages: {
- firstname: "Enter your firstname",
- lastname: "Enter your lastname",
- username: {
- required: "Enter a username",
- minlength: jQuery.format("Enter at least {0} characters"),
- },
- password: {
- required: "Provide a password",
- rangelength: jQuery.format("Enter at least {0} characters")
- },
- password_confirm: {
- required: "Repeat your password",
- minlength: jQuery.format("Enter at least {0} characters"),
- equalTo: "Enter the same password as above"
- },
- email: {
- required: "Please enter a valid email address",
- minlength: "Please enter a valid email address",
- },
- },
- // set this class to error-labels to indicate valid fields
- success: function(label) {
- // set as text for IE
- label.html(" ").addClass("checked");
- }
- });
-
- // propose username by combining first- and lastname
- $("#username").focus(function() {
- var firstname = $("#firstname").val();
- var lastname = $("#lastname").val();
- if(firstname && lastname && !this.value) {
- this.value = firstname + "." + lastname;
- }
- });
-
-});
-</script>
-
- <div class="breadcrumbs">
- <a href="<?php echo SITE_ROOT?>/">Home</a>
- </div>
-
- <div class='span-22 append-1 prepend-1 last' id='profile_container'>
- <h1>Obtaining Access</h1>
-
- <br class="space"/>
-
- <fieldset id='profile_fieldset'>
- <form id="signupform" autocomplete="off" method="post" action="<?php echo $module->moduleRoot?>/access.do">
- <br class="space"/>
-
- <div class="span-4 prepend-1">
- <label for="firstname">First Name</label>
- </div>
- <div class="span-15">
- <input class="profile_input" id="firstname" name="firstname" type="text" value="" maxlength="100" />
- </div>
-
- <br class="space"/>
-
- <div class="span-4 prepend-1">
- <label for="lastname">Last Name</label>
- </div>
- <div class="span-15">
- <input class="profile_input" id="lastname" name="lastname" type="text" value="" maxlength="100" />
- </div>
-
- <br class="space"/>
-
- <div class="span-4 prepend-1">
- <label for="username">Desired Login Name</label>
- </div>
- <div class="span-15">
- <input class="profile_input" id="username" name="username" type="text" value="" maxlength="50" />
- </div>
-
- <br class="space"/>
-
- <div class="span-4 prepend-1">
- <label for="email">Email</label>
- </div>
- <div class="span-15">
- <input class="profile_input" id="email" name="email" type="text" value="" maxlength="150" />
- </div>
-
- <br class="space"/>
- <br class="space"/>
-
- <div class="span-4 prepend-1">
- <label for="password">Choose a password</label>
- </div>
- <div class="span-15">
- <input class="profile_input" id="password" name="password" type="password" maxlength="50" value="" />
- </div>
-
- <br class="space"/>
-
- <div class="span-4 prepend-1">
- <label for="password_confirm">Confirm password</label>
- </div>
- <div class="span-15">
- <input class="profile_input" id="password_confirm" name="password_confirm" type="password" maxlength="50" value="" />
- </div>
-
- <br class="space"/>
- <br class="space"/>
-
- <div class="span-10" align="center">
- <input class="profile_input" id="button_new_account" type="submit" value="Submit">
- </div>
-
- <br class="space"/>
- </form>
- </fieldset>
- </div>
-
-
-<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
-</script>
-<script type="text/javascript">
-_uacct = "UA-2623402-1";
-urchinTracker();
-</script>
-
-
-
-
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/profile/views/groups.php
----------------------------------------------------------------------
diff --git a/balance/modules/profile/views/groups.php b/balance/modules/profile/views/groups.php
deleted file mode 100644
index 284893e..0000000
--- a/balance/modules/profile/views/groups.php
+++ /dev/null
@@ -1,82 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Profile Manager:
- * This view will expose the user groups and roles for the user.
- */
-$module = App::Get()->loadModule();
-
-// Get instance of authentication and authorization class
-$authorization = App::Get()->getAuthorizationProvider();
-$authentication = App::Get()->getAuthenticationProvider();
-
-if ( $authorization != false) {
- $groups = $authorization->retrieveGroupsForUser($authentication->getCurrentUsername(),App::Get()->settings['authorization_ldap_group_dn']);
-}
-
-?>
-
- <div class="breadcrumbs">
- <a href="<?php echo SITE_ROOT?>/">Home</a>
- </div>
-
- <div class='span-22 append-1 prepend-1 last' id='profile_container'>
- <h1><?php echo $authentication->getCurrentUsername() ?>'s Groups </h1>
- <div id="submenu">
- <p>
- <a href="<?php echo $module->moduleRoot ?>/manage"> Manage Profile</a>
- |
- <a href="<?php echo $module->moduleRoot?>/changePwd">Change Password</a>
- |
- <a href="<?php echo $module->moduleRoot?>/groups">Groups</a>
- </p>
- </div>
-
- <br class="space"/>
-
- <fieldset id='profile_fieldset'>
- <?php
-
- if (count($groups) > 0) {
- echo "<div class='span-15 prepend-1'>";
- foreach ($groups as $g) {
- List($group, $role) = explode("_", $g);
-
- if( $group != $groupIndex ) {
- echo "</ul></ul>";
- echo "<br class='space'>";
- echo "<h3>{$group}</h3>";
- echo "<ul><ul>";
- $groupIndex = $group;
- }
- echo "<li>";
- echo $role;
- echo "</li>";
- echo "<br class='space'>";
- }
-
- echo "</div>";
- } else{
- echo "<h4> No Groups found!</h4>";
- }
- ?>
- </fieldset>
- <br class='space'>
- </div>
-
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/profile/views/index.php
----------------------------------------------------------------------
diff --git a/balance/modules/profile/views/index.php b/balance/modules/profile/views/index.php
deleted file mode 100644
index a7b70be..0000000
--- a/balance/modules/profile/views/index.php
+++ /dev/null
@@ -1,81 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Profile Manager:
- * This view will expose the profile attributes specified in the config.ini (profile_attributes).
- */
-$module = App::Get()->loadModule();
-
-function displayAttributes($userAttr) {
-
- $str = '';
- foreach ($userAttr as $key=>$keyValue) {
- foreach (App::Get()->settings['attr_titles'] as $attrTitle=>$value) {
- if ( $key === $value) {
- $str .= '<div class="span-13 prepend-1"><h4 align="left">';
- $str .= $attrTitle;
- $str .= '</h4></div>';
-
- $str .= '<div class="span-5"><h6 align="left">';
- $str .= $keyValue;
- $str .= '</h6></div>';
- }
- }
- }
- return $str;
-}
-
- // Get user attributes
- $userAttr = App::Get()->getAuthenticationProvider()->retrieveUserAttributes(
- App::Get()->getAuthenticationProvider()->getCurrentUsername(), App::Get()->settings['profile_attributes'] );
-
-?>
-
- <div class="breadcrumbs">
- <a href="<?php echo SITE_ROOT?>/">Home</a>
- </div>
-
- <div class='span-22 append-1 prepend-1 last' id='profile_container'>
- <h1>Welcome <?php echo $userAttr[ App::Get()->settings['firstname_attr'] ] ?>! </h1>
- <div id="submenu">
- <p>
- <a href="<?php echo $module->moduleRoot ?>/manage"> Manage Profile</a>
- |
- <a href="<?php echo $module->moduleRoot?>/changePwd">Change Password</a>
- |
- <a href="<?php echo $module->moduleRoot?>/groups">Groups</a>
- </p>
- </div>
-
- <br class="space"/>
-
- <h3>Profile</h3>
- <fieldset id='profile_fieldset'>
- <br class="space"/>
- <br class="space"/>
-
- <?php echo displayAttributes($userAttr) ?>
-
- <br class="space"/>
- </fieldset>
-
- <br class="space"/>
-
- </div>
-
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/profile/views/login.php
----------------------------------------------------------------------
diff --git a/balance/modules/profile/views/login.php b/balance/modules/profile/views/login.php
deleted file mode 100644
index 2df3b2c..0000000
--- a/balance/modules/profile/views/login.php
+++ /dev/null
@@ -1,71 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Profile Manager:
- * Login page
- */
-$module = App::Get()->loadModule();
-
-// If a user is already logged in, redirect to home page
-if( App::Get()->getAuthenticationProvider()->isLoggedIn() ) App::Get()->Redirect(SITE_ROOT . "/");
-
-?>
-
- <div class="breadcrumbs">
- <a href="<?php echo SITE_ROOT?>/">Home</a>
- </div>
-
- <div class='span-22 append-1 prepend-1 last' id='profile_container'>
- <h1>Please log in to continue...</h1>
-
- <br class="space"/>
-
- <fieldset id='profile_fieldset'>
- <form id="signupform" autocomplete="off" method="post" action="<?php echo $module->moduleRoot ?>/login.do">
- <br class="space"/>
- <br class="space"/>
-
- <div class="span-2 prepend-1">
- <label for="username">Username</label>
- </div>
- <div class="span-15">
- <input class="profile_input" id="username" name="username" type="text" value="" maxlength="50" />
- </div>
-
- <br class="space"/>
-
- <div class="span-2 prepend-1">
- <label for="password">Password</label>
- </div>
- <div class="span-15">
- <input class="profile_input" id="password" name="password" type="password" maxlength="50" value="" />
- </div>
-
- <br class="space"/>
- <br class="space"/>
-
- <div class="span-10" align="center">
- <input class="profile_input" id="button_new_account" type="submit" value="Submit">
- </div>
-
- <br class="space"/>
- <br class="space"/>
- </form>
- </fieldset>
- </div>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/profile/views/manage.php
----------------------------------------------------------------------
diff --git a/balance/modules/profile/views/manage.php b/balance/modules/profile/views/manage.php
deleted file mode 100644
index 62178cf..0000000
--- a/balance/modules/profile/views/manage.php
+++ /dev/null
@@ -1,87 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Profile Manager:
- * This view will expose the profile attributes specified in the config.ini
- * (profile_modify_attributes) and will allow user to modify values in the LDAP directory.
- */
-$module = App::Get()->loadModule();
-
-function manageAttribute() {
- $userAttr = App::Get()->getAuthenticationProvider()->retrieveUserAttributes(
- App::Get()->getAuthenticationProvider()->getCurrentUsername(), App::Get()->settings['profile_modify_attributes'] );
- $str = '';
- foreach ($userAttr as $key=>$keyValue) {
- foreach (App::Get()->settings['attr_titles'] as $attrTitle=>$value) {
- if ( $key != App::Get()->settings['username_attr']) {
-
- if ( $key === $value) {
- $str .= '<div class="span-3 prepend-1"><label for="';
- $str .= $key . '"> ' . $attrTitle;
- $str .= '</label></div>';
-
- $str .= '<div class="span-12"><input class="profile_input" type="text" maxlength="100" id=';
- $str .= $key . ' name=' . $key . ' value=' . $keyValue;
- $str .= '></div>';
- $str .= '<br class="space"/>';
- }
- }
- }
- }
-
- return $str;
-}
-?>
-
- <div class="breadcrumbs">
- <a href="<?php echo SITE_ROOT?>/">Home</a>
- </div>
-
- <div class='span-22 append-1 prepend-1 last' id='profile_container'>
- <h1>Manage Your Profile</h1>
- <div id="submenu">
- <p>
- <a href="<?php echo $module->moduleRoot?>/manage"> Manage Profile</a>
- |
- <a href="<?php echo $module->moduleRoot?>/changePwd">Change Password</a>
- |
- <a href="<?php echo $module->moduleRoot?>/groups">Groups</a>
- </p>
- </div>
-
- <br class="space"/>
-
- <fieldset id='profile_fieldset'>
- <form id="signupform" autocomplete="off" method="post" action="<?php echo $module->moduleRoot?>/manage.do">
- <br class="space"/>
-
- <?php echo manageAttribute()?>
-
- <br class="space"/>
- <br class="space"/>
-
- <div class="span-10" align="center">
- <input class="profile_input" type="submit" value="Submit" name="submit_button">
- </div>
-
- <br class="space"/>
- </form>
- </fieldset>
-
- </div>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/profile/views/passwordChangeConfirmed.php
----------------------------------------------------------------------
diff --git a/balance/modules/profile/views/passwordChangeConfirmed.php b/balance/modules/profile/views/passwordChangeConfirmed.php
deleted file mode 100644
index de28203..0000000
--- a/balance/modules/profile/views/passwordChangeConfirmed.php
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Profile Manager:
- * Display confirmation of password change and allow user to log back in
- */
-$module = App::Get()->loadModule();
-
-?>
-
- <div class="breadcrumbs">
- <a href="<?php echo SITE_ROOT?>/">Home</a>
- </div>
-
- <div class='span-22 append-1 prepend-1 last' id="profile_container">
- <div class="span-24">
- <br>
- <h3>Password has been changed.</h3>
- <br>
- </div>
-
- <div class="span-22">
- <h5><a href="<?php echo $module->moduleRoot?>/login">Please log in with new password.</a></h5>
- </div>
- <br class="space"/>
-
- </div>
-
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/README.txt
----------------------------------------------------------------------
diff --git a/balance/modules/puny/README.txt b/balance/modules/puny/README.txt
deleted file mode 100644
index 021c530..0000000
--- a/balance/modules/puny/README.txt
+++ /dev/null
@@ -1,115 +0,0 @@
-Puny - Lightweight content editor for Balance applications
-==========================================================
-
-Puny is a lightweight content editing module for Balance applications. Puny makes
-it easy for developers to add user-editable sections of content to their application
-views and supports real-time, in-place editing of the content.
-
-Overview
---------
-
-Puny makes it easier to separate content from presentation and separate the
-role of the site developer and the content manager. As its name implies, it
-provides the bare minimum necessary to accomplish this -- based on the
-understanding that excellent, full-fledged Content Management System options
-are readily available and more appropriate for content-heavy sites. Puny simply
-provides a way for sites that are not generally suited to a CMS to nevertheless
-reap the benefits of real-time, in-browser content editing by a user not
-intimately familiar with HTML.
-
-How it Works
-------------
-
-Developers embed 'containers' in their views, and content editors provide the
-content that get displayed in the containers. Puny loads up the most recent
-version of the content from the data store, renders it using the specified
-parser, and places the rendered text into the view container.
-
-By logging in with the editor credentials, a user can visually see the editable
-'containers' on the application views, and, using a javascript-enabled browser,
-can provide inline, real-time edits, creating a new version of the content.
-
-
-
-### Flexibility ###
-
-Puny has been designed so that it is easy to plug in custom back end data
-stores (MySql, MongoDB, SQLite, etc) and template engines (Markdown, Textile,
-bbcode, etc). If a driver for <insert data store or parser here> doesn't exist,
-there are two primary extension points: Puny_DataStore (a base class for developing
-drivers for data stores), and Puny_Parser (a base class for interfacing with text
-parsers and template engines). Using the examples in the /classes/data and
-/classes/parsers, it should be relatively easy to develop additional drivers.
-
-
-Installation
-------------
-
-Copy the Puny module (this directory) to the /modules directory of
-your Balance application.
-
-
-Configuration
--------------
-
-All configuration for Puny takes place in the module's 'config.ini' file. See
-the inline documentation in 'config.ini' for detailed information about each
-configuration option.
-
-
-Developer Guide
----------------
-
-### Including Puny in your application
-
-In general, Puny needs to be available on each application view. To avoid having to load
-the module at the top of each view, it is possible to include the module once,in the
-Balance index.php at the root of your application. Simply add the following lines to the
-'index.php' file where it says 'Initialize any globally required modules here':
-
-// Puny initialization
-App::Get()->loadModule('puny');
-require_once(App::Get()->settings['puny_module_path'] . '/classes/Puny.class.php');
-
-
-### Installing your data store ###
-
-Look in the /schemas folder in the Puny module for a schema compatible with your datastore
-driver. Install the schema using whatever method is most appropriate for the technology. The
-default driver is the PDO driver implemented in ./classes/data/Puny_PdoDataStore.class.php.
-The MySQL schema compatible with this driver is in ./schemas/puny.pdo.mysql.sql. Copy this
-file and import it into the database you configured in the configuration step above.
-
-
-### Including Puny containers in your application views ###
-
-The easiest way to include Puny containers in your application views is:
-
-<?php echo Puny::container()->load('resourceid');?>
-
-By default, container creates a '<div>' element and loads the content into it. To use
-something other than a '<div>' simply specify the html element to the container() function:
-
-<?php echo Puny::container('span')->load('resourceid');?>
-
-It is also possible to specify arbitrary attributes to attach to your container. Examples
-include a DOM id, CSS class(es), style attribute, alt, rel, or anything else. This is
-accomplished by passing an associative array as the second parameter to container() where
-the array keys are the attribute names, and the values are the attribute values.
-
-<?php echo Puny::container('div',array('id'=>'mydiv','class'=>'foo bar'))->load('resourceid');?>
-
-
-### Allowing editors to log in and edit ###
-
-Somewhere in your application, there should be a login link that allows editors to log in
-and make edits to content. This is easily accomplished by adding the following line wherever
-you want the login link to appear:
-
-<?php echo Puny::status();?>
-
-This will display either a login or logout link, depending on whether or not an editor
-is currently logged in.
-
-
-That's all there is to it, it lives up to its name.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/classes/Puny.class.php
----------------------------------------------------------------------
diff --git a/balance/modules/puny/classes/Puny.class.php b/balance/modules/puny/classes/Puny.class.php
deleted file mode 100644
index 67ed6bc..0000000
--- a/balance/modules/puny/classes/Puny.class.php
+++ /dev/null
@@ -1,166 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-require_once( dirname(__FILE__) . '/Puny_Container.class.php');
-require_once( dirname(__FILE__) . '/Puny_Resource.class.php');
-
-/**
- * Puny
- *
- * Light-weight content editing for Balance applications. Puny makes it easy
- * to add editable sections of content to your application views and supports
- * real-time, in-place editing.
- *
- * Puny has been designed so that it is easy to plug in custom back end data
- * stores (MySql, MongoDB, SQLite, etc) and template engines (Markdown, Textile,
- * bbcode, etc). Use what makes sense for your project, and if what you want
- * is not yet supported, writing a Puny driver for a datastore or template
- * engine is a piece of cake. There are examples of each in the /classes/data and
- * /classes/parsers directories.
- *
- * @author ahart
- */
-
-class Puny {
-
- protected static $datastore = null;
-
- protected static $commonResourcesLoaded = false;
-
- protected static $editorResourcesLoaded = false;
-
- protected static function init() {
-
- // Only if the datastore has not yet been initialized...
- if (!self::$datastore) {
- try {
- // Obtain datastore configuration details
- $datastoreClass = App::Get()->settings['puny_datastore_classname'];
- require_once( App::Get()->settings['puny_datastore_classpath'] );
-
- // Create an instance of the datastore connector
- self::$datastore = new $datastoreClass();
-
- // Connect to the datastore
- self::$datastore->connect();
- } catch ( Exception $e ) {
- throw new Exception("Error instantiating Puny. "
- . "The underlying cause was: " . $e->getMessage());
- }
- }
-
- self::injectCommonResources();
- self::injectEditorResources();
- }
-
- public static function load( $resourceId, $version = null, $parseContent = true ) {
-
- self::init();
-
- // Load the raw data from the data store...
- if (false !== ($resource = self::$datastore->load( $resourceId, $version ))) {
-
- // If a valid resource was found, return it
- return ($parseContent) ? $resource->parse() : $resource;
-
- } else {
-
- // Otherwise, return an empty resource with the requested id
- return new Puny_Resource( array("resourceId" => $resourceId, "content" => $resourceId) );
-
- }
- }
-
- public static function store (Puny_Resource $resource ) {
-
- self::init();
-
- // Persist the resource to the datastore
- self::$datastore->store( $resource );
-
- }
-
- public static function isEditing() {
- return ( isset($_SESSION['puny']) && $_SESSION['puny']['editing'] === true );
- }
-
- public function initializeEditorSession() {
- $_SESSION['puny'] = array('editing' => true, 'sessionStart' => time());
- }
-
- public static function destroyEditorSession() {
- unset($_SESSION['puny']);
- }
-
- public static function status() {
- if (self::isEditing()) {
- return "<a href='".App::Get()->settings['puny_module_root']."/logout'>Logout</a>";
- } else {
- return "<a href='".App::Get()->settings['puny_module_root']."/login'>Login</a>";
- }
- }
-
- protected static function injectCommonResources() {
- // Inject the environmental information needed for the javascript libraries
- // to function as expected...
- if ( !self::$commonResourcesLoaded ) {
- $js = "\r\n"
- . "var puny_module_root = '" . trim(App::Get()->settings['puny_module_root']) . "'\r\n"
- . " puny_module_static = '" . trim(App::Get()->settings['puny_module_static']) ."'\r\n"
- . " puny_current_url = '" . $_SERVER['HTTP_REFERER'] ."';\r\n";
- App::Get()->response->addJavascript( $js, true ); // raw Javascript
-
- // Add puny default styles
- $staticPath = trim(App::Get()->settings['puny_module_static']);
- App::Get()->response->addStylesheet($staticPath . '/css/defaults.css');
- App::Get()->response->addJavascript($staticPath . '/js/jquery-1.7.2.min.js');
- self::$commonResourcesLoaded = true;
- }
- }
-
- protected static function injectEditorResources() {
- // Only inject resources if we are editing and they have not already been loaded...
- $segments = App::Get()->request->uri;
- $staticPath = trim(App::Get()->settings['puny_module_static']);
- if ( self::isEditing() && strstr($segments,'edit') != false) {
-
- App::Get()->response->addJavascript($staticPath . '/js/gollum.js');
- App::Get()->response->addJavascript($staticPath . '/js/gollum.dialog.js');
- App::Get()->response->addJavascript($staticPath . '/js/gollum.placeholder.js');
- App::Get()->response->addJavascript($staticPath . '/js/editor/gollum.editor.js');
-
- App::Get()->response->addStylesheet($staticPath . '/css/github.css');
- App::Get()->response->addStylesheet($staticPath . '/css/editor.css');
- App::Get()->response->addStylesheet($staticPath . '/css/dialog.css');
- }
- if ( self::isEditing() && !self::$editorResourcesLoaded ) {
-
- App::Get()->response->addJavascript($staticPath . '/js/puny.js');
- App::Get()->response->addStylesheet($staticPath . '/css/puny.css');
- self::$editorResourcesLoaded = true;
- }
- }
-
- public static function container( $htmlElmt = 'div' , $extra = array()) {
-
- self::init();
-
- // Create a new Puny_Container object according to the provided info
- return new Puny_Container($htmlElmt, $extra);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/classes/Puny_Container.class.php
----------------------------------------------------------------------
diff --git a/balance/modules/puny/classes/Puny_Container.class.php b/balance/modules/puny/classes/Puny_Container.class.php
deleted file mode 100644
index 97b786b..0000000
--- a/balance/modules/puny/classes/Puny_Container.class.php
+++ /dev/null
@@ -1,85 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-require_once(dirname(__FILE__) . '/Puny.class.php');
-
-/**
- * Puny_Container
- *
- * This class provides convenience methods for creating an HTML container
- * around a Puny_Resource. Puny_Container removes the need for developers
- * to manually annotate HTML with the puny="..." attribute (so that the
- * Puny javascript in-place editor functions on the resource).
- *
- * @author ahart
- */
-class Puny_Container {
-
- protected $htmlElement;
- protected $attributes;
-
- /**
- * Constructor
- *
- * @param string $elmt The html element to use as a container (e.g.: 'div','span')
- * @param array $attributes (optional) an associative array of attributes to
- * attach to the html container element. e.g:
- * array("id" => 'foo', "class" => "bar baz");
- */
- public function __construct( $elmt = 'div', $attributes = array() ) {
-
- $this->htmlElement = $elmt;
- $this->attributes = $attributes;
- }
-
- /**
- * Load a resource into this container
- *
- * This function simply calls the Puny::load function and returns
- * wraps the result in the container html
- *
- * @param string $resourceId The unique id of the resource to load
- * @param int $version (optional) The version to load (default = latest)
- * @returns string
- */
- public function load( $resourceId, $version = null ) {
- return $this->render( Puny::load( $resourceId, $version, false ));
- }
-
-
- /**
- * Helper function for rendering a resource inside this container
- *
- * @param unknown_type $resource
- * @access protected
- */
- protected function render($resource) {
-
- $html = "<{$this->htmlElement}";
-
- foreach ($this->attributes as $k => $v) {
- $html .= " {$k}=\"{$v}\"";
- }
-
- $html .= " puny=\"{$resource->getId()}\">"
- . "{$resource->parse()->getContent()}"
- . "</{$this->htmlElement}>";
-
- return $html;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/classes/Puny_Resource.class.php
----------------------------------------------------------------------
diff --git a/balance/modules/puny/classes/Puny_Resource.class.php b/balance/modules/puny/classes/Puny_Resource.class.php
deleted file mode 100644
index fe7c568..0000000
--- a/balance/modules/puny/classes/Puny_Resource.class.php
+++ /dev/null
@@ -1,163 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Puny_Resource
- *
- * Represents a piece of content being managed by Puny.
- *
- * The Puny_Resource class is a wrapper around a piece of editable
- * content (a resource). The class provides a number of convenience
- * functions for interacting with content.
- *
- * @author ahart
- */
-class Puny_Resource {
-
- protected $id; // The unique id for this resource
- protected $version = 0; // The version number for this resource
- protected $content; // The resource raw content
- protected $parser = 'markdown'; // The parser label for this resource
- protected $parsedContent; // The resource parsed content
-
- /**
- * Constructor
- *
- * Optionally provide an associative array containing
- * the data to use when initializing this object.
- *
- * @param array $data (optional) data to use when initializing the object
- */
- public function __construct($data = array()) {
- $this->id = isset($data['resourceId']) ? $data['resourceId'] : false;
- $this->version = isset($data['version']) ? $data['version'] : 0;
- $this->content = isset($data['content']) ? $data['content'] : '';
- $this->parser = isset($data['parser']) ? $data['parser'] : 'markdown';
- $this->parsedContent = isset($data['parsedContent']) ? $data['parsedContent'] : '';
- }
-
- /**
- * Get the unique id for this resource
- * @returns String
- */
- public function getId() {
- return $this->id;
- }
-
- /**
- * Increment the version number for this resource
- * @returns Puny_Resource
- */
- public function incrementVersion() {
- $this->version += 1;
- return $this; // allow method chaining
- }
-
- /**
- * Return the version number for this resource
- * @returns int
- */
- public function getVersion() {
- return $this->version;
- }
-
- /**
- * Get the parser label for this resource. The parser
- * label is a text label which should correspond to
- * one of the entries in the 'parsers' section of the
- * Puny module's config.ini file.
- */
- public function getParser() {
- return $this->parser;
- }
-
- /**
- * Set the parser label for this resource.
- *
- * @param string $label The parser label to use
- */
- public function setParser( $label ) {
- $this->parser = $label;
- return $this; // allow method chaining
- }
-
- /**
- * Get either the parsed or raw resource content.
- *
- * @param boolean $raw (default=false) return raw content?
- * @returns string
- */
- public function getContent( $raw = false ) {
- return ($raw) ? $this->content : $this->parsedContent;
- }
-
- /**
- * set the raw content for this resource.
- * @param string $val The raw content for this resource
- * @returns Puny_Resource
- */
- public function setContent( $val ) {
- $this->content = $val;
- return $this; // allow method chaining
- }
-
- /**
- * Parse the raw contents of this resourse
- *
- * This function uses the parser label associated with this
- * resource to determine the parser to use, instantiates a
- * parser instance, and parses the raw content. The result
- * is stored in $this->parsedContent.
- *
- * @throws Exception
- * @returns Puny_Resource
- */
- public function parse() {
- // Determine the parser to use
- $parserLabel = $this->getParser();
-
- // Ensure the appropriate parser has been required
- $parsers = App::Get()->settings['puny_parser'];
- if ( !in_array( $parserLabel, array_keys( $parsers ) ) ) {
- throw new Exception("Error instantiating parser: "
- . "label '{$parserLabel}' not configured. ");
- } else {
- require_once( $parsers[$parserLabel] );
- }
-
- // Load the parser
- $parserClassName = 'Puny_' . ucfirst($parserLabel) . 'Parser';
- $parser = new $parserClassName();
-
- // Expand Balance constants:
- // ([SITE_ROOT], [MODULE_ROOT], [MODULE_PATH], [MODULE_STATIC])
- $content = str_replace('[SITE_ROOT]',SITE_ROOT, stripslashes($this->content));
- $moduleInfo = App::Get()->loadModule();
- if ($moduleInfo) {
- $content = str_replace('[MODULE_ROOT]',$moduleInfo->moduleRoot, $content);
- $content = str_replace('[MODULE_PATH]',$moduleInfo->modulePath, $content);
- $content = str_replace('[MODULE_STATIC]',$moduleInfo->moduleStatic, $content);
- }
-
- // Store the parsed contents
- $this->parsedContent = $parser->parse( $content );
-
- // Allow method chaining
- return $this;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/classes/data/Puny_DataStore.class.php
----------------------------------------------------------------------
diff --git a/balance/modules/puny/classes/data/Puny_DataStore.class.php b/balance/modules/puny/classes/data/Puny_DataStore.class.php
deleted file mode 100644
index d850dc6..0000000
--- a/balance/modules/puny/classes/data/Puny_DataStore.class.php
+++ /dev/null
@@ -1,69 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Puny_DataStore
- *
- * Base class for Puny data store implementations
- *
- * @abstract
- *
- * @author ahart
- */
-abstract class Puny_DataStore {
-
- protected $host;
- protected $username;
- protected $password;
- protected $dbname;
-
- protected $link;
-
- /**
- * Connect to the data store
- *
- */
- public abstract function connect();
-
- /**
- * Disconnect from the data store
- */
- public abstract function disconnect();
-
- /**
- * Request a resource from the data store. Optionally
- * specify a particular version of the resource to fetch.
- *
- * @param string $resourceId The unique id of the resource
- * @param integer $version (Optional) the version to retrieve. Default = latest.
- */
- public abstract function load( $resourceId, $version = null );
-
- /**
- * Store a new version of a resource. For simplicity, versions are
- * immutable. That is, every time a resource is stored, its version is
- * first incremented and a new record is created. Implemenations should
- * take care to automatically increment the version number of the
- * resource before persisting to the datastore.
- *
- * @param string $resourceId The unique id of the resource
- * @param string $content The content to store
- */
- public abstract function store( Puny_Resource $resource );
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/classes/data/Puny_LocalFileDataStore.class.php
----------------------------------------------------------------------
diff --git a/balance/modules/puny/classes/data/Puny_LocalFileDataStore.class.php b/balance/modules/puny/classes/data/Puny_LocalFileDataStore.class.php
deleted file mode 100644
index df52079..0000000
--- a/balance/modules/puny/classes/data/Puny_LocalFileDataStore.class.php
+++ /dev/null
@@ -1,79 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Require the abstract parent class definition
-require_once( dirname(__FILE__) . '/Puny_DataStore.class.php');
-
-/**
- * An implementation of the Puny_DataStore class that persists
- * content to ascii text files.
- *
- * @author ahart
- */
-class Puny_LocalFileDataStore extends Puny_DataStore {
-
- protected $dataDirectory;
-
- public function connect() {
- $this->dataDirectory = App::Get()->settings['puny_datastore_localfile_dir'];
-
- // Ensure we can write to the directory
- if (!is_writeable($this->dataDirectory)) {
- throw new Exception("Puny can not write to the specified data directory");
- }
- }
-
- public function disconnect() {
- //noop
- }
-
- public function load( $resourceId, $version = null ) {
-
- // The LocalFile data store does not currently support
- // the concept of 'versions'. It could, but is the
- // added complexity really worth it? This is really
- // intended as a development tool, with the assumption
- // that one of the more full-featured data store
- // implementations (e.g.: PDO, Mongo) will ultimately
- // be used.
-
- // Build the full path from the resourceId
- $path = $this->dataDirectory . '/' . $resourceId . ".txt";
-
- if (file_exists( $path ) ) {
- $content = file_get_contents($path);
- $resource = array(
- "resourceId" => $resourceId
- , "content" => $content
- );
- return new Puny_Resource($resource);
- } else {
- return false;
- }
- }
-
- public function store ( Puny_Resource $resource ) {
-
- // Build the full path from the resourceId
- $path = $this->dataDirectory . '/' . $resource->getId() . ".txt";
-
- // Store the latest content
- file_put_contents($path, $resource->getContent(true)); // raw, unparsed content
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/classes/data/Puny_MongoDataStore.class.php
----------------------------------------------------------------------
diff --git a/balance/modules/puny/classes/data/Puny_MongoDataStore.class.php b/balance/modules/puny/classes/data/Puny_MongoDataStore.class.php
deleted file mode 100644
index a5482af..0000000
--- a/balance/modules/puny/classes/data/Puny_MongoDataStore.class.php
+++ /dev/null
@@ -1,75 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Require the abstract parent class definition
-require_once( dirname(__FILE__) . '/Puny_DataStore.class.php');
-
-/**
- * A MongoDB implementation of the Puny_DataStore class.
- *
- * @author ahart
- */
-class Puny_MongoDataStore extends Puny_DataStore {
-
- protected $collection;
-
- public function connect() {
- $dbname = App::Get()->settings['puny_datastore_mongo_db'];
- $coll = App::Get()->settings['puny_datastore_mongo_collection'];
- $this->link = new Mongo();
- $this->dbname = $this->link->selectDB($dbname);
- $this->collection = $this->dbname->$coll;
- }
-
- public function disconnect() {
- if ($this->link) {
- $this->link->close();
- }
- }
-
- public function load( $resourceId, $version = null ) {
- // Build criteria for loading...
- $criteria = array("resourceId" => $resourceId);
-
- // If a version is specified...
- if ($version !== null) {
- $criteria['version'] = $version;
- $doc = $this->collection->findOne( $criteria );
- }
-
- // Otherwise...
- else {
- $cursor = $this->collection->find(array("resourceId" => $resourceId));
- $cursor->sort(array('version' => -1));
- $doc = $cursor->getNext();
- }
-
- // Return whatever was found...
- return ($doc) ? new Puny_Resource( $doc ) : false;
- }
-
- public function store ( Puny_Resource $resource ) {
- $doc = array(
- "resourceId" => $resource->getId()
- , "version" => time()
- , "parser" => $resource->getParser()
- , "content" => $resource->getContent( true )); // raw, unparsed content
-
- $this->collection->insert( $doc );
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/classes/data/Puny_PdoDataStore.class.php
----------------------------------------------------------------------
diff --git a/balance/modules/puny/classes/data/Puny_PdoDataStore.class.php b/balance/modules/puny/classes/data/Puny_PdoDataStore.class.php
deleted file mode 100644
index b630f30..0000000
--- a/balance/modules/puny/classes/data/Puny_PdoDataStore.class.php
+++ /dev/null
@@ -1,111 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Require the abstract parent class definition
-require_once( dirname(__FILE__) . '/Puny_DataStore.class.php');
-
-
-/**
- * A PDO implementation of the Puny_DataStore class.
- *
- * @author ahart
- */
-class Puny_PdoDataStore extends Puny_DataStore {
-
- protected $driver = 'mysql';
- protected $tablePrefix = 'puny_';
-
- /**
- * (non-PHPdoc)
- * @see Puny_DataStore::connect()
- * @throws PDOException
- */
- public function connect() {
- $this->host = App::Get()->settings['puny_datastore_pdo_host'];
- $this->username = App::Get()->settings['puny_datastore_pdo_username'];
- $this->password = App::Get()->settings['puny_datastore_pdo_password'];
- $this->dbname = App::Get()->settings['puny_datastore_pdo_dbname'];
- $this->driver = App::Get()->settings['puny_datastore_pdo_driver'];
- $this->tablePrefix = App::Get()->settings['puny_datastore_pdo_tablePrefix'];
-
- $dsn = $this->driver . ':host=' . $this->host . ';dbname=' . $this->dbname;
- $this->link = new PDO( $dsn, $this->username, $this->password );
- }
-
- /**
- * (non-PHPdoc)
- * @see Puny_DataStore::disconnect()
- */
- public function disconnect() {
- if ($this->link)
- $this->link = null;
- }
-
- public function load( $resourceId, $version = null) {
-
- // Request the specified resource...
- $sql = "SELECT * FROM `{$this->tablePrefix}resource` WHERE `resourceId`=:resourceId ";
- $data = array('resourceId' => $resourceId);
-
- // If a version is specified, explicitly request that version...
- if ($version != null) {
- $sql .= " AND `version`=:version ";
- $data['version'] = $version;
- }
-
- // Otherwise, simply get the latest version...
- else {
- $sql .= " ORDER BY `version` DESC ";
- }
-
- // Limit our results to at most one result...
- $sql .= " LIMIT 1 ";
-
- // Prepare and execute the query using the provided data...
- $stmt = $this->link->prepare( $sql );
- $stmt->execute( $data );
-
- // Return the single result, or return false if no match...
- if (false != ($resource = $stmt->fetch())) {
- return new Puny_Resource($resource);
- } else {
- return false;
- }
- }
-
- public function store( Puny_Resource $resource ) {
-
- // Increment the resource version id... (see note in Puny_DataStore.class.php)
- $resource->incrementVersion();
-
- // Create sql for storing this new resource version...
- $sql = "INSERT INTO `{$this->tablePrefix}resource` (`resourceId`,`version`,`parser`,`content`) "
- . "VALUES (:resourceId, :version, :parser, :content) ";
-
- // Prepare and execute the statement using the provided data
- $stmt = $this->link->prepare($sql);
- $stmt->execute ( array (
- 'resourceId' => $resource->getId()
- , 'version' => $resource->getVersion()
- , 'parser' => $resource->getParser()
- , 'content' => $resource->getContent(true) // raw, unparsed content
- ));
-
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/classes/parsers/Puny_MarkdownParser.class.php
----------------------------------------------------------------------
diff --git a/balance/modules/puny/classes/parsers/Puny_MarkdownParser.class.php b/balance/modules/puny/classes/parsers/Puny_MarkdownParser.class.php
deleted file mode 100644
index 4277d04..0000000
--- a/balance/modules/puny/classes/parsers/Puny_MarkdownParser.class.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Require the markdown php library (https://github.com/michelf/php-markdown/)
-require_once( App::Get()->settings['puny_module_path'] . '/libs/markdown.php');
-
-/**
- * Markdown implementation of the Puny_Parser class
- *
- * @author ahart
- */
-
-class Puny_MarkdownParser {
-
- public function parse ( $content ) {
-
- return Markdown( $content );
-
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/classes/parsers/Puny_Parser.class.php
----------------------------------------------------------------------
diff --git a/balance/modules/puny/classes/parsers/Puny_Parser.class.php b/balance/modules/puny/classes/parsers/Puny_Parser.class.php
deleted file mode 100644
index 5701ff9..0000000
--- a/balance/modules/puny/classes/parsers/Puny_Parser.class.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Puny_Parser
- *
- * Base class for Puny parser implementations.
- *
- * @abstract
- *
- * @author ahart
- */
-abstract class Puny_Parser {
-
- /**
- * Implementations of this function should return the
- * final (display-ready) version of the provided content.
- *
- * @param string $content The content to parse
- * @returns string
- * @abstract
- */
- public abstract function parse( $content );
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/config.ini
----------------------------------------------------------------------
diff --git a/balance/modules/puny/config.ini b/balance/modules/puny/config.ini
deleted file mode 100644
index ed3b334..0000000
--- a/balance/modules/puny/config.ini
+++ /dev/null
@@ -1,75 +0,0 @@
- # Licensed to the Apache Software Foundation (ASF) under one or more
- # contributor license agreements. See the NOTICE file distributed with
- # this work for additional information regarding copyright ownership.
- # The ASF licenses this file to You under the Apache License, Version 2.0
- # (the "License"); you may not use this file except in compliance with
- # the License. You may obtain a copy of the License at
- #
- # http://www.apache.org/licenses/LICENSE-2.0
- #
- # Unless required by applicable law or agreed to in writing, software
- # distributed under the License is distributed on an "AS IS" BASIS,
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- # See the License for the specific language governing permissions and
- # limitations under the License.
-
-#
-# Puny - Lightweight content editor for Balance applications
-#
-# ------------------------------------------------------------------------
-#
-
-[ADMINISTRATION CONFIGURATION]
-#
-# Editor login credentials
-# -------------------------------------
-# The editor is the user authorized to make content changes to the site
-#
-puny_editor_username = ''
-puny_editor_password = ''
-
-
-[DATASTORE CONFIGURATION]
-#
-# Which class will provide connection to the data store?
-puny_datastore_classname = Puny_LocalFileDataStore;
-
-# Where is this class in the filesystem?
-puny_datastore_classpath = [MODULE_PATH]/classes/data/Puny_LocalFileDataStore.class.php;
-
-# Connection parameters specific to the Puny_LocalFileDataStore connector
-puny_datastore_localfile_dir = '[MODULE_PATH]/data/resources';
-
-# Connection parameters specific to the Puny_PdoDataStore connector
-puny_datastore_pdo_host = 'localhost';
-puny_datastore_pdo_username = '';
-puny_datastore_pdo_password = '';
-puny_datastore_pdo_dbname = '';
-puny_datastore_pdo_driver = 'mysql';
-puny_datastore_pdo_tablePrefix = 'puny_';
-
-# Connection parameters specific to the Puny_MongoDataStore connector
-puny_datastore_mongo_db = '';
-puny_datastore_mongo_collection = '';
-
-[PARSER CONFIGURATION]
-#
-# Puny supports an unlimited number of parsers. The only requirement is that
-# there be a driver that conforms to ./classes/parsers/Puny_Parser.class.php.
-#
-# This array provides a mapping between parser labels and the corresponding
-# parser class that will do the work.
-#
-puny_parser[ 'markdown' ] = [MODULE_PATH]/classes/parsers/Puny_MarkdownParser.class.php
-
-
-
-[INTERNAL ROUTING]
-#
-# These variables are here to provide location independence (so that you can
-# install Puny in ./modules/puny or ./modules/somethingelse without having
-# to change any code. You should never have to edit these.
-#
-puny_module_path = [MODULE_PATH]
-puny_module_root = [MODULE_ROOT]
-puny_module_static = [MODULE_STATIC]
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/hooks.php
----------------------------------------------------------------------
diff --git a/balance/modules/puny/hooks.php b/balance/modules/puny/hooks.php
deleted file mode 100644
index e723f31..0000000
--- a/balance/modules/puny/hooks.php
+++ /dev/null
@@ -1,17 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
\ No newline at end of file
[31/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParserTokenManager.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParserTokenManager.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParserTokenManager.java
deleted file mode 100644
index cd001a4..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParserTokenManager.java
+++ /dev/null
@@ -1,806 +0,0 @@
-/* Generated By:JJTree&JavaCC: Do not edit this line. QueryParserTokenManager.java */
-package org.apache.oodt.cas.catalog.query.parser;
-
-public class QueryParserTokenManager implements QueryParserConstants
-{
- public java.io.PrintStream debugStream = System.out;
- public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; }
-private int jjStopStringLiteralDfa_0(int pos, long active0)
-{
- switch (pos)
- {
- case 0:
- if ((active0 & 0x18000L) != 0L)
- {
- jjmatchedKind = 23;
- return 16;
- }
- if ((active0 & 0x80L) != 0L) {
- return 10;
- }
- return -1;
- case 1:
- if ((active0 & 0x18000L) != 0L)
- {
- jjmatchedKind = 23;
- jjmatchedPos = 1;
- return 16;
- }
- return -1;
- case 2:
- if ((active0 & 0x18000L) != 0L)
- {
- jjmatchedKind = 23;
- jjmatchedPos = 2;
- return 16;
- }
- return -1;
- case 3:
- if ((active0 & 0x8000L) != 0L)
- {
- jjmatchedKind = 23;
- jjmatchedPos = 3;
- return 16;
- }
- if ((active0 & 0x10000L) != 0L) {
- return 16;
- }
- return -1;
- case 4:
- if ((active0 & 0x8000L) != 0L)
- {
- jjmatchedKind = 23;
- jjmatchedPos = 4;
- return 16;
- }
- return -1;
- case 5:
- if ((active0 & 0x8000L) != 0L)
- {
- jjmatchedKind = 23;
- jjmatchedPos = 5;
- return 16;
- }
- return -1;
- case 6:
- if ((active0 & 0x8000L) != 0L)
- {
- jjmatchedKind = 23;
- jjmatchedPos = 6;
- return 16;
- }
- return -1;
- case 7:
- if ((active0 & 0x8000L) != 0L)
- {
- jjmatchedKind = 23;
- jjmatchedPos = 7;
- return 16;
- }
- return -1;
- case 8:
- if ((active0 & 0x8000L) != 0L)
- {
- jjmatchedKind = 23;
- jjmatchedPos = 8;
- return 16;
- }
- return -1;
- case 9:
- if ((active0 & 0x8000L) != 0L)
- {
- jjmatchedKind = 23;
- jjmatchedPos = 9;
- return 16;
- }
- return -1;
- default :
- return -1;
- }
-}
-private int jjStartNfa_0(int pos, long active0)
-{
- return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1);
-}
-private int jjStopAtPos(int pos, int kind)
-{
- jjmatchedKind = kind;
- jjmatchedPos = pos;
- return pos + 1;
-}
-private int jjStartNfaWithStates_0(int pos, int kind, int state)
-{
- jjmatchedKind = kind;
- jjmatchedPos = pos;
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) { return pos + 1; }
- return jjMoveNfa_0(state, pos + 1);
-}
-private int jjMoveStringLiteralDfa0_0()
-{
- switch(curChar)
- {
- case 13:
- jjmatchedKind = 1;
- return jjMoveStringLiteralDfa1_0(0x8L);
- case 32:
- jjmatchedKind = 4;
- return jjMoveStringLiteralDfa1_0(0x60L);
- case 39:
- return jjStartNfaWithStates_0(0, 7, 10);
- case 40:
- return jjStopAtPos(0, 13);
- case 41:
- return jjStopAtPos(0, 14);
- case 44:
- return jjStopAtPos(0, 10);
- case 59:
- return jjStopAtPos(0, 9);
- case 60:
- jjmatchedKind = 22;
- return jjMoveStringLiteralDfa1_0(0x200000L);
- case 61:
- jjmatchedKind = 8;
- return jjMoveStringLiteralDfa1_0(0x40000L);
- case 62:
- jjmatchedKind = 20;
- return jjMoveStringLiteralDfa1_0(0x80000L);
- case 98:
- return jjMoveStringLiteralDfa1_0(0x8000L);
- case 110:
- return jjMoveStringLiteralDfa1_0(0x10000L);
- case 123:
- return jjStopAtPos(0, 11);
- case 125:
- return jjStopAtPos(0, 12);
- default :
- return jjMoveNfa_0(3, 0);
- }
-}
-private int jjMoveStringLiteralDfa1_0(long active0)
-{
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(0, active0);
- return 1;
- }
- switch(curChar)
- {
- case 10:
- if ((active0 & 0x8L) != 0L) {
- return jjStopAtPos(1, 3);
- }
- break;
- case 61:
- if ((active0 & 0x40000L) != 0L) {
- return jjStopAtPos(1, 18);
- } else if ((active0 & 0x80000L) != 0L) {
- return jjStopAtPos(1, 19);
- } else if ((active0 & 0x200000L) != 0L) {
- return jjStopAtPos(1, 21);
- }
- break;
- case 65:
- return jjMoveStringLiteralDfa2_0(active0, 0x20L);
- case 79:
- return jjMoveStringLiteralDfa2_0(active0, 0x40L);
- case 97:
- return jjMoveStringLiteralDfa2_0(active0, 0x10000L);
- case 117:
- return jjMoveStringLiteralDfa2_0(active0, 0x8000L);
- default :
- break;
- }
- return jjStartNfa_0(0, active0);
-}
-private int jjMoveStringLiteralDfa2_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L) {
- return jjStartNfa_0(0, old0);
- }
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(1, active0);
- return 2;
- }
- switch(curChar)
- {
- case 78:
- return jjMoveStringLiteralDfa3_0(active0, 0x20L);
- case 82:
- return jjMoveStringLiteralDfa3_0(active0, 0x40L);
- case 99:
- return jjMoveStringLiteralDfa3_0(active0, 0x8000L);
- case 109:
- return jjMoveStringLiteralDfa3_0(active0, 0x10000L);
- default :
- break;
- }
- return jjStartNfa_0(1, active0);
-}
-private int jjMoveStringLiteralDfa3_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L) {
- return jjStartNfa_0(1, old0);
- }
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(2, active0);
- return 3;
- }
- switch(curChar)
- {
- case 32:
- if ((active0 & 0x40L) != 0L) {
- return jjStopAtPos(3, 6);
- }
- break;
- case 68:
- return jjMoveStringLiteralDfa4_0(active0, 0x20L);
- case 101:
- if ((active0 & 0x10000L) != 0L) {
- return jjStartNfaWithStates_0(3, 16, 16);
- }
- break;
- case 107:
- return jjMoveStringLiteralDfa4_0(active0, 0x8000L);
- default :
- break;
- }
- return jjStartNfa_0(2, active0);
-}
-private int jjMoveStringLiteralDfa4_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L) {
- return jjStartNfa_0(2, old0);
- }
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(3, active0);
- return 4;
- }
- switch(curChar)
- {
- case 32:
- if ((active0 & 0x20L) != 0L) {
- return jjStopAtPos(4, 5);
- }
- break;
- case 101:
- return jjMoveStringLiteralDfa5_0(active0, 0x8000L);
- default :
- break;
- }
- return jjStartNfa_0(3, active0);
-}
-private int jjMoveStringLiteralDfa5_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L) {
- return jjStartNfa_0(3, old0);
- }
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(4, active0);
- return 5;
- }
- switch(curChar)
- {
- case 116:
- return jjMoveStringLiteralDfa6_0(active0, 0x8000L);
- default :
- break;
- }
- return jjStartNfa_0(4, active0);
-}
-private int jjMoveStringLiteralDfa6_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L) {
- return jjStartNfa_0(4, old0);
- }
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(5, active0);
- return 6;
- }
- switch(curChar)
- {
- case 78:
- return jjMoveStringLiteralDfa7_0(active0, 0x8000L);
- default :
- break;
- }
- return jjStartNfa_0(5, active0);
-}
-private int jjMoveStringLiteralDfa7_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L) {
- return jjStartNfa_0(5, old0);
- }
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(6, active0);
- return 7;
- }
- switch(curChar)
- {
- case 97:
- return jjMoveStringLiteralDfa8_0(active0, 0x8000L);
- default :
- break;
- }
- return jjStartNfa_0(6, active0);
-}
-private int jjMoveStringLiteralDfa8_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L) {
- return jjStartNfa_0(6, old0);
- }
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(7, active0);
- return 8;
- }
- switch(curChar)
- {
- case 109:
- return jjMoveStringLiteralDfa9_0(active0, 0x8000L);
- default :
- break;
- }
- return jjStartNfa_0(7, active0);
-}
-private int jjMoveStringLiteralDfa9_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L) {
- return jjStartNfa_0(7, old0);
- }
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(8, active0);
- return 9;
- }
- switch(curChar)
- {
- case 101:
- return jjMoveStringLiteralDfa10_0(active0, 0x8000L);
- default :
- break;
- }
- return jjStartNfa_0(8, active0);
-}
-private int jjMoveStringLiteralDfa10_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L) {
- return jjStartNfa_0(8, old0);
- }
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(9, active0);
- return 10;
- }
- switch(curChar)
- {
- case 115:
- if ((active0 & 0x8000L) != 0L) {
- return jjStartNfaWithStates_0(10, 15, 16);
- }
- break;
- default :
- break;
- }
- return jjStartNfa_0(9, active0);
-}
-private void jjCheckNAdd(int state)
-{
- if (jjrounds[state] != jjround)
- {
- jjstateSet[jjnewStateCnt++] = state;
- jjrounds[state] = jjround;
- }
-}
-private void jjAddStates(int start, int end)
-{
- do {
- jjstateSet[jjnewStateCnt++] = jjnextStates[start];
- } while (start++ != end);
-}
-private void jjCheckNAddTwoStates(int state1, int state2)
-{
- jjCheckNAdd(state1);
- jjCheckNAdd(state2);
-}
-private void jjCheckNAddStates(int start, int end)
-{
- do {
- jjCheckNAdd(jjnextStates[start]);
- } while (start++ != end);
-}
-private void jjCheckNAddStates(int start)
-{
- jjCheckNAdd(jjnextStates[start]);
- jjCheckNAdd(jjnextStates[start + 1]);
-}
-private int jjMoveNfa_0(int startState, int curPos)
-{
- int[] nextStates;
- int startsAt = 0;
- jjnewStateCnt = 16;
- int i = 1;
- jjstateSet[0] = startState;
- int j, kind = 0x7fffffff;
- for (;;)
- {
- if (++jjround == 0x7fffffff) {
- ReInitRounds();
- }
- if (curChar < 64)
- {
- long l = 1L << curChar;
- MatchLoop: do
- {
- switch(jjstateSet[--i])
- {
- case 10:
- if ((0xd7ffe77a00000000L & l) != 0L) {
- jjCheckNAddStates(0, 2);
- }
- break;
- case 16:
- case 5:
- if ((0x7ffe00000000000L & l) == 0L) {
- break;
- }
- if (kind > 23) {
- kind = 23;
- }
- jjCheckNAdd(5);
- break;
- case 3:
- if (curChar == 39) {
- jjAddStates(3, 4);
- }
- break;
- case 0:
- if (curChar == 58) {
- jjstateSet[jjnewStateCnt++] = 1;
- }
- break;
- case 2:
- if ((0x7ffe00000000000L & l) == 0L) {
- break;
- }
- if (kind > 17) {
- kind = 17;
- }
- jjstateSet[jjnewStateCnt++] = 2;
- break;
- case 8:
- if ((0x7ffe00000000000L & l) != 0L) {
- jjCheckNAddTwoStates(8, 9);
- }
- break;
- case 9:
- if (curChar == 39 && kind > 24) {
- kind = 24;
- }
- break;
- case 11:
- if (curChar == 32) {
- jjAddStates(5, 6);
- }
- break;
- case 12:
- if ((0x7ffe00000000000L & l) != 0L) {
- jjCheckNAddStates(7, 9);
- }
- break;
- case 13:
- if ((0xd7ffe77a00000000L & l) != 0L) {
- jjCheckNAddStates(7, 9);
- }
- break;
- case 14:
- if ((0xd000877a00000000L & l) != 0L) {
- jjCheckNAddStates(7, 9);
- }
- break;
- case 15:
- if ((0xd7ffe77a00000000L & l) != 0L) {
- jjCheckNAddStates(10, 13);
- }
- break;
- default : break;
- }
- } while(i != startsAt);
- }
- else if (curChar < 128)
- {
- long l = 1L << (curChar & 077);
- MatchLoop: do
- {
- switch(jjstateSet[--i])
- {
- case 10:
- if ((0x6fffffffffffffffL & l) != 0L) {
- jjCheckNAddStates(0, 2);
- }
- if ((0x7fffffe07fffffeL & l) != 0L) {
- jjCheckNAddStates(14, 16);
- }
- break;
- case 16:
- if ((0x7fffffe87fffffeL & l) != 0L)
- {
- if (kind > 23) {
- kind = 23;
- }
- jjCheckNAdd(5);
- }
- if ((0x7fffffe07fffffeL & l) != 0L)
- {
- if (kind > 23) {
- kind = 23;
- }
- jjCheckNAddTwoStates(4, 5);
- }
- break;
- case 3:
- if ((0x7fffffe07fffffeL & l) != 0L)
- {
- if (kind > 23) {
- kind = 23;
- }
- jjCheckNAddTwoStates(4, 5);
- }
- if (curChar == 112) {
- jjstateSet[jjnewStateCnt++] = 0;
- }
- break;
- case 1:
- if ((0x7fffffe07fffffeL & l) == 0L) {
- break;
- }
- if (kind > 17) {
- kind = 17;
- }
- jjCheckNAddTwoStates(1, 2);
- break;
- case 2:
- if ((0x7fffffe87fffffeL & l) == 0L) {
- break;
- }
- if (kind > 17) {
- kind = 17;
- }
- jjCheckNAdd(2);
- break;
- case 4:
- if ((0x7fffffe07fffffeL & l) == 0L) {
- break;
- }
- if (kind > 23) {
- kind = 23;
- }
- jjCheckNAddTwoStates(4, 5);
- break;
- case 5:
- if ((0x7fffffe87fffffeL & l) == 0L) {
- break;
- }
- if (kind > 23) {
- kind = 23;
- }
- jjCheckNAdd(5);
- break;
- case 7:
- if ((0x7fffffe07fffffeL & l) != 0L) {
- jjCheckNAddStates(14, 16);
- }
- break;
- case 8:
- if ((0x7fffffe87fffffeL & l) != 0L) {
- jjCheckNAddTwoStates(8, 9);
- }
- break;
- case 12:
- if ((0x7fffffe87fffffeL & l) != 0L) {
- jjCheckNAddStates(7, 9);
- }
- break;
- case 13:
- if ((0x6fffffffffffffffL & l) != 0L) {
- jjCheckNAddStates(7, 9);
- }
- break;
- case 14:
- if ((0x6800000178000001L & l) != 0L) {
- jjCheckNAddStates(7, 9);
- }
- break;
- case 15:
- if ((0x6fffffffffffffffL & l) != 0L) {
- jjCheckNAddStates(10, 13);
- }
- break;
- default : break;
- }
- } while(i != startsAt);
- }
- else
- {
- int i2 = (curChar & 0xff) >> 6;
- long l2 = 1L << (curChar & 077);
- MatchLoop: do
- {
- switch(jjstateSet[--i])
- {
- default : break;
- }
- } while(i != startsAt);
- }
- if (kind != 0x7fffffff)
- {
- jjmatchedKind = kind;
- jjmatchedPos = curPos;
- kind = 0x7fffffff;
- }
- ++curPos;
- if ((i = jjnewStateCnt) == (startsAt = 16 - (jjnewStateCnt = startsAt))) {
- return curPos;
- }
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) { return curPos; }
- }
-}
-static final int[] jjnextStates = {
- 9, 11, 15, 7, 10, 12, 14, 13, 9, 11, 13, 9, 11, 15, 7, 8,
- 9,
-};
-public static final String[] jjstrLiteralImages = {
-"", null, null, null, "\40", "\40\101\116\104\40", "\40\117\122\40", "\47",
-"\75", "\73", "\54", "\173", "\175", "\50", "\51",
-"\142\165\143\153\145\164\116\141\155\145\163", "\156\141\155\145", null, "\75\75", "\76\75", "\76", "\74\75", "\74", null,
-null, null, null, null, };
-public static final String[] lexStateNames = {
- "DEFAULT",
-};
-static final long[] jjtoToken = {
- 0x1fffff1L,
-};
-static final long[] jjtoSkip = {
- 0xeL,
-};
-protected SimpleCharStream input_stream;
-private final int[] jjrounds = new int[16];
-private final int[] jjstateSet = new int[32];
-protected char curChar;
-public QueryParserTokenManager(SimpleCharStream stream){
- if (SimpleCharStream.staticFlag) {
- throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
- }
- input_stream = stream;
-}
-public QueryParserTokenManager(SimpleCharStream stream, int lexState){
- this(stream);
- SwitchTo(lexState);
-}
-public void ReInit(SimpleCharStream stream)
-{
- jjmatchedPos = jjnewStateCnt = 0;
- curLexState = defaultLexState;
- input_stream = stream;
- ReInitRounds();
-}
-private void ReInitRounds()
-{
- int i;
- jjround = 0x80000001;
- for (i = 16; i-- > 0;) {
- jjrounds[i] = 0x80000000;
- }
-}
-public void ReInit(SimpleCharStream stream, int lexState)
-{
- ReInit(stream);
- SwitchTo(lexState);
-}
-public void SwitchTo(int lexState)
-{
- if (lexState >= 1 || lexState < 0) {
- throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.",
- TokenMgrError.INVALID_LEXICAL_STATE);
- } else {
- curLexState = lexState;
- }
-}
-
-protected Token jjFillToken()
-{
- Token t = Token.newToken(jjmatchedKind);
- t.kind = jjmatchedKind;
- String im = jjstrLiteralImages[jjmatchedKind];
- t.image = (im == null) ? input_stream.GetImage() : im;
- t.beginLine = input_stream.getBeginLine();
- t.beginColumn = input_stream.getBeginColumn();
- t.endLine = input_stream.getEndLine();
- t.endColumn = input_stream.getEndColumn();
- return t;
-}
-
-int curLexState = 0;
-int defaultLexState = 0;
-int jjnewStateCnt;
-int jjround;
-int jjmatchedPos;
-int jjmatchedKind;
-
-public Token getNextToken()
-{
- int kind;
- Token specialToken = null;
- Token matchedToken;
- int curPos;
-
- EOFLoop :
- for (;;)
- {
- try
- {
- curChar = input_stream.BeginToken();
- }
- catch(java.io.IOException e)
- {
- jjmatchedKind = 0;
- matchedToken = jjFillToken();
- return matchedToken;
- }
-
- try { input_stream.backup(0);
- while (curChar <= 10 && (0x400L & (1L << curChar)) != 0L) {
- curChar = input_stream.BeginToken();
- }
- }
- catch (java.io.IOException e1) { continue EOFLoop; }
- jjmatchedKind = 0x7fffffff;
- jjmatchedPos = 0;
- curPos = jjMoveStringLiteralDfa0_0();
- if (jjmatchedKind != 0x7fffffff)
- {
- if (jjmatchedPos + 1 < curPos) {
- input_stream.backup(curPos - jjmatchedPos - 1);
- }
- if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
- {
- matchedToken = jjFillToken();
- return matchedToken;
- }
- else
- {
- continue EOFLoop;
- }
- }
- int error_line = input_stream.getEndLine();
- int error_column = input_stream.getEndColumn();
- String error_after = null;
- boolean EOFSeen = false;
- try { input_stream.readChar(); input_stream.backup(1); }
- catch (java.io.IOException e1) {
- EOFSeen = true;
- error_after = curPos <= 1 ? "" : input_stream.GetImage();
- if (curChar == '\n' || curChar == '\r') {
- error_line++;
- error_column = 0;
- }
- else {
- error_column++;
- }
- }
- if (!EOFSeen) {
- input_stream.backup(1);
- error_after = curPos <= 1 ? "" : input_stream.GetImage();
- }
- throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
- }
-}
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParserTreeConstants.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParserTreeConstants.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParserTreeConstants.java
deleted file mode 100644
index 4b13120..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParserTreeConstants.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Generated By:JJTree: Do not edit this line. ./QueryParserTreeConstants.java */
-
-package org.apache.oodt.cas.catalog.query.parser;
-
-public interface QueryParserTreeConstants
-{
- int JJTPARSEINPUT = 0;
- int JJTQUERY = 1;
- int JJTQUERYEXPRESSION = 2;
- int JJTSTDQUERYEXPRESSION = 3;
- int JJTCOMPARISONQUERYEXPRESSION = 4;
- int JJTPRIORITYQUERYEXPRESSION = 5;
- int JJTCUSTOMQUERYEXPRESSION = 6;
- int JJTGETVALUES = 7;
- int JJTGETPROPERTIES = 8;
-
-
- String[] jjtNodeName = {
- "parseInput",
- "Query",
- "QueryExpression",
- "StdQueryExpression",
- "ComparisonQueryExpression",
- "PriorityQueryExpression",
- "CustomQueryExpression",
- "getValues",
- "getProperties",
- };
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/SimpleCharStream.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/SimpleCharStream.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/SimpleCharStream.java
deleted file mode 100644
index f1ff115..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/SimpleCharStream.java
+++ /dev/null
@@ -1,480 +0,0 @@
-/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 5.0 */
-/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
-package org.apache.oodt.cas.catalog.query.parser;
-
-/**
- * An implementation of interface CharStream, where the stream is assumed to
- * contain only ASCII characters (without unicode processing).
- */
-
-public class SimpleCharStream
-{
-/** Whether parser is static. */
- public static final boolean staticFlag = false;
- int bufsize;
- int available;
- int tokenBegin;
-/** Position in buffer. */
- public int bufpos = -1;
- protected int bufline[];
- protected int bufcolumn[];
-
- protected int column = 0;
- protected int line = 1;
-
- protected boolean prevCharIsCR = false;
- protected boolean prevCharIsLF = false;
-
- protected java.io.Reader inputStream;
-
- protected char[] buffer;
- protected int maxNextCharInd = 0;
- protected int inBuf = 0;
- protected int tabSize = 8;
-
- protected void setTabSize(int i) { tabSize = i; }
- protected int getTabSize(int i) { return tabSize; }
-
-
- protected void ExpandBuff(boolean wrapAround)
- {
- char[] newbuffer = new char[bufsize + 2048];
- int newbufline[] = new int[bufsize + 2048];
- int newbufcolumn[] = new int[bufsize + 2048];
-
- try
- {
- if (wrapAround)
- {
- System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
- System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos);
- buffer = newbuffer;
-
- System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
- System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
- bufline = newbufline;
-
- System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
- System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos);
- bufcolumn = newbufcolumn;
-
- maxNextCharInd = (bufpos += (bufsize - tokenBegin));
- }
- else
- {
- System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
- buffer = newbuffer;
-
- System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
- bufline = newbufline;
-
- System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
- bufcolumn = newbufcolumn;
-
- maxNextCharInd = (bufpos -= tokenBegin);
- }
- }
- catch (Throwable t)
- {
- throw new Error(t.getMessage(),t);
- }
-
-
- bufsize += 2048;
- available = bufsize;
- tokenBegin = 0;
- }
-
- protected void FillBuff() throws java.io.IOException
- {
- if (maxNextCharInd == available)
- {
- if (available == bufsize)
- {
- if (tokenBegin > 2048)
- {
- bufpos = maxNextCharInd = 0;
- available = tokenBegin;
- }
- else if (tokenBegin < 0) {
- bufpos = maxNextCharInd = 0;
- } else {
- ExpandBuff(false);
- }
- }
- else if (available > tokenBegin) {
- available = bufsize;
- } else if ((tokenBegin - available) < 2048) {
- ExpandBuff(true);
- } else {
- available = tokenBegin;
- }
- }
-
- int i;
- try {
- if ((i = inputStream.read(buffer, maxNextCharInd, available - maxNextCharInd)) == -1)
- {
- inputStream.close();
- throw new java.io.IOException();
- }
- else {
- maxNextCharInd += i;
- }
- }
- catch(java.io.IOException e) {
- --bufpos;
- backup(0);
- if (tokenBegin == -1) {
- tokenBegin = bufpos;
- }
- throw e;
- }
- }
-
-/** Start. */
- public char BeginToken() throws java.io.IOException
- {
- tokenBegin = -1;
- char c = readChar();
- tokenBegin = bufpos;
-
- return c;
- }
-
- protected void UpdateLineColumn(char c)
- {
- column++;
-
- if (prevCharIsLF)
- {
- prevCharIsLF = false;
- line += (column = 1);
- }
- else if (prevCharIsCR)
- {
- prevCharIsCR = false;
- if (c == '\n')
- {
- prevCharIsLF = true;
- }
- else {
- line += (column = 1);
- }
- }
-
- switch (c)
- {
- case '\r' :
- prevCharIsCR = true;
- break;
- case '\n' :
- prevCharIsLF = true;
- break;
- case '\t' :
- column--;
- column += (tabSize - (column % tabSize));
- break;
- default :
- break;
- }
-
- bufline[bufpos] = line;
- bufcolumn[bufpos] = column;
- }
-
-/** Read a character. */
- public char readChar() throws java.io.IOException
- {
- if (inBuf > 0)
- {
- --inBuf;
-
- if (++bufpos == bufsize) {
- bufpos = 0;
- }
-
- return buffer[bufpos];
- }
-
- if (++bufpos >= maxNextCharInd) {
- FillBuff();
- }
-
- char c = buffer[bufpos];
-
- UpdateLineColumn(c);
- return c;
- }
-
- @Deprecated
- /**
- * @deprecated
- * @see #getEndColumn
- */
-
- public int getColumn() {
- return bufcolumn[bufpos];
- }
-
- @Deprecated
- /**
- * @deprecated
- * @see #getEndLine
- */
-
- public int getLine() {
- return bufline[bufpos];
- }
-
- /** Get token end column number. */
- public int getEndColumn() {
- return bufcolumn[bufpos];
- }
-
- /** Get token end line number. */
- public int getEndLine() {
- return bufline[bufpos];
- }
-
- /** Get token beginning column number. */
- public int getBeginColumn() {
- return bufcolumn[tokenBegin];
- }
-
- /** Get token beginning line number. */
- public int getBeginLine() {
- return bufline[tokenBegin];
- }
-
-/** Backup a number of characters. */
- public void backup(int amount) {
-
- inBuf += amount;
- if ((bufpos -= amount) < 0) {
- bufpos += bufsize;
- }
- }
-
- /** Constructor. */
- public SimpleCharStream(java.io.Reader dstream, int startline,
- int startcolumn, int buffersize)
- {
- inputStream = dstream;
- line = startline;
- column = startcolumn - 1;
-
- available = bufsize = buffersize;
- buffer = new char[buffersize];
- bufline = new int[buffersize];
- bufcolumn = new int[buffersize];
- }
-
- /** Constructor. */
- public SimpleCharStream(java.io.Reader dstream, int startline,
- int startcolumn)
- {
- this(dstream, startline, startcolumn, 4096);
- }
-
- /** Constructor. */
- public SimpleCharStream(java.io.Reader dstream)
- {
- this(dstream, 1, 1, 4096);
- }
-
- /** Reinitialise. */
- public void ReInit(java.io.Reader dstream, int startline,
- int startcolumn, int buffersize)
- {
- inputStream = dstream;
- line = startline;
- column = startcolumn - 1;
-
- if (buffer == null || buffersize != buffer.length)
- {
- available = bufsize = buffersize;
- buffer = new char[buffersize];
- bufline = new int[buffersize];
- bufcolumn = new int[buffersize];
- }
- prevCharIsLF = prevCharIsCR = false;
- tokenBegin = inBuf = maxNextCharInd = 0;
- bufpos = -1;
- }
-
- /** Reinitialise. */
- public void ReInit(java.io.Reader dstream, int startline,
- int startcolumn)
- {
- ReInit(dstream, startline, startcolumn, 4096);
- }
-
- /** Reinitialise. */
- public void ReInit(java.io.Reader dstream)
- {
- ReInit(dstream, 1, 1, 4096);
- }
- /** Constructor. */
- public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline,
- int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException
- {
- this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize);
- }
-
- /** Constructor. */
- public SimpleCharStream(java.io.InputStream dstream, int startline,
- int startcolumn, int buffersize)
- {
- this(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize);
- }
-
- /** Constructor. */
- public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline,
- int startcolumn) throws java.io.UnsupportedEncodingException
- {
- this(dstream, encoding, startline, startcolumn, 4096);
- }
-
- /** Constructor. */
- public SimpleCharStream(java.io.InputStream dstream, int startline,
- int startcolumn)
- {
- this(dstream, startline, startcolumn, 4096);
- }
-
- /** Constructor. */
- public SimpleCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException
- {
- this(dstream, encoding, 1, 1, 4096);
- }
-
- /** Constructor. */
- public SimpleCharStream(java.io.InputStream dstream)
- {
- this(dstream, 1, 1, 4096);
- }
-
- /** Reinitialise. */
- public void ReInit(java.io.InputStream dstream, String encoding, int startline,
- int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException
- {
- ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize);
- }
-
- /** Reinitialise. */
- public void ReInit(java.io.InputStream dstream, int startline,
- int startcolumn, int buffersize)
- {
- ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize);
- }
-
- /** Reinitialise. */
- public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException
- {
- ReInit(dstream, encoding, 1, 1, 4096);
- }
-
- /** Reinitialise. */
- public void ReInit(java.io.InputStream dstream)
- {
- ReInit(dstream, 1, 1, 4096);
- }
- /** Reinitialise. */
- public void ReInit(java.io.InputStream dstream, String encoding, int startline,
- int startcolumn) throws java.io.UnsupportedEncodingException
- {
- ReInit(dstream, encoding, startline, startcolumn, 4096);
- }
- /** Reinitialise. */
- public void ReInit(java.io.InputStream dstream, int startline,
- int startcolumn)
- {
- ReInit(dstream, startline, startcolumn, 4096);
- }
- /** Get token literal value. */
- public String GetImage()
- {
- if (bufpos >= tokenBegin) {
- return new String(buffer, tokenBegin, bufpos - tokenBegin + 1);
- } else {
- return new String(buffer, tokenBegin, bufsize - tokenBegin) +
- new String(buffer, 0, bufpos + 1);
- }
- }
-
- /** Get the suffix. */
- public char[] GetSuffix(int len)
- {
- char[] ret = new char[len];
-
- if ((bufpos + 1) >= len) {
- System.arraycopy(buffer, bufpos - len + 1, ret, 0, len);
- } else
- {
- System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0,
- len - bufpos - 1);
- System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1);
- }
-
- return ret;
- }
-
- /** Reset buffer when finished. */
- public void Done()
- {
- buffer = null;
- bufline = null;
- bufcolumn = null;
- }
-
- /**
- * Method to adjust line and column numbers for the start of a token.
- */
- public void adjustBeginLineColumn(int newLine, int newCol)
- {
- int start = tokenBegin;
- int len;
-
- if (bufpos >= tokenBegin)
- {
- len = bufpos - tokenBegin + inBuf + 1;
- }
- else
- {
- len = bufsize - tokenBegin + bufpos + 1 + inBuf;
- }
-
- int i = 0, j = 0, k;
- int nextColDiff, columnDiff = 0;
-
- while (i < len && bufline[j = start % bufsize] == bufline[k = ++start % bufsize])
- {
- bufline[j] = newLine;
- nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
- bufcolumn[j] = newCol + columnDiff;
- columnDiff = nextColDiff;
- i++;
- }
-
- if (i < len)
- {
- bufline[j] = newLine++;
- bufcolumn[j] = newCol + columnDiff;
-
- while (i++ < len)
- {
- if (bufline[j = start % bufsize] != bufline[++start % bufsize]) {
- bufline[j] = newLine++;
- } else {
- bufline[j] = newLine;
- }
- }
- }
-
- line = bufline[j];
- column = bufcolumn[j];
- }
-
-}
-/* JavaCC - OriginalChecksum=121bf419e6c52d5335ce44acb0bd27aa (do not edit this line) */
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/SimpleNode.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/SimpleNode.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/SimpleNode.java
deleted file mode 100644
index 31cdb29..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/SimpleNode.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/* Generated By:JJTree: Do not edit this line. SimpleNode.java Version 4.3 */
-/* JavaCCOptions:MULTI=false,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
-package org.apache.oodt.cas.catalog.query.parser;
-
-public
-class SimpleNode implements Node {
-
- protected Node parent;
- protected Node[] children;
- protected int id;
- protected Object value;
- protected QueryParser parser;
-
- public SimpleNode(int i) {
- id = i;
- }
-
- public SimpleNode(QueryParser p, int i) {
- this(i);
- parser = p;
- }
-
- public void jjtOpen() {
- }
-
- public void jjtClose() {
- }
-
- public void jjtSetParent(Node n) { parent = n; }
- public Node jjtGetParent() { return parent; }
-
- public void jjtAddChild(Node n, int i) {
- if (children == null) {
- children = new Node[i + 1];
- } else if (i >= children.length) {
- Node c[] = new Node[i + 1];
- System.arraycopy(children, 0, c, 0, children.length);
- children = c;
- }
- children[i] = n;
- }
-
- public Node jjtGetChild(int i) {
- return children[i];
- }
-
- public int jjtGetNumChildren() {
- return (children == null) ? 0 : children.length;
- }
-
- public void jjtSetValue(Object value) { this.value = value; }
- public Object jjtGetValue() { return value; }
-
- /* You can override these two methods in subclasses of SimpleNode to
- customize the way the node appears when the tree is dumped. If
- your output uses more than one line you should override
- toString(String), otherwise overriding toString() is probably all
- you need to do. */
-
- public String toString() { return QueryParserTreeConstants.jjtNodeName[id]; }
- public String toString(String prefix) { return prefix + toString(); }
-
- /* Override this method if you want to customize how the node dumps
- out its children. */
-
- public void dump(String prefix) {
- System.out.println(toString(prefix));
- if (children != null) {
- for (Node aChildren : children) {
- SimpleNode n = (SimpleNode) aChildren;
- if (n != null) {
- n.dump(prefix + " ");
- }
- }
- }
- }
-}
-
-/* JavaCC - OriginalChecksum=040e6dcfc83a8e9d2049166ee31054f3 (do not edit this line) */
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/Token.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/Token.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/Token.java
deleted file mode 100644
index 2c18bd4..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/Token.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */
-/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
-package org.apache.oodt.cas.catalog.query.parser;
-
-/**
- * Describes the input token stream.
- */
-
-public class Token implements java.io.Serializable {
-
- /**
- * The version identifier for this Serializable class.
- * Increment only if the <i>serialized</i> form of the
- * class changes.
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * An integer that describes the kind of this token. This numbering
- * system is determined by JavaCCParser, and a table of these numbers is
- * stored in the file ...Constants.java.
- */
- public int kind;
-
- /** The line number of the first character of this Token. */
- public int beginLine;
- /** The column number of the first character of this Token. */
- public int beginColumn;
- /** The line number of the last character of this Token. */
- public int endLine;
- /** The column number of the last character of this Token. */
- public int endColumn;
-
- /**
- * The string image of the token.
- */
- public String image;
-
- /**
- * A reference to the next regular (non-special) token from the input
- * stream. If this is the last token from the input stream, or if the
- * token manager has not read tokens beyond this one, this field is
- * set to null. This is true only if this token is also a regular
- * token. Otherwise, see below for a description of the contents of
- * this field.
- */
- public Token next;
-
- /**
- * This field is used to access special tokens that occur prior to this
- * token, but after the immediately preceding regular (non-special) token.
- * If there are no such special tokens, this field is set to null.
- * When there are more than one such special token, this field refers
- * to the last of these special tokens, which in turn refers to the next
- * previous special token through its specialToken field, and so on
- * until the first special token (whose specialToken field is null).
- * The next fields of special tokens refer to other special tokens that
- * immediately follow it (without an intervening regular token). If there
- * is no such token, this field is null.
- */
- public Token specialToken;
-
- /**
- * An optional attribute value of the Token.
- * Tokens which are not used as syntactic sugar will often contain
- * meaningful values that will be used later on by the compiler or
- * interpreter. This attribute value is often different from the image.
- * Any subclass of Token that actually wants to return a non-null value can
- * override this method as appropriate.
- */
- public Object getValue() {
- return null;
- }
-
- /**
- * No-argument constructor
- */
- public Token() {}
-
- /**
- * Constructs a new token for the specified Image.
- */
- public Token(int kind)
- {
- this(kind, null);
- }
-
- /**
- * Constructs a new token for the specified Image and Kind.
- */
- public Token(int kind, String image)
- {
- this.kind = kind;
- this.image = image;
- }
-
- /**
- * Returns the image.
- */
- public String toString()
- {
- return image;
- }
-
- /**
- * Returns a new Token object, by default. However, if you want, you
- * can create and return subclass objects based on the value of ofKind.
- * Simply add the cases to the switch for all those special cases.
- * For example, if you have a subclass of Token called IDToken that
- * you want to create if ofKind is ID, simply add something like :
- *
- * case MyParserConstants.ID : return new IDToken(ofKind, image);
- *
- * to the following switch statement. Then you can cast matchedToken
- * variable to the appropriate type and use sit in your lexical actions.
- */
- public static Token newToken(int ofKind, String image)
- {
- switch(ofKind)
- {
- default : return new Token(ofKind, image);
- }
- }
-
- public static Token newToken(int ofKind)
- {
- return newToken(ofKind, null);
- }
-
-}
-/* JavaCC - OriginalChecksum=a71b830768b8b7df481722ce93775dc3 (do not edit this line) */
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/TokenMgrError.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/TokenMgrError.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/TokenMgrError.java
deleted file mode 100644
index 340b607..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/TokenMgrError.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 */
-/* JavaCCOptions: */
-package org.apache.oodt.cas.catalog.query.parser;
-
-/** Token Manager Error. */
-public class TokenMgrError extends Error
-{
-
- /**
- * The version identifier for this Serializable class.
- * Increment only if the <i>serialized</i> form of the
- * class changes.
- */
- private static final long serialVersionUID = 1L;
-
- /*
- * Ordinals for various reasons why an Error of this type can be thrown.
- */
-
- /**
- * Lexical error occurred.
- */
- static final int LEXICAL_ERROR = 0;
-
- /**
- * An attempt was made to create a second instance of a static token manager.
- */
- static final int STATIC_LEXER_ERROR = 1;
-
- /**
- * Tried to change to an invalid lexical state.
- */
- static final int INVALID_LEXICAL_STATE = 2;
-
- /**
- * Detected (and bailed out of) an infinite loop in the token manager.
- */
- static final int LOOP_DETECTED = 3;
-
- /**
- * Indicates the reason why the exception is thrown. It will have
- * one of the above 4 values.
- */
- int errorCode;
-
- /**
- * Replaces unprintable characters by their escaped (or unicode escaped)
- * equivalents in the given string
- */
- protected static String addEscapes(String str) {
- StringBuilder retval = new StringBuilder();
- char ch;
- for (int i = 0; i < str.length(); i++) {
- switch (str.charAt(i))
- {
- case 0 :
- continue;
- case '\b':
- retval.append("\\b");
- continue;
- case '\t':
- retval.append("\\t");
- continue;
- case '\n':
- retval.append("\\n");
- continue;
- case '\f':
- retval.append("\\f");
- continue;
- case '\r':
- retval.append("\\r");
- continue;
- case '\"':
- retval.append("\\\"");
- continue;
- case '\'':
- retval.append("\\\'");
- continue;
- case '\\':
- retval.append("\\\\");
- continue;
- default:
- if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
- String s = "0000" + Integer.toString(ch, 16);
- retval.append("\\u").append(s.substring(s.length() - 4, s.length()));
- } else {
- retval.append(ch);
- }
- }
- }
- return retval.toString();
- }
-
- /**
- * Returns a detailed message for the Error when it is thrown by the
- * token manager to indicate a lexical error.
- * Parameters :
- * EOFSeen : indicates if EOF caused the lexical error
- * curLexState : lexical state in which this error occurred
- * errorLine : line number when the error occurred
- * errorColumn : column number when the error occurred
- * errorAfter : prefix that was seen before this error occurred
- * curchar : the offending character
- * Note: You can customize the lexical error message by modifying this method.
- */
- protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
- return("Lexical error at line " +
- errorLine + ", column " +
- errorColumn + ". Encountered: " +
- (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +
- "after : \"" + addEscapes(errorAfter) + "\"");
- }
-
- /**
- * You can also modify the body of this method to customize your error messages.
- * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
- * of end-users concern, so you can return something like :
- *
- * "Internal Error : Please file a bug report .... "
- *
- * from this method for such cases in the release version of your parser.
- */
- public String getMessage() {
- return super.getMessage();
- }
-
- /*
- * Constructors of various flavors follow.
- */
-
- /** No arg constructor. */
- public TokenMgrError() {
- }
-
- /** Constructor with message and reason. */
- public TokenMgrError(String message, int reason) {
- super(message);
- errorCode = reason;
- }
-
- /** Full Constructor. */
- public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
- this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
- }
-}
-/* JavaCC - OriginalChecksum=aa4a499114e90d0d55997529e48f5ebe (do not edit this line) */
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/CatalogRepository.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/CatalogRepository.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/CatalogRepository.java
deleted file mode 100644
index d998d5c..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/CatalogRepository.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.repository;
-
-import org.apache.oodt.cas.catalog.exception.CatalogRepositoryException;
-import org.apache.oodt.cas.catalog.system.Catalog;
-import org.apache.oodt.cas.catalog.util.PluginURL;
-
-import java.util.List;
-import java.util.Set;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Repository where the CatalogService stores its TransactionId Mapping
- * and serializes its Catalogs
- * <p>
- */
-public interface CatalogRepository {
-
- /**
- * Serializes a given Catalog to the Repository
- *
- * @param catalog
- * The Catalog to be serialized
- * @throws CatalogRepositoryException
- * Any Error
- */
- void serializeCatalog(Catalog catalog)
- throws CatalogRepositoryException;
- /**
- * Removes a Catalog from the Repository
- *
- * @param catalogUrn
- * The URN that unique represents the Catalog to be removed
- * @throws CatalogRepositoryException
- * Any Error
- */
- void deleteSerializedCatalog(String catalogUrn)
- throws CatalogRepositoryException;
-
- /**
- * Loads all Catalogs serialized in this Repository
- *
- * @return All the Catalogs serialized in this Repository
- * @throws CatalogRepositoryException
- * Any Error
- */
- Set<Catalog> deserializeAllCatalogs()
- throws CatalogRepositoryException;
-
- void serializePluginURLs(List<PluginURL> urls)
- throws CatalogRepositoryException;
-
- List<PluginURL> deserializePluginURLs()
- throws CatalogRepositoryException;
-
- boolean isModifiable();
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/CatalogRepositoryFactory.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/CatalogRepositoryFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/CatalogRepositoryFactory.java
deleted file mode 100644
index 3bb09ea..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/CatalogRepositoryFactory.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.repository;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.exception.CatalogRepositoryException;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A Factory for creating CatalogRepository
- * <p>
- */
-public interface CatalogRepositoryFactory {
-
- CatalogRepository createRepository() throws CatalogRepositoryException;
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/MemoryBasedCatalogRepository.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/MemoryBasedCatalogRepository.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/MemoryBasedCatalogRepository.java
deleted file mode 100644
index 1b882fb..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/MemoryBasedCatalogRepository.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.repository;
-
-//JDK imports
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.Vector;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.exception.CatalogRepositoryException;
-import org.apache.oodt.cas.catalog.system.Catalog;
-import org.apache.oodt.cas.catalog.util.PluginURL;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Memory based Repository where the CatalogService stores its
- * TransactionId Mapping and serializes its Catalogs
- * <p>
- */
-public class MemoryBasedCatalogRepository implements CatalogRepository {
-
- protected ConcurrentHashMap<String, Catalog> catalogMap;
- protected List<PluginURL> classLoaderUrls;
-
- public MemoryBasedCatalogRepository() {
- this.catalogMap = new ConcurrentHashMap<String, Catalog>();
- this.classLoaderUrls = new Vector<PluginURL>();
- }
-
- /*
- * (non-Javadoc)
- *
- * @seeorg.apache.oodt.cas.catalog.repository.CatalogRepository#
- * deleteSerializedCatalog(java.lang.String)
- */
- public void deleteSerializedCatalog(String catalogUrn)
- throws CatalogRepositoryException {
- this.catalogMap.remove(catalogUrn);
- }
-
- /*
- * (non-Javadoc)
- *
- * @seeorg.apache.oodt.cas.catalog.repository.CatalogRepository#
- * deserializeAllCatalogs()
- */
- public Set<Catalog> deserializeAllCatalogs()
- throws CatalogRepositoryException {
- return new HashSet<Catalog>(this.catalogMap.values());
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.oodt.cas.catalog.repository.CatalogRepository#deserializeCatalog
- * (java.lang.String)
- */
- public Catalog deserializeCatalog(String catalogUrn) {
- return this.catalogMap.get(catalogUrn);
- }
-
- /*
- * (non-Javadoc)
- *
- * @seeorg.apache.oodt.cas.catalog.repository.CatalogRepository#
- * isCatalogSerialized(java.lang.String)
- */
- public boolean isCatalogSerialized(String catalogUrn) {
- return this.catalogMap.containsKey(catalogUrn);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.oodt.cas.catalog.repository.CatalogRepository#serializeCatalog
- * (org.apache.oodt.cas.catalog.Catalog)
- */
- public void serializeCatalog(Catalog catalog)
- throws CatalogRepositoryException {
- this.catalogMap.put(catalog.getId(), catalog);
- }
-
- public void serializePluginURLs(List<PluginURL> urls)
- throws CatalogRepositoryException {
- this.classLoaderUrls.addAll(urls);
- }
-
- public List<PluginURL> deserializePluginURLs()
- throws CatalogRepositoryException {
- return new Vector<PluginURL>(this.classLoaderUrls);
- }
-
- public boolean isModifiable() {
- return true;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/MemoryBasedCatalogRepositoryFactory.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/MemoryBasedCatalogRepositoryFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/MemoryBasedCatalogRepositoryFactory.java
deleted file mode 100644
index 9d25064..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/MemoryBasedCatalogRepositoryFactory.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.repository;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.exception.CatalogRepositoryException;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A Factory for creating MemoryBasedCatalogRepository
- * <p>
- */
-public class MemoryBasedCatalogRepositoryFactory implements
- CatalogRepositoryFactory {
-
- public MemoryBasedCatalogRepository createRepository()
- throws CatalogRepositoryException {
- return new MemoryBasedCatalogRepository();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SerializedCatalogRepository.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SerializedCatalogRepository.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SerializedCatalogRepository.java
deleted file mode 100644
index 18a58dd..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SerializedCatalogRepository.java
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.repository;
-
-
-import org.apache.commons.io.FileUtils;
-import org.apache.oodt.cas.catalog.exception.CatalogRepositoryException;
-import org.apache.oodt.cas.catalog.system.Catalog;
-import org.apache.oodt.cas.catalog.util.PluginURL;
-import org.apache.oodt.cas.catalog.util.Serializer;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Catalog Repository that serializes Catalogs via XStream utility
- * <p>
- */
-public class SerializedCatalogRepository implements CatalogRepository {
-
- private static Logger LOG = Logger.getLogger(SerializedCatalogRepository.class.getName());
- protected String storageDir;
-
- public SerializedCatalogRepository(String storageDir) throws InstantiationException {
- try {
- this.storageDir = storageDir;
- new File(this.storageDir + "/catalogs").mkdirs();
- new File(this.storageDir + "/classloaders").mkdirs();
- }catch(Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- LOG.log(Level.SEVERE, e.getMessage());
- throw new InstantiationException("Failed to instantiate SerializedCatalogRepository : " + e.getMessage());
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.apache.oodt.cas.catalog.repository.MemoryBasedCatalogRepository#deleteSerializedCatalog(java.lang.String)
- */
- public void deleteSerializedCatalog(String catalogUrn)
- throws CatalogRepositoryException {
- LOG.log(Level.INFO, "Deleting Catalog: '" + catalogUrn + "' . . . ");
- boolean catalogFileDelete = this.getCatalogFile(catalogUrn).delete();
- if (!catalogFileDelete) {
- throw new CatalogRepositoryException(
- "Failed to deserialize catalog '" + catalogUrn + "', delete files returned false");
- } else {
- LOG.log(Level.INFO, "Successfully deleting Catalog: '" + catalogUrn + "'");
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.apache.oodt.cas.catalog.repository.MemoryBasedCatalogRepository#deserializeCatalog(java.lang.String)
- */
- public Catalog deserializeCatalog(String catalogUrn)
- throws CatalogRepositoryException {
- LOG.log(Level.INFO, "Deserializing Catalog: " + catalogUrn);
- FileInputStream catalogIn = null;
- try {
- return new Serializer().deserializeObject(Catalog.class, catalogIn = new FileInputStream(this.getCatalogFile(catalogUrn)));
- }catch (Exception e) {
- throw new CatalogRepositoryException("Failed to Deserialized Catalogs from '" + this.storageDir + "' : " + e.getMessage(), e);
- }finally {
- try {
- catalogIn.close();
- }catch (Exception ignored) {}
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.apache.oodt.cas.catalog.repository.MemoryBasedCatalogRepository#deserializeAllCatalogs()
- */
- public Set<Catalog> deserializeAllCatalogs()
- throws CatalogRepositoryException {
- HashSet<Catalog> catalogs = new HashSet<Catalog>();
- for (String catalogFile : new File(this.storageDir + "/catalogs").list()) {
- Catalog catalog = this.deserializeCatalog(catalogFile.split("\\.ser")[0]);
- catalogs.add(catalog);
- }
- return catalogs;
- }
-
- /*
- * (non-Javadoc)
- * @see org.apache.oodt.cas.catalog.repository.MemoryBasedCatalogRepository#isCatalogSerialized(java.lang.String)
- */
- public boolean isCatalogSerialized(String catalogUrn) {
- return this.getCatalogFile(catalogUrn).exists();
- }
-
- /*
- * (non-Javadoc)
- * @see org.apache.oodt.cas.catalog.repository.MemoryBasedCatalogRepository#serializeCatalog(org.apache.oodt.cas.catalog.Catalog)
- */
- public void serializeCatalog(Catalog catalog)
- throws CatalogRepositoryException {
- LOG.log(Level.INFO, "Serializing Catalog: " + catalog.getId());
- FileOutputStream catalogOut = null;
- try {
- //serialize Catalog
- new Serializer().serializeObject(catalog, (catalogOut = new FileOutputStream(this.getCatalogFileWorker(catalog.getId()))));
- if (this.getCatalogFile(catalog.getId()).exists()) {
- FileUtils.copyFile(this.getCatalogFile(catalog.getId()), this.getCatalogFileBkup(catalog.getId()), true);
- }
- FileUtils.copyFile(this.getCatalogFileWorker(catalog.getId()), this.getCatalogFile(catalog.getId()), true);
- this.getCatalogFileWorker(catalog.getId()).delete();
- this.getCatalogFileBkup(catalog.getId()).delete();
- }catch (Exception e) {
- throw new CatalogRepositoryException("Failed to Serialized Catalogs to '" + this.storageDir + "' : " + e.getMessage(), e);
- }finally {
- try {
- catalogOut.close();
- }catch (Exception ignored) {}
- }
- }
-
- public void serializePluginURLs(List<PluginURL> urls)
- throws CatalogRepositoryException {
- FileOutputStream urlsOut = null;
- try {
- //serialize URLs
- new Serializer().serializeObject(urls, (urlsOut = new FileOutputStream(this.getClassLoaderUrlsFileWorker())));
- if (this.getClassLoaderUrlsFile().exists()) {
- FileUtils.copyFile(this.getClassLoaderUrlsFile(), this.getClassLoaderUrlsFileBkup(), true);
- }
- FileUtils.copyFile(this.getClassLoaderUrlsFileWorker(), this.getClassLoaderUrlsFile(), true);
- this.getClassLoaderUrlsFileWorker().delete();
- this.getClassLoaderUrlsFileBkup().delete();
- }catch (Exception e) {
- throw new CatalogRepositoryException("Failed to Serialized ClassLoader URLs to '" + this.storageDir + "' : " + e.getMessage(), e);
- }finally {
- try {
- urlsOut.close();
- }catch (Exception ignored) {}
- }
- }
-
- public List<PluginURL> deserializePluginURLs() throws CatalogRepositoryException {
- FileInputStream urlsIn = null;
- try {
- if (this.getClassLoaderUrlsFile().exists()) {
- return new Serializer()
- .deserializeObject(List.class, (urlsIn = new FileInputStream(this.getClassLoaderUrlsFile())));
- } else {
- return Collections.emptyList();
- }
- }catch (Exception e) {
- throw new CatalogRepositoryException("Failed to Deserialized All ClassLoader URLs from '" + this.storageDir + "' : " + e.getMessage(), e);
- }finally {
- try {
- urlsIn.close();
- }catch (Exception ignored) {}
- }
- }
-
- public boolean isModifiable() {
- return true;
- }
-
- protected File getCatalogFile(String catalogUrn) {
- return new File(this.storageDir + "/catalogs/" + catalogUrn + ".ser");
- }
-
- protected File getCatalogFileBkup(String catalogUrn) {
- return new File(this.storageDir + "/catalogs/" + catalogUrn + ".ser-bkup");
- }
-
- protected File getCatalogFileWorker(String catalogUrn) {
- return new File(this.storageDir + "/catalogs/" + catalogUrn + ".ser-worker");
- }
-
- protected File getClassLoaderUrlsFile() {
- return new File(this.storageDir + "/classloaders/urls.ser");
- }
-
- protected File getClassLoaderUrlsFileBkup() {
- return new File(this.storageDir + "/classloaders/urls.ser-bkup");
- }
-
- protected File getClassLoaderUrlsFileWorker() {
- return new File(this.storageDir + "/classloaders/urls.ser-worker");
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SerializedCatalogRepositoryFactory.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SerializedCatalogRepositoryFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SerializedCatalogRepositoryFactory.java
deleted file mode 100644
index 7e07b40..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SerializedCatalogRepositoryFactory.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.repository;
-
-//Spring imports
-import org.apache.oodt.cas.catalog.exception.CatalogRepositoryException;
-import org.springframework.beans.factory.annotation.Required;
-
-//OODT imports
-import org.apache.oodt.cas.metadata.util.PathUtils;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A Factory for creating SerializedMemoryBasedCatalogRepository
- * <p>
- */
-public class SerializedCatalogRepositoryFactory implements CatalogRepositoryFactory {
-
- protected String storageDir;
-
- public SerializedCatalogRepositoryFactory() {}
-
- @Required
- public void setStorageDir(String storageDir) {
- this.storageDir = storageDir;
- }
-
- public SerializedCatalogRepository createRepository()
- throws CatalogRepositoryException {
- try {
- return new SerializedCatalogRepository(PathUtils.doDynamicReplacement(this.storageDir));
- }catch (Exception e) {
- throw new CatalogRepositoryException("Failed to create Serialized Catalog Repository : " + e.getMessage(), e);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SpringCatalogRepository.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SpringCatalogRepository.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SpringCatalogRepository.java
deleted file mode 100644
index 029d235..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SpringCatalogRepository.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.repository;
-
-//JDK imports
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.exception.CatalogRepositoryException;
-import org.apache.oodt.cas.catalog.system.Catalog;
-import org.apache.oodt.cas.catalog.util.PluginURL;
-import org.apache.oodt.cas.catalog.util.Serializer;
-
-//Spring imports
-import org.springframework.context.support.FileSystemXmlApplicationContext;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A Spring Framework based CatalogRepository
- * <p>
- */
-public class SpringCatalogRepository implements CatalogRepository {
-
- protected String beanRepo;
-
- public SpringCatalogRepository(String beanRepo) {
- this.beanRepo = beanRepo;
- }
-
- public Set<Catalog> deserializeAllCatalogs()
- throws CatalogRepositoryException {
- try {
- FileSystemXmlApplicationContext appContext = new FileSystemXmlApplicationContext(new String[] { this.beanRepo }, false);
- appContext.setClassLoader(new Serializer().getClassLoader());
- appContext.refresh();
- return new HashSet<Catalog>(appContext.getBeansOfType(Catalog.class).values());
- } catch (Exception e) {
- throw new CatalogRepositoryException(e.getMessage(), e);
- }
- }
-
- public void deleteSerializedCatalog(String catalogUrn)
- throws CatalogRepositoryException {
- throw new CatalogRepositoryException("Modification not allowed during runtime");
- }
-
- public boolean isModifiable() {
- return false;
- }
-
- public void serializeCatalog(Catalog catalog)
- throws CatalogRepositoryException {
- throw new CatalogRepositoryException("Modification not allowed during runtime");
- }
-
- public List<PluginURL> deserializePluginURLs()
- throws CatalogRepositoryException {
- // TODO Auto-generated method stub
- return Collections.emptyList();
- }
-
- public void serializePluginURLs(List<PluginURL> urls)
- throws CatalogRepositoryException {
- throw new CatalogRepositoryException("Modification not allowed during runtime");
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SpringCatalogRepositoryFactory.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SpringCatalogRepositoryFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SpringCatalogRepositoryFactory.java
deleted file mode 100644
index 4a7a71b..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SpringCatalogRepositoryFactory.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.repository;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.exception.CatalogRepositoryException;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A factory for creating SpringCatalogRepository
- * <p>
- */
-public class SpringCatalogRepositoryFactory implements CatalogRepositoryFactory {
-
- protected String catalogBeanRepo;
-
- public CatalogRepository createRepository()
- throws CatalogRepositoryException {
- return new SpringCatalogRepository(this.catalogBeanRepo);
- }
-
- public void setCatalogBeanRepo(String catalogBeanRepo) {
- this.catalogBeanRepo = catalogBeanRepo;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/server/CatalogServiceCommandLineClient.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/CatalogServiceCommandLineClient.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/CatalogServiceCommandLineClient.java
deleted file mode 100644
index df5b72b..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/CatalogServiceCommandLineClient.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.server;
-
-//JDK imports
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-
-//OODT imports
-import org.apache.oodt.cas.cli.CmdLineUtility;
-
-/**
- * Client Utility for sending commands to servers.
- *
- * @author bfoster (Brian Foster)
- */
-public class CatalogServiceCommandLineClient {
-
- public static void main(String[] args) throws IOException {
- // Load Catalog Service properties.
- String propertiesFile = System
- .getProperty("org.apache.oodt.cas.catalog.properties.file");
- if (propertiesFile != null) {
- System.getProperties().load(new FileInputStream(propertiesFile));
- }
-
- // Run Command line.
- CmdLineUtility cmdLineUtility = new CmdLineUtility();
- cmdLineUtility.run(args);
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/server/CatalogServiceServerLauncher.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/CatalogServiceServerLauncher.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/CatalogServiceServerLauncher.java
deleted file mode 100644
index 20700f5..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/CatalogServiceServerLauncher.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.server;
-
-//JDK imports
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-
-//OODT imports
-import org.apache.oodt.cas.cli.CmdLineUtility;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Utility for launching CommunicationChannelServers
- * <p>
- */
-public class CatalogServiceServerLauncher {
-
- private CatalogServiceServerLauncher() {}
-
- public static void main(String[] args) throws IOException {
- // Load Catalog Service properties.
- String propertiesFile = System
- .getProperty("org.apache.oodt.cas.catalog.properties.file");
- if (propertiesFile != null) {
- System.getProperties().load(new FileInputStream(propertiesFile));
- }
-
- // Run Command line.
- CmdLineUtility cmdLineUtility = new CmdLineUtility();
- cmdLineUtility.run(args);
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/AbstractCommunicationChannelClient.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/AbstractCommunicationChannelClient.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/AbstractCommunicationChannelClient.java
deleted file mode 100644
index 0d0ae6f..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/AbstractCommunicationChannelClient.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.server.channel;
-
-//JDK imports
-import java.util.logging.Logger;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.util.Serializer;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * An Abstract Communication Channel Client Interface that automatically handles throw execeptions
- * <p>
- */
-public abstract class AbstractCommunicationChannelClient implements CommunicationChannelClient {
-
- private static Logger LOG = Logger.getLogger(AbstractCommunicationChannelClient.class.getName());
- protected Serializer serializer;
-
- public AbstractCommunicationChannelClient() {
- this.serializer = new Serializer(false);
- }
-
-}
[38/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/libs/markdown.php
----------------------------------------------------------------------
diff --git a/balance/modules/puny/libs/markdown.php b/balance/modules/puny/libs/markdown.php
deleted file mode 100644
index 4fe0caa..0000000
--- a/balance/modules/puny/libs/markdown.php
+++ /dev/null
@@ -1,2949 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#
-# Markdown Extra - A text-to-HTML conversion tool for web writers
-#
-# PHP Markdown & Extra
-# Copyright (c) 2004-2012 Michel Fortin
-# <http://michelf.com/projects/php-markdown/>
-#
-# Original Markdown
-# Copyright (c) 2004-2006 John Gruber
-# <http://daringfireball.net/projects/markdown/>
-#
-
-
-define( 'MARKDOWN_VERSION', "1.0.1o" ); # Sun 8 Jan 2012
-define( 'MARKDOWNEXTRA_VERSION', "1.2.5" ); # Sun 8 Jan 2012
-
-
-#
-# Global default settings:
-#
-
-# Change to ">" for HTML output
-@define( 'MARKDOWN_EMPTY_ELEMENT_SUFFIX', " />");
-
-# Define the width of a tab for code blocks.
-@define( 'MARKDOWN_TAB_WIDTH', 4 );
-
-# Optional title attribute for footnote links and backlinks.
-@define( 'MARKDOWN_FN_LINK_TITLE', "" );
-@define( 'MARKDOWN_FN_BACKLINK_TITLE', "" );
-
-# Optional class attribute for footnote links and backlinks.
-@define( 'MARKDOWN_FN_LINK_CLASS', "" );
-@define( 'MARKDOWN_FN_BACKLINK_CLASS', "" );
-
-
-#
-# WordPress settings:
-#
-
-# Change to false to remove Markdown from posts and/or comments.
-@define( 'MARKDOWN_WP_POSTS', true );
-@define( 'MARKDOWN_WP_COMMENTS', true );
-
-
-
-### Standard Function Interface ###
-
-@define( 'MARKDOWN_PARSER_CLASS', 'MarkdownExtra_Parser' );
-
-function Markdown($text) {
-#
-# Initialize the parser and return the result of its transform method.
-#
- # Setup static parser variable.
- static $parser;
- if (!isset($parser)) {
- $parser_class = MARKDOWN_PARSER_CLASS;
- $parser = new $parser_class;
- }
-
- # Transform text using parser.
- return $parser->transform($text);
-}
-
-
-### WordPress Plugin Interface ###
-
-/*
-Plugin Name: Markdown Extra
-Plugin URI: http://michelf.com/projects/php-markdown/
-Description: <a href="http://daringfireball.net/projects/markdown/syntax">Markdown syntax</a> allows you to write using an easy-to-read, easy-to-write plain text format. Based on the original Perl version by <a href="http://daringfireball.net/">John Gruber</a>. <a href="http://michelf.com/projects/php-markdown/">More...</a>
-Version: 1.2.5
-Author: Michel Fortin
-Author URI: http://michelf.com/
-*/
-
-if (isset($wp_version)) {
- # More details about how it works here:
- # <http://michelf.com/weblog/2005/wordpress-text-flow-vs-markdown/>
-
- # Post content and excerpts
- # - Remove WordPress paragraph generator.
- # - Run Markdown on excerpt, then remove all tags.
- # - Add paragraph tag around the excerpt, but remove it for the excerpt rss.
- if (MARKDOWN_WP_POSTS) {
- remove_filter('the_content', 'wpautop');
- remove_filter('the_content_rss', 'wpautop');
- remove_filter('the_excerpt', 'wpautop');
- add_filter('the_content', 'mdwp_MarkdownPost', 6);
- add_filter('the_content_rss', 'mdwp_MarkdownPost', 6);
- add_filter('get_the_excerpt', 'mdwp_MarkdownPost', 6);
- add_filter('get_the_excerpt', 'trim', 7);
- add_filter('the_excerpt', 'mdwp_add_p');
- add_filter('the_excerpt_rss', 'mdwp_strip_p');
-
- remove_filter('content_save_pre', 'balanceTags', 50);
- remove_filter('excerpt_save_pre', 'balanceTags', 50);
- add_filter('the_content', 'balanceTags', 50);
- add_filter('get_the_excerpt', 'balanceTags', 9);
- }
-
- # Add a footnote id prefix to posts when inside a loop.
- function mdwp_MarkdownPost($text) {
- static $parser;
- if (!$parser) {
- $parser_class = MARKDOWN_PARSER_CLASS;
- $parser = new $parser_class;
- }
- if (is_single() || is_page() || is_feed()) {
- $parser->fn_id_prefix = "";
- } else {
- $parser->fn_id_prefix = get_the_ID() . ".";
- }
- return $parser->transform($text);
- }
-
- # Comments
- # - Remove WordPress paragraph generator.
- # - Remove WordPress auto-link generator.
- # - Scramble important tags before passing them to the kses filter.
- # - Run Markdown on excerpt then remove paragraph tags.
- if (MARKDOWN_WP_COMMENTS) {
- remove_filter('comment_text', 'wpautop', 30);
- remove_filter('comment_text', 'make_clickable');
- add_filter('pre_comment_content', 'Markdown', 6);
- add_filter('pre_comment_content', 'mdwp_hide_tags', 8);
- add_filter('pre_comment_content', 'mdwp_show_tags', 12);
- add_filter('get_comment_text', 'Markdown', 6);
- add_filter('get_comment_excerpt', 'Markdown', 6);
- add_filter('get_comment_excerpt', 'mdwp_strip_p', 7);
-
- global $mdwp_hidden_tags, $mdwp_placeholders;
- $mdwp_hidden_tags = explode(' ',
- '<p> </p> <pre> </pre> <ol> </ol> <ul> </ul> <li> </li>');
- $mdwp_placeholders = explode(' ', str_rot13(
- 'pEj07ZbbBZ U1kqgh4w4p pre2zmeN6K QTi31t9pre ol0MP1jzJR '.
- 'ML5IjmbRol ulANi1NsGY J7zRLJqPul liA8ctl16T K9nhooUHli'));
- }
-
- function mdwp_add_p($text) {
- if (!preg_match('{^$|^<(p|ul|ol|dl|pre|blockquote)>}i', $text)) {
- $text = '<p>'.$text.'</p>';
- $text = preg_replace('{\n{2,}}', "</p>\n\n<p>", $text);
- }
- return $text;
- }
-
- function mdwp_strip_p($t) { return preg_replace('{</?p>}i', '', $t); }
-
- function mdwp_hide_tags($text) {
- global $mdwp_hidden_tags, $mdwp_placeholders;
- return str_replace($mdwp_hidden_tags, $mdwp_placeholders, $text);
- }
- function mdwp_show_tags($text) {
- global $mdwp_hidden_tags, $mdwp_placeholders;
- return str_replace($mdwp_placeholders, $mdwp_hidden_tags, $text);
- }
-}
-
-
-### bBlog Plugin Info ###
-
-function identify_modifier_markdown() {
- return array(
- 'name' => 'markdown',
- 'type' => 'modifier',
- 'nicename' => 'PHP Markdown Extra',
- 'description' => 'A text-to-HTML conversion tool for web writers',
- 'authors' => 'Michel Fortin and John Gruber',
- 'licence' => 'GPL',
- 'version' => MARKDOWNEXTRA_VERSION,
- 'help' => '<a href="http://daringfireball.net/projects/markdown/syntax">Markdown syntax</a> allows you to write using an easy-to-read, easy-to-write plain text format. Based on the original Perl version by <a href="http://daringfireball.net/">John Gruber</a>. <a href="http://michelf.com/projects/php-markdown/">More...</a>',
- );
-}
-
-
-### Smarty Modifier Interface ###
-
-function smarty_modifier_markdown($text) {
- return Markdown($text);
-}
-
-
-### Textile Compatibility Mode ###
-
-# Rename this file to "classTextile.php" and it can replace Textile everywhere.
-
-if (strcasecmp(substr(__FILE__, -16), "classTextile.php") == 0) {
- # Try to include PHP SmartyPants. Should be in the same directory.
- @include_once 'smartypants.php';
- # Fake Textile class. It calls Markdown instead.
- class Textile {
- function TextileThis($text, $lite='', $encode='') {
- if ($lite == '' && $encode == '') $text = Markdown($text);
- if (function_exists('SmartyPants')) $text = SmartyPants($text);
- return $text;
- }
- # Fake restricted version: restrictions are not supported for now.
- function TextileRestricted($text, $lite='', $noimage='') {
- return $this->TextileThis($text, $lite);
- }
- # Workaround to ensure compatibility with TextPattern 4.0.3.
- function blockLite($text) { return $text; }
- }
-}
-
-
-
-#
-# Markdown Parser Class
-#
-
-class Markdown_Parser {
-
- # Regex to match balanced [brackets].
- # Needed to insert a maximum bracked depth while converting to PHP.
- var $nested_brackets_depth = 6;
- var $nested_brackets_re;
-
- var $nested_url_parenthesis_depth = 4;
- var $nested_url_parenthesis_re;
-
- # Table of hash values for escaped characters:
- var $escape_chars = '\`*_{}[]()>#+-.!';
- var $escape_chars_re;
-
- # Change to ">" for HTML output.
- var $empty_element_suffix = MARKDOWN_EMPTY_ELEMENT_SUFFIX;
- var $tab_width = MARKDOWN_TAB_WIDTH;
-
- # Change to `true` to disallow markup or entities.
- var $no_markup = false;
- var $no_entities = false;
-
- # Predefined urls and titles for reference links and images.
- var $predef_urls = array();
- var $predef_titles = array();
-
-
- function Markdown_Parser() {
- #
- # Constructor function. Initialize appropriate member variables.
- #
- $this->_initDetab();
- $this->prepareItalicsAndBold();
-
- $this->nested_brackets_re =
- str_repeat('(?>[^\[\]]+|\[', $this->nested_brackets_depth).
- str_repeat('\])*', $this->nested_brackets_depth);
-
- $this->nested_url_parenthesis_re =
- str_repeat('(?>[^()\s]+|\(', $this->nested_url_parenthesis_depth).
- str_repeat('(?>\)))*', $this->nested_url_parenthesis_depth);
-
- $this->escape_chars_re = '['.preg_quote($this->escape_chars).']';
-
- # Sort document, block, and span gamut in ascendent priority order.
- asort($this->document_gamut);
- asort($this->block_gamut);
- asort($this->span_gamut);
- }
-
-
- # Internal hashes used during transformation.
- var $urls = array();
- var $titles = array();
- var $html_hashes = array();
-
- # Status flag to avoid invalid nesting.
- var $in_anchor = false;
-
-
- function setup() {
- #
- # Called before the transformation process starts to setup parser
- # states.
- #
- # Clear global hashes.
- $this->urls = $this->predef_urls;
- $this->titles = $this->predef_titles;
- $this->html_hashes = array();
-
- $in_anchor = false;
- }
-
- function teardown() {
- #
- # Called after the transformation process to clear any variable
- # which may be taking up memory unnecessarly.
- #
- $this->urls = array();
- $this->titles = array();
- $this->html_hashes = array();
- }
-
-
- function transform($text) {
- #
- # Main function. Performs some preprocessing on the input text
- # and pass it through the document gamut.
- #
- $this->setup();
-
- # Remove UTF-8 BOM and marker character in input, if present.
- $text = preg_replace('{^\xEF\xBB\xBF|\x1A}', '', $text);
-
- # Standardize line endings:
- # DOS to Unix and Mac to Unix
- $text = preg_replace('{\r\n?}', "\n", $text);
-
- # Make sure $text ends with a couple of newlines:
- $text .= "\n\n";
-
- # Convert all tabs to spaces.
- $text = $this->detab($text);
-
- # Turn block-level HTML blocks into hash entries
- $text = $this->hashHTMLBlocks($text);
-
- # Strip any lines consisting only of spaces and tabs.
- # This makes subsequent regexen easier to write, because we can
- # match consecutive blank lines with /\n+/ instead of something
- # contorted like /[ ]*\n+/ .
- $text = preg_replace('/^[ ]+$/m', '', $text);
-
- # Run document gamut methods.
- foreach ($this->document_gamut as $method => $priority) {
- $text = $this->$method($text);
- }
-
- $this->teardown();
-
- return $text . "\n";
- }
-
- var $document_gamut = array(
- # Strip link definitions, store in hashes.
- "stripLinkDefinitions" => 20,
-
- "runBasicBlockGamut" => 30,
- );
-
-
- function stripLinkDefinitions($text) {
- #
- # Strips link definitions from text, stores the URLs and titles in
- # hash references.
- #
- $less_than_tab = $this->tab_width - 1;
-
- # Link defs are in the form: ^[id]: url "optional title"
- $text = preg_replace_callback('{
- ^[ ]{0,'.$less_than_tab.'}\[(.+)\][ ]?: # id = $1
- [ ]*
- \n? # maybe *one* newline
- [ ]*
- (?:
- <(.+?)> # url = $2
- |
- (\S+?) # url = $3
- )
- [ ]*
- \n? # maybe one newline
- [ ]*
- (?:
- (?<=\s) # lookbehind for whitespace
- ["(]
- (.*?) # title = $4
- [")]
- [ ]*
- )? # title is optional
- (?:\n+|\Z)
- }xm',
- array(&$this, '_stripLinkDefinitions_callback'),
- $text);
- return $text;
- }
- function _stripLinkDefinitions_callback($matches) {
- $link_id = strtolower($matches[1]);
- $url = $matches[2] == '' ? $matches[3] : $matches[2];
- $this->urls[$link_id] = $url;
- $this->titles[$link_id] =& $matches[4];
- return ''; # String that will replace the block
- }
-
-
- function hashHTMLBlocks($text) {
- if ($this->no_markup) return $text;
-
- $less_than_tab = $this->tab_width - 1;
-
- # Hashify HTML blocks:
- # We only want to do this for block-level HTML tags, such as headers,
- # lists, and tables. That's because we still want to wrap <p>s around
- # "paragraphs" that are wrapped in non-block-level tags, such as anchors,
- # phrase emphasis, and spans. The list of tags we're looking for is
- # hard-coded:
- #
- # * List "a" is made of tags which can be both inline or block-level.
- # These will be treated block-level when the start tag is alone on
- # its line, otherwise they're not matched here and will be taken as
- # inline later.
- # * List "b" is made of tags which are always block-level;
- #
- $block_tags_a_re = 'ins|del';
- $block_tags_b_re = 'p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|address|'.
- 'script|noscript|form|fieldset|iframe|math';
-
- # Regular expression for the content of a block tag.
- $nested_tags_level = 4;
- $attr = '
- (?> # optional tag attributes
- \s # starts with whitespace
- (?>
- [^>"/]+ # text outside quotes
- |
- /+(?!>) # slash not followed by ">"
- |
- "[^"]*" # text inside double quotes (tolerate ">")
- |
- \'[^\']*\' # text inside single quotes (tolerate ">")
- )*
- )?
- ';
- $content =
- str_repeat('
- (?>
- [^<]+ # content without tag
- |
- <\2 # nested opening tag
- '.$attr.' # attributes
- (?>
- />
- |
- >', $nested_tags_level). # end of opening tag
- '.*?'. # last level nested tag content
- str_repeat('
- </\2\s*> # closing nested tag
- )
- |
- <(?!/\2\s*> # other tags with a different name
- )
- )*',
- $nested_tags_level);
- $content2 = str_replace('\2', '\3', $content);
-
- # First, look for nested blocks, e.g.:
- # <div>
- # <div>
- # tags for inner block must be indented.
- # </div>
- # </div>
- #
- # The outermost tags must start at the left margin for this to match, and
- # the inner nested divs must be indented.
- # We need to do this before the next, more liberal match, because the next
- # match will start at the first `<div>` and stop at the first `</div>`.
- $text = preg_replace_callback('{(?>
- (?>
- (?<=\n\n) # Starting after a blank line
- | # or
- \A\n? # the beginning of the doc
- )
- ( # save in $1
-
- # Match from `\n<tag>` to `</tag>\n`, handling nested tags
- # in between.
-
- [ ]{0,'.$less_than_tab.'}
- <('.$block_tags_b_re.')# start tag = $2
- '.$attr.'> # attributes followed by > and \n
- '.$content.' # content, support nesting
- </\2> # the matching end tag
- [ ]* # trailing spaces/tabs
- (?=\n+|\Z) # followed by a newline or end of document
-
- | # Special version for tags of group a.
-
- [ ]{0,'.$less_than_tab.'}
- <('.$block_tags_a_re.')# start tag = $3
- '.$attr.'>[ ]*\n # attributes followed by >
- '.$content2.' # content, support nesting
- </\3> # the matching end tag
- [ ]* # trailing spaces/tabs
- (?=\n+|\Z) # followed by a newline or end of document
-
- | # Special case just for <hr />. It was easier to make a special
- # case than to make the other regex more complicated.
-
- [ ]{0,'.$less_than_tab.'}
- <(hr) # start tag = $2
- '.$attr.' # attributes
- /?> # the matching end tag
- [ ]*
- (?=\n{2,}|\Z) # followed by a blank line or end of document
-
- | # Special case for standalone HTML comments:
-
- [ ]{0,'.$less_than_tab.'}
- (?s:
- <!-- .*? -->
- )
- [ ]*
- (?=\n{2,}|\Z) # followed by a blank line or end of document
-
- | # PHP and ASP-style processor instructions (<? and <%)
-
- [ ]{0,'.$less_than_tab.'}
- (?s:
- <([?%]) # $2
- .*?
- \2>
- )
- [ ]*
- (?=\n{2,}|\Z) # followed by a blank line or end of document
-
- )
- )}Sxmi',
- array(&$this, '_hashHTMLBlocks_callback'),
- $text);
-
- return $text;
- }
- function _hashHTMLBlocks_callback($matches) {
- $text = $matches[1];
- $key = $this->hashBlock($text);
- return "\n\n$key\n\n";
- }
-
-
- function hashPart($text, $boundary = 'X') {
- #
- # Called whenever a tag must be hashed when a function insert an atomic
- # element in the text stream. Passing $text to through this function gives
- # a unique text-token which will be reverted back when calling unhash.
- #
- # The $boundary argument specify what character should be used to surround
- # the token. By convension, "B" is used for block elements that needs not
- # to be wrapped into paragraph tags at the end, ":" is used for elements
- # that are word separators and "X" is used in the general case.
- #
- # Swap back any tag hash found in $text so we do not have to `unhash`
- # multiple times at the end.
- $text = $this->unhash($text);
-
- # Then hash the block.
- static $i = 0;
- $key = "$boundary\x1A" . ++$i . $boundary;
- $this->html_hashes[$key] = $text;
- return $key; # String that will replace the tag.
- }
-
-
- function hashBlock($text) {
- #
- # Shortcut function for hashPart with block-level boundaries.
- #
- return $this->hashPart($text, 'B');
- }
-
-
- var $block_gamut = array(
- #
- # These are all the transformations that form block-level
- # tags like paragraphs, headers, and list items.
- #
- "doHeaders" => 10,
- "doHorizontalRules" => 20,
-
- "doLists" => 40,
- "doCodeBlocks" => 50,
- "doBlockQuotes" => 60,
- );
-
- function runBlockGamut($text) {
- #
- # Run block gamut tranformations.
- #
- # We need to escape raw HTML in Markdown source before doing anything
- # else. This need to be done for each block, and not only at the
- # begining in the Markdown function since hashed blocks can be part of
- # list items and could have been indented. Indented blocks would have
- # been seen as a code block in a previous pass of hashHTMLBlocks.
- $text = $this->hashHTMLBlocks($text);
-
- return $this->runBasicBlockGamut($text);
- }
-
- function runBasicBlockGamut($text) {
- #
- # Run block gamut tranformations, without hashing HTML blocks. This is
- # useful when HTML blocks are known to be already hashed, like in the first
- # whole-document pass.
- #
- foreach ($this->block_gamut as $method => $priority) {
- $text = $this->$method($text);
- }
-
- # Finally form paragraph and restore hashed blocks.
- $text = $this->formParagraphs($text);
-
- return $text;
- }
-
-
- function doHorizontalRules($text) {
- # Do Horizontal Rules:
- return preg_replace(
- '{
- ^[ ]{0,3} # Leading space
- ([-*_]) # $1: First marker
- (?> # Repeated marker group
- [ ]{0,2} # Zero, one, or two spaces.
- \1 # Marker character
- ){2,} # Group repeated at least twice
- [ ]* # Tailing spaces
- $ # End of line.
- }mx',
- "\n".$this->hashBlock("<hr$this->empty_element_suffix")."\n",
- $text);
- }
-
-
- var $span_gamut = array(
- #
- # These are all the transformations that occur *within* block-level
- # tags like paragraphs, headers, and list items.
- #
- # Process character escapes, code spans, and inline HTML
- # in one shot.
- "parseSpan" => -30,
-
- # Process anchor and image tags. Images must come first,
- # because ![foo][f] looks like an anchor.
- "doImages" => 10,
- "doAnchors" => 20,
-
- # Make links out of things like `<http://example.com/>`
- # Must come after doAnchors, because you can use < and >
- # delimiters in inline links like [this](<url>).
- "doAutoLinks" => 30,
- "encodeAmpsAndAngles" => 40,
-
- "doItalicsAndBold" => 50,
- "doHardBreaks" => 60,
- );
-
- function runSpanGamut($text) {
- #
- # Run span gamut tranformations.
- #
- foreach ($this->span_gamut as $method => $priority) {
- $text = $this->$method($text);
- }
-
- return $text;
- }
-
-
- function doHardBreaks($text) {
- # Do hard breaks:
- return preg_replace_callback('/ {2,}\n/',
- array(&$this, '_doHardBreaks_callback'), $text);
- }
- function _doHardBreaks_callback($matches) {
- return $this->hashPart("<br$this->empty_element_suffix\n");
- }
-
-
- function doAnchors($text) {
- #
- # Turn Markdown link shortcuts into XHTML <a> tags.
- #
- if ($this->in_anchor) return $text;
- $this->in_anchor = true;
-
- #
- # First, handle reference-style links: [link text] [id]
- #
- $text = preg_replace_callback('{
- ( # wrap whole match in $1
- \[
- ('.$this->nested_brackets_re.') # link text = $2
- \]
-
- [ ]? # one optional space
- (?:\n[ ]*)? # one optional newline followed by spaces
-
- \[
- (.*?) # id = $3
- \]
- )
- }xs',
- array(&$this, '_doAnchors_reference_callback'), $text);
-
- #
- # Next, inline-style links: [link text](url "optional title")
- #
- $text = preg_replace_callback('{
- ( # wrap whole match in $1
- \[
- ('.$this->nested_brackets_re.') # link text = $2
- \]
- \( # literal paren
- [ \n]*
- (?:
- <(.+?)> # href = $3
- |
- ('.$this->nested_url_parenthesis_re.') # href = $4
- )
- [ \n]*
- ( # $5
- ([\'"]) # quote char = $6
- (.*?) # Title = $7
- \6 # matching quote
- [ \n]* # ignore any spaces/tabs between closing quote and )
- )? # title is optional
- \)
- )
- }xs',
- array(&$this, '_doAnchors_inline_callback'), $text);
-
- #
- # Last, handle reference-style shortcuts: [link text]
- # These must come last in case you've also got [link text][1]
- # or [link text](/foo)
- #
- $text = preg_replace_callback('{
- ( # wrap whole match in $1
- \[
- ([^\[\]]+) # link text = $2; can\'t contain [ or ]
- \]
- )
- }xs',
- array(&$this, '_doAnchors_reference_callback'), $text);
-
- $this->in_anchor = false;
- return $text;
- }
- function _doAnchors_reference_callback($matches) {
- $whole_match = $matches[1];
- $link_text = $matches[2];
- $link_id =& $matches[3];
-
- if ($link_id == "") {
- # for shortcut links like [this][] or [this].
- $link_id = $link_text;
- }
-
- # lower-case and turn embedded newlines into spaces
- $link_id = strtolower($link_id);
- $link_id = preg_replace('{[ ]?\n}', ' ', $link_id);
-
- if (isset($this->urls[$link_id])) {
- $url = $this->urls[$link_id];
- $url = $this->encodeAttribute($url);
-
- $result = "<a href=\"$url\"";
- if ( isset( $this->titles[$link_id] ) ) {
- $title = $this->titles[$link_id];
- $title = $this->encodeAttribute($title);
- $result .= " title=\"$title\"";
- }
-
- $link_text = $this->runSpanGamut($link_text);
- $result .= ">$link_text</a>";
- $result = $this->hashPart($result);
- }
- else {
- $result = $whole_match;
- }
- return $result;
- }
- function _doAnchors_inline_callback($matches) {
- $whole_match = $matches[1];
- $link_text = $this->runSpanGamut($matches[2]);
- $url = $matches[3] == '' ? $matches[4] : $matches[3];
- $title =& $matches[7];
-
- $url = $this->encodeAttribute($url);
-
- $result = "<a href=\"$url\"";
- if (isset($title)) {
- $title = $this->encodeAttribute($title);
- $result .= " title=\"$title\"";
- }
-
- $link_text = $this->runSpanGamut($link_text);
- $result .= ">$link_text</a>";
-
- return $this->hashPart($result);
- }
-
-
- function doImages($text) {
- #
- # Turn Markdown image shortcuts into <img> tags.
- #
- #
- # First, handle reference-style labeled images: ![alt text][id]
- #
- $text = preg_replace_callback('{
- ( # wrap whole match in $1
- !\[
- ('.$this->nested_brackets_re.') # alt text = $2
- \]
-
- [ ]? # one optional space
- (?:\n[ ]*)? # one optional newline followed by spaces
-
- \[
- (.*?) # id = $3
- \]
-
- )
- }xs',
- array(&$this, '_doImages_reference_callback'), $text);
-
- #
- # Next, handle inline images: 
- # Don't forget: encode * and _
- #
- $text = preg_replace_callback('{
- ( # wrap whole match in $1
- !\[
- ('.$this->nested_brackets_re.') # alt text = $2
- \]
- \s? # One optional whitespace character
- \( # literal paren
- [ \n]*
- (?:
- <(\S*)> # src url = $3
- |
- ('.$this->nested_url_parenthesis_re.') # src url = $4
- )
- [ \n]*
- ( # $5
- ([\'"]) # quote char = $6
- (.*?) # title = $7
- \6 # matching quote
- [ \n]*
- )? # title is optional
- \)
- )
- }xs',
- array(&$this, '_doImages_inline_callback'), $text);
-
- return $text;
- }
- function _doImages_reference_callback($matches) {
- $whole_match = $matches[1];
- $alt_text = $matches[2];
- $link_id = strtolower($matches[3]);
-
- if ($link_id == "") {
- $link_id = strtolower($alt_text); # for shortcut links like ![this][].
- }
-
- $alt_text = $this->encodeAttribute($alt_text);
- if (isset($this->urls[$link_id])) {
- $url = $this->encodeAttribute($this->urls[$link_id]);
- $result = "<img src=\"$url\" alt=\"$alt_text\"";
- if (isset($this->titles[$link_id])) {
- $title = $this->titles[$link_id];
- $title = $this->encodeAttribute($title);
- $result .= " title=\"$title\"";
- }
- $result .= $this->empty_element_suffix;
- $result = $this->hashPart($result);
- }
- else {
- # If there's no such link ID, leave intact:
- $result = $whole_match;
- }
-
- return $result;
- }
- function _doImages_inline_callback($matches) {
- $whole_match = $matches[1];
- $alt_text = $matches[2];
- $url = $matches[3] == '' ? $matches[4] : $matches[3];
- $title =& $matches[7];
-
- $alt_text = $this->encodeAttribute($alt_text);
- $url = $this->encodeAttribute($url);
- $result = "<img src=\"$url\" alt=\"$alt_text\"";
- if (isset($title)) {
- $title = $this->encodeAttribute($title);
- $result .= " title=\"$title\""; # $title already quoted
- }
- $result .= $this->empty_element_suffix;
-
- return $this->hashPart($result);
- }
-
-
- function doHeaders($text) {
- # Setext-style headers:
- # Header 1
- # ========
- #
- # Header 2
- # --------
- #
- $text = preg_replace_callback('{ ^(.+?)[ ]*\n(=+|-+)[ ]*\n+ }mx',
- array(&$this, '_doHeaders_callback_setext'), $text);
-
- # atx-style headers:
- # # Header 1
- # ## Header 2
- # ## Header 2 with closing hashes ##
- # ...
- # ###### Header 6
- #
- $text = preg_replace_callback('{
- ^(\#{1,6}) # $1 = string of #\'s
- [ ]*
- (.+?) # $2 = Header text
- [ ]*
- \#* # optional closing #\'s (not counted)
- \n+
- }xm',
- array(&$this, '_doHeaders_callback_atx'), $text);
-
- return $text;
- }
- function _doHeaders_callback_setext($matches) {
- # Terrible hack to check we haven't found an empty list item.
- if ($matches[2] == '-' && preg_match('{^-(?: |$)}', $matches[1]))
- return $matches[0];
-
- $level = $matches[2]{0} == '=' ? 1 : 2;
- $block = "<h$level>".$this->runSpanGamut($matches[1])."</h$level>";
- return "\n" . $this->hashBlock($block) . "\n\n";
- }
- function _doHeaders_callback_atx($matches) {
- $level = strlen($matches[1]);
- $block = "<h$level>".$this->runSpanGamut($matches[2])."</h$level>";
- return "\n" . $this->hashBlock($block) . "\n\n";
- }
-
-
- function doLists($text) {
- #
- # Form HTML ordered (numbered) and unordered (bulleted) lists.
- #
- $less_than_tab = $this->tab_width - 1;
-
- # Re-usable patterns to match list item bullets and number markers:
- $marker_ul_re = '[*+-]';
- $marker_ol_re = '\d+[\.]';
- $marker_any_re = "(?:$marker_ul_re|$marker_ol_re)";
-
- $markers_relist = array(
- $marker_ul_re => $marker_ol_re,
- $marker_ol_re => $marker_ul_re,
- );
-
- foreach ($markers_relist as $marker_re => $other_marker_re) {
- # Re-usable pattern to match any entirel ul or ol list:
- $whole_list_re = '
- ( # $1 = whole list
- ( # $2
- ([ ]{0,'.$less_than_tab.'}) # $3 = number of spaces
- ('.$marker_re.') # $4 = first list item marker
- [ ]+
- )
- (?s:.+?)
- ( # $5
- \z
- |
- \n{2,}
- (?=\S)
- (?! # Negative lookahead for another list item marker
- [ ]*
- '.$marker_re.'[ ]+
- )
- |
- (?= # Lookahead for another kind of list
- \n
- \3 # Must have the same indentation
- '.$other_marker_re.'[ ]+
- )
- )
- )
- '; // mx
-
- # We use a different prefix before nested lists than top-level lists.
- # See extended comment in _ProcessListItems().
-
- if ($this->list_level) {
- $text = preg_replace_callback('{
- ^
- '.$whole_list_re.'
- }mx',
- array(&$this, '_doLists_callback'), $text);
- }
- else {
- $text = preg_replace_callback('{
- (?:(?<=\n)\n|\A\n?) # Must eat the newline
- '.$whole_list_re.'
- }mx',
- array(&$this, '_doLists_callback'), $text);
- }
- }
-
- return $text;
- }
- function _doLists_callback($matches) {
- # Re-usable patterns to match list item bullets and number markers:
- $marker_ul_re = '[*+-]';
- $marker_ol_re = '\d+[\.]';
- $marker_any_re = "(?:$marker_ul_re|$marker_ol_re)";
-
- $list = $matches[1];
- $list_type = preg_match("/$marker_ul_re/", $matches[4]) ? "ul" : "ol";
-
- $marker_any_re = ( $list_type == "ul" ? $marker_ul_re : $marker_ol_re );
-
- $list .= "\n";
- $result = $this->processListItems($list, $marker_any_re);
-
- $result = $this->hashBlock("<$list_type>\n" . $result . "</$list_type>");
- return "\n". $result ."\n\n";
- }
-
- var $list_level = 0;
-
- function processListItems($list_str, $marker_any_re) {
- #
- # Process the contents of a single ordered or unordered list, splitting it
- # into individual list items.
- #
- # The $this->list_level global keeps track of when we're inside a list.
- # Each time we enter a list, we increment it; when we leave a list,
- # we decrement. If it's zero, we're not in a list anymore.
- #
- # We do this because when we're not inside a list, we want to treat
- # something like this:
- #
- # I recommend upgrading to version
- # 8. Oops, now this line is treated
- # as a sub-list.
- #
- # As a single paragraph, despite the fact that the second line starts
- # with a digit-period-space sequence.
- #
- # Whereas when we're inside a list (or sub-list), that line will be
- # treated as the start of a sub-list. What a kludge, huh? This is
- # an aspect of Markdown's syntax that's hard to parse perfectly
- # without resorting to mind-reading. Perhaps the solution is to
- # change the syntax rules such that sub-lists must start with a
- # starting cardinal number; e.g. "1." or "a.".
-
- $this->list_level++;
-
- # trim trailing blank lines:
- $list_str = preg_replace("/\n{2,}\\z/", "\n", $list_str);
-
- $list_str = preg_replace_callback('{
- (\n)? # leading line = $1
- (^[ ]*) # leading whitespace = $2
- ('.$marker_any_re.' # list marker and space = $3
- (?:[ ]+|(?=\n)) # space only required if item is not empty
- )
- ((?s:.*?)) # list item text = $4
- (?:(\n+(?=\n))|\n) # tailing blank line = $5
- (?= \n* (\z | \2 ('.$marker_any_re.') (?:[ ]+|(?=\n))))
- }xm',
- array(&$this, '_processListItems_callback'), $list_str);
-
- $this->list_level--;
- return $list_str;
- }
- function _processListItems_callback($matches) {
- $item = $matches[4];
- $leading_line =& $matches[1];
- $leading_space =& $matches[2];
- $marker_space = $matches[3];
- $tailing_blank_line =& $matches[5];
-
- if ($leading_line || $tailing_blank_line ||
- preg_match('/\n{2,}/', $item))
- {
- # Replace marker with the appropriate whitespace indentation
- $item = $leading_space . str_repeat(' ', strlen($marker_space)) . $item;
- $item = $this->runBlockGamut($this->outdent($item)."\n");
- }
- else {
- # Recursion for sub-lists:
- $item = $this->doLists($this->outdent($item));
- $item = preg_replace('/\n+$/', '', $item);
- $item = $this->runSpanGamut($item);
- }
-
- return "<li>" . $item . "</li>\n";
- }
-
-
- function doCodeBlocks($text) {
- #
- # Process Markdown `<pre><code>` blocks.
- #
- $text = preg_replace_callback('{
- (?:\n\n|\A\n?)
- ( # $1 = the code block -- one or more lines, starting with a space/tab
- (?>
- [ ]{'.$this->tab_width.'} # Lines must start with a tab or a tab-width of spaces
- .*\n+
- )+
- )
- ((?=^[ ]{0,'.$this->tab_width.'}\S)|\Z) # Lookahead for non-space at line-start, or end of doc
- }xm',
- array(&$this, '_doCodeBlocks_callback'), $text);
-
- return $text;
- }
- function _doCodeBlocks_callback($matches) {
- $codeblock = $matches[1];
-
- $codeblock = $this->outdent($codeblock);
- $codeblock = htmlspecialchars($codeblock, ENT_NOQUOTES);
-
- # trim leading newlines and trailing newlines
- $codeblock = preg_replace('/\A\n+|\n+\z/', '', $codeblock);
-
- $codeblock = "<pre><code>$codeblock\n</code></pre>";
- return "\n\n".$this->hashBlock($codeblock)."\n\n";
- }
-
-
- function makeCodeSpan($code) {
- #
- # Create a code span markup for $code. Called from handleSpanToken.
- #
- $code = htmlspecialchars(trim($code), ENT_NOQUOTES);
- return $this->hashPart("<code>$code</code>");
- }
-
-
- var $em_relist = array(
- '' => '(?:(?<!\*)\*(?!\*)|(?<!_)_(?!_))(?=\S|$)(?![\.,:;]\s)',
- '*' => '(?<=\S|^)(?<!\*)\*(?!\*)',
- '_' => '(?<=\S|^)(?<!_)_(?!_)',
- );
- var $strong_relist = array(
- '' => '(?:(?<!\*)\*\*(?!\*)|(?<!_)__(?!_))(?=\S|$)(?![\.,:;]\s)',
- '**' => '(?<=\S|^)(?<!\*)\*\*(?!\*)',
- '__' => '(?<=\S|^)(?<!_)__(?!_)',
- );
- var $em_strong_relist = array(
- '' => '(?:(?<!\*)\*\*\*(?!\*)|(?<!_)___(?!_))(?=\S|$)(?![\.,:;]\s)',
- '***' => '(?<=\S|^)(?<!\*)\*\*\*(?!\*)',
- '___' => '(?<=\S|^)(?<!_)___(?!_)',
- );
- var $em_strong_prepared_relist;
-
- function prepareItalicsAndBold() {
- #
- # Prepare regular expressions for searching emphasis tokens in any
- # context.
- #
- foreach ($this->em_relist as $em => $em_re) {
- foreach ($this->strong_relist as $strong => $strong_re) {
- # Construct list of allowed token expressions.
- $token_relist = array();
- if (isset($this->em_strong_relist["$em$strong"])) {
- $token_relist[] = $this->em_strong_relist["$em$strong"];
- }
- $token_relist[] = $em_re;
- $token_relist[] = $strong_re;
-
- # Construct master expression from list.
- $token_re = '{('. implode('|', $token_relist) .')}';
- $this->em_strong_prepared_relist["$em$strong"] = $token_re;
- }
- }
- }
-
- function doItalicsAndBold($text) {
- $token_stack = array('');
- $text_stack = array('');
- $em = '';
- $strong = '';
- $tree_char_em = false;
-
- while (1) {
- #
- # Get prepared regular expression for seraching emphasis tokens
- # in current context.
- #
- $token_re = $this->em_strong_prepared_relist["$em$strong"];
-
- #
- # Each loop iteration search for the next emphasis token.
- # Each token is then passed to handleSpanToken.
- #
- $parts = preg_split($token_re, $text, 2, PREG_SPLIT_DELIM_CAPTURE);
- $text_stack[0] .= $parts[0];
- $token =& $parts[1];
- $text =& $parts[2];
-
- if (empty($token)) {
- # Reached end of text span: empty stack without emitting.
- # any more emphasis.
- while ($token_stack[0]) {
- $text_stack[1] .= array_shift($token_stack);
- $text_stack[0] .= array_shift($text_stack);
- }
- break;
- }
-
- $token_len = strlen($token);
- if ($tree_char_em) {
- # Reached closing marker while inside a three-char emphasis.
- if ($token_len == 3) {
- # Three-char closing marker, close em and strong.
- array_shift($token_stack);
- $span = array_shift($text_stack);
- $span = $this->runSpanGamut($span);
- $span = "<strong><em>$span</em></strong>";
- $text_stack[0] .= $this->hashPart($span);
- $em = '';
- $strong = '';
- } else {
- # Other closing marker: close one em or strong and
- # change current token state to match the other
- $token_stack[0] = str_repeat($token{0}, 3-$token_len);
- $tag = $token_len == 2 ? "strong" : "em";
- $span = $text_stack[0];
- $span = $this->runSpanGamut($span);
- $span = "<$tag>$span</$tag>";
- $text_stack[0] = $this->hashPart($span);
- $$tag = ''; # $$tag stands for $em or $strong
- }
- $tree_char_em = false;
- } else if ($token_len == 3) {
- if ($em) {
- # Reached closing marker for both em and strong.
- # Closing strong marker:
- for ($i = 0; $i < 2; ++$i) {
- $shifted_token = array_shift($token_stack);
- $tag = strlen($shifted_token) == 2 ? "strong" : "em";
- $span = array_shift($text_stack);
- $span = $this->runSpanGamut($span);
- $span = "<$tag>$span</$tag>";
- $text_stack[0] .= $this->hashPart($span);
- $$tag = ''; # $$tag stands for $em or $strong
- }
- } else {
- # Reached opening three-char emphasis marker. Push on token
- # stack; will be handled by the special condition above.
- $em = $token{0};
- $strong = "$em$em";
- array_unshift($token_stack, $token);
- array_unshift($text_stack, '');
- $tree_char_em = true;
- }
- } else if ($token_len == 2) {
- if ($strong) {
- # Unwind any dangling emphasis marker:
- if (strlen($token_stack[0]) == 1) {
- $text_stack[1] .= array_shift($token_stack);
- $text_stack[0] .= array_shift($text_stack);
- }
- # Closing strong marker:
- array_shift($token_stack);
- $span = array_shift($text_stack);
- $span = $this->runSpanGamut($span);
- $span = "<strong>$span</strong>";
- $text_stack[0] .= $this->hashPart($span);
- $strong = '';
- } else {
- array_unshift($token_stack, $token);
- array_unshift($text_stack, '');
- $strong = $token;
- }
- } else {
- # Here $token_len == 1
- if ($em) {
- if (strlen($token_stack[0]) == 1) {
- # Closing emphasis marker:
- array_shift($token_stack);
- $span = array_shift($text_stack);
- $span = $this->runSpanGamut($span);
- $span = "<em>$span</em>";
- $text_stack[0] .= $this->hashPart($span);
- $em = '';
- } else {
- $text_stack[0] .= $token;
- }
- } else {
- array_unshift($token_stack, $token);
- array_unshift($text_stack, '');
- $em = $token;
- }
- }
- }
- return $text_stack[0];
- }
-
-
- function doBlockQuotes($text) {
- $text = preg_replace_callback('/
- ( # Wrap whole match in $1
- (?>
- ^[ ]*>[ ]? # ">" at the start of a line
- .+\n # rest of the first line
- (.+\n)* # subsequent consecutive lines
- \n* # blanks
- )+
- )
- /xm',
- array(&$this, '_doBlockQuotes_callback'), $text);
-
- return $text;
- }
- function _doBlockQuotes_callback($matches) {
- $bq = $matches[1];
- # trim one level of quoting - trim whitespace-only lines
- $bq = preg_replace('/^[ ]*>[ ]?|^[ ]+$/m', '', $bq);
- $bq = $this->runBlockGamut($bq); # recurse
-
- $bq = preg_replace('/^/m', " ", $bq);
- # These leading spaces cause problem with <pre> content,
- # so we need to fix that:
- $bq = preg_replace_callback('{(\s*<pre>.+?</pre>)}sx',
- array(&$this, '_doBlockQuotes_callback2'), $bq);
-
- return "\n". $this->hashBlock("<blockquote>\n$bq\n</blockquote>")."\n\n";
- }
- function _doBlockQuotes_callback2($matches) {
- $pre = $matches[1];
- $pre = preg_replace('/^ /m', '', $pre);
- return $pre;
- }
-
-
- function formParagraphs($text) {
- #
- # Params:
- # $text - string to process with html <p> tags
- #
- # Strip leading and trailing lines:
- $text = preg_replace('/\A\n+|\n+\z/', '', $text);
-
- $grafs = preg_split('/\n{2,}/', $text, -1, PREG_SPLIT_NO_EMPTY);
-
- #
- # Wrap <p> tags and unhashify HTML blocks
- #
- foreach ($grafs as $key => $value) {
- if (!preg_match('/^B\x1A[0-9]+B$/', $value)) {
- # Is a paragraph.
- $value = $this->runSpanGamut($value);
- $value = preg_replace('/^([ ]*)/', "<p>", $value);
- $value .= "</p>";
- $grafs[$key] = $this->unhash($value);
- }
- else {
- # Is a block.
- # Modify elements of @grafs in-place...
- $graf = $value;
- $block = $this->html_hashes[$graf];
- $graf = $block;
-// if (preg_match('{
-// \A
-// ( # $1 = <div> tag
-// <div \s+
-// [^>]*
-// \b
-// markdown\s*=\s* ([\'"]) # $2 = attr quote char
-// 1
-// \2
-// [^>]*
-// >
-// )
-// ( # $3 = contents
-// .*
-// )
-// (</div>) # $4 = closing tag
-// \z
-// }xs', $block, $matches))
-// {
-// list(, $div_open, , $div_content, $div_close) = $matches;
-//
-// # We can't call Markdown(), because that resets the hash;
-// # that initialization code should be pulled into its own sub, though.
-// $div_content = $this->hashHTMLBlocks($div_content);
-//
-// # Run document gamut methods on the content.
-// foreach ($this->document_gamut as $method => $priority) {
-// $div_content = $this->$method($div_content);
-// }
-//
-// $div_open = preg_replace(
-// '{\smarkdown\s*=\s*([\'"]).+?\1}', '', $div_open);
-//
-// $graf = $div_open . "\n" . $div_content . "\n" . $div_close;
-// }
- $grafs[$key] = $graf;
- }
- }
-
- return implode("\n\n", $grafs);
- }
-
-
- function encodeAttribute($text) {
- #
- # Encode text for a double-quoted HTML attribute. This function
- # is *not* suitable for attributes enclosed in single quotes.
- #
- $text = $this->encodeAmpsAndAngles($text);
- $text = str_replace('"', '"', $text);
- return $text;
- }
-
-
- function encodeAmpsAndAngles($text) {
- #
- # Smart processing for ampersands and angle brackets that need to
- # be encoded. Valid character entities are left alone unless the
- # no-entities mode is set.
- #
- if ($this->no_entities) {
- $text = str_replace('&', '&', $text);
- } else {
- # Ampersand-encoding based entirely on Nat Irons's Amputator
- # MT plugin: <http://bumppo.net/projects/amputator/>
- $text = preg_replace('/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/',
- '&', $text);;
- }
- # Encode remaining <'s
- $text = str_replace('<', '<', $text);
-
- return $text;
- }
-
-
- function doAutoLinks($text) {
- $text = preg_replace_callback('{<((https?|ftp|dict):[^\'">\s]+)>}i',
- array(&$this, '_doAutoLinks_url_callback'), $text);
-
- # Email addresses: <ad...@domain.foo>
- $text = preg_replace_callback('{
- <
- (?:mailto:)?
- (
- (?:
- [-!#$%&\'*+/=?^_`.{|}~\w\x80-\xFF]+
- |
- ".*?"
- )
- \@
- (?:
- [-a-z0-9\x80-\xFF]+(\.[-a-z0-9\x80-\xFF]+)*\.[a-z]+
- |
- \[[\d.a-fA-F:]+\] # IPv4 & IPv6
- )
- )
- >
- }xi',
- array(&$this, '_doAutoLinks_email_callback'), $text);
-
- return $text;
- }
- function _doAutoLinks_url_callback($matches) {
- $url = $this->encodeAttribute($matches[1]);
- $link = "<a href=\"$url\">$url</a>";
- return $this->hashPart($link);
- }
- function _doAutoLinks_email_callback($matches) {
- $address = $matches[1];
- $link = $this->encodeEmailAddress($address);
- return $this->hashPart($link);
- }
-
-
- function encodeEmailAddress($addr) {
- #
- # Input: an email address, e.g. "foo@example.com"
- #
- # Output: the email address as a mailto link, with each character
- # of the address encoded as either a decimal or hex entity, in
- # the hopes of foiling most address harvesting spam bots. E.g.:
- #
- # <p><a href="mailto:foo
- # @example.co
- # m">foo@exampl
- # e.com</a></p>
- #
- # Based by a filter by Matthew Wickline, posted to BBEdit-Talk.
- # With some optimizations by Milian Wolff.
- #
- $addr = "mailto:" . $addr;
- $chars = preg_split('/(?<!^)(?!$)/', $addr);
- $seed = (int)abs(crc32($addr) / strlen($addr)); # Deterministic seed.
-
- foreach ($chars as $key => $char) {
- $ord = ord($char);
- # Ignore non-ascii chars.
- if ($ord < 128) {
- $r = ($seed * (1 + $key)) % 100; # Pseudo-random function.
- # roughly 10% raw, 45% hex, 45% dec
- # '@' *must* be encoded. I insist.
- if ($r > 90 && $char != '@') /* do nothing */;
- else if ($r < 45) $chars[$key] = '&#x'.dechex($ord).';';
- else $chars[$key] = '&#'.$ord.';';
- }
- }
-
- $addr = implode('', $chars);
- $text = implode('', array_slice($chars, 7)); # text without `mailto:`
- $addr = "<a href=\"$addr\">$text</a>";
-
- return $addr;
- }
-
-
- function parseSpan($str) {
- #
- # Take the string $str and parse it into tokens, hashing embeded HTML,
- # escaped characters and handling code spans.
- #
- $output = '';
-
- $span_re = '{
- (
- \\\\'.$this->escape_chars_re.'
- |
- (?<![`\\\\])
- `+ # code span marker
- '.( $this->no_markup ? '' : '
- |
- <!-- .*? --> # comment
- |
- <\?.*?\?> | <%.*?%> # processing instruction
- |
- <[/!$]?[-a-zA-Z0-9:_]+ # regular tags
- (?>
- \s
- (?>[^"\'>]+|"[^"]*"|\'[^\']*\')*
- )?
- >
- ').'
- )
- }xs';
-
- while (1) {
- #
- # Each loop iteration seach for either the next tag, the next
- # openning code span marker, or the next escaped character.
- # Each token is then passed to handleSpanToken.
- #
- $parts = preg_split($span_re, $str, 2, PREG_SPLIT_DELIM_CAPTURE);
-
- # Create token from text preceding tag.
- if ($parts[0] != "") {
- $output .= $parts[0];
- }
-
- # Check if we reach the end.
- if (isset($parts[1])) {
- $output .= $this->handleSpanToken($parts[1], $parts[2]);
- $str = $parts[2];
- }
- else {
- break;
- }
- }
-
- return $output;
- }
-
-
- function handleSpanToken($token, &$str) {
- #
- # Handle $token provided by parseSpan by determining its nature and
- # returning the corresponding value that should replace it.
- #
- switch ($token{0}) {
- case "\\":
- return $this->hashPart("&#". ord($token{1}). ";");
- case "`":
- # Search for end marker in remaining text.
- if (preg_match('/^(.*?[^`])'.preg_quote($token).'(?!`)(.*)$/sm',
- $str, $matches))
- {
- $str = $matches[2];
- $codespan = $this->makeCodeSpan($matches[1]);
- return $this->hashPart($codespan);
- }
- return $token; // return as text since no ending marker found.
- default:
- return $this->hashPart($token);
- }
- }
-
-
- function outdent($text) {
- #
- # Remove one level of line-leading tabs or spaces
- #
- return preg_replace('/^(\t|[ ]{1,'.$this->tab_width.'})/m', '', $text);
- }
-
-
- # String length function for detab. `_initDetab` will create a function to
- # hanlde UTF-8 if the default function does not exist.
- var $utf8_strlen = 'mb_strlen';
-
- function detab($text) {
- #
- # Replace tabs with the appropriate amount of space.
- #
- # For each line we separate the line in blocks delemited by
- # tab characters. Then we reconstruct every line by adding the
- # appropriate number of space between each blocks.
-
- $text = preg_replace_callback('/^.*\t.*$/m',
- array(&$this, '_detab_callback'), $text);
-
- return $text;
- }
- function _detab_callback($matches) {
- $line = $matches[0];
- $strlen = $this->utf8_strlen; # strlen function for UTF-8.
-
- # Split in blocks.
- $blocks = explode("\t", $line);
- # Add each blocks to the line.
- $line = $blocks[0];
- unset($blocks[0]); # Do not add first block twice.
- foreach ($blocks as $block) {
- # Calculate amount of space, insert spaces, insert block.
- $amount = $this->tab_width -
- $strlen($line, 'UTF-8') % $this->tab_width;
- $line .= str_repeat(" ", $amount) . $block;
- }
- return $line;
- }
- function _initDetab() {
- #
- # Check for the availability of the function in the `utf8_strlen` property
- # (initially `mb_strlen`). If the function is not available, create a
- # function that will loosely count the number of UTF-8 characters with a
- # regular expression.
- #
- if (function_exists($this->utf8_strlen)) return;
- $this->utf8_strlen = create_function('$text', 'return preg_match_all(
- "/[\\\\x00-\\\\xBF]|[\\\\xC0-\\\\xFF][\\\\x80-\\\\xBF]*/",
- $text, $m);');
- }
-
-
- function unhash($text) {
- #
- # Swap back in all the tags hashed by _HashHTMLBlocks.
- #
- return preg_replace_callback('/(.)\x1A[0-9]+\1/',
- array(&$this, '_unhash_callback'), $text);
- }
- function _unhash_callback($matches) {
- return $this->html_hashes[$matches[0]];
- }
-
-}
-
-
-#
-# Markdown Extra Parser Class
-#
-
-class MarkdownExtra_Parser extends Markdown_Parser {
-
- # Prefix for footnote ids.
- var $fn_id_prefix = "";
-
- # Optional title attribute for footnote links and backlinks.
- var $fn_link_title = MARKDOWN_FN_LINK_TITLE;
- var $fn_backlink_title = MARKDOWN_FN_BACKLINK_TITLE;
-
- # Optional class attribute for footnote links and backlinks.
- var $fn_link_class = MARKDOWN_FN_LINK_CLASS;
- var $fn_backlink_class = MARKDOWN_FN_BACKLINK_CLASS;
-
- # Predefined abbreviations.
- var $predef_abbr = array();
-
-
- function MarkdownExtra_Parser() {
- #
- # Constructor function. Initialize the parser object.
- #
- # Add extra escapable characters before parent constructor
- # initialize the table.
- $this->escape_chars .= ':|';
-
- # Insert extra document, block, and span transformations.
- # Parent constructor will do the sorting.
- $this->document_gamut += array(
- "doFencedCodeBlocks" => 5,
- "stripFootnotes" => 15,
- "stripAbbreviations" => 25,
- "appendFootnotes" => 50,
- );
- $this->block_gamut += array(
- "doFencedCodeBlocks" => 5,
- "doTables" => 15,
- "doDefLists" => 45,
- );
- $this->span_gamut += array(
- "doFootnotes" => 5,
- "doAbbreviations" => 70,
- );
-
- parent::Markdown_Parser();
- }
-
-
- # Extra variables used during extra transformations.
- var $footnotes = array();
- var $footnotes_ordered = array();
- var $abbr_desciptions = array();
- var $abbr_word_re = '';
-
- # Give the current footnote number.
- var $footnote_counter = 1;
-
-
- function setup() {
- #
- # Setting up Extra-specific variables.
- #
- parent::setup();
-
- $this->footnotes = array();
- $this->footnotes_ordered = array();
- $this->abbr_desciptions = array();
- $this->abbr_word_re = '';
- $this->footnote_counter = 1;
-
- foreach ($this->predef_abbr as $abbr_word => $abbr_desc) {
- if ($this->abbr_word_re)
- $this->abbr_word_re .= '|';
- $this->abbr_word_re .= preg_quote($abbr_word);
- $this->abbr_desciptions[$abbr_word] = trim($abbr_desc);
- }
- }
-
- function teardown() {
- #
- # Clearing Extra-specific variables.
- #
- $this->footnotes = array();
- $this->footnotes_ordered = array();
- $this->abbr_desciptions = array();
- $this->abbr_word_re = '';
-
- parent::teardown();
- }
-
-
- ### HTML Block Parser ###
-
- # Tags that are always treated as block tags:
- var $block_tags_re = 'p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|address|form|fieldset|iframe|hr|legend';
-
- # Tags treated as block tags only if the opening tag is alone on it's line:
- var $context_block_tags_re = 'script|noscript|math|ins|del';
-
- # Tags where markdown="1" default to span mode:
- var $contain_span_tags_re = 'p|h[1-6]|li|dd|dt|td|th|legend|address';
-
- # Tags which must not have their contents modified, no matter where
- # they appear:
- var $clean_tags_re = 'script|math';
-
- # Tags that do not need to be closed.
- var $auto_close_tags_re = 'hr|img';
-
-
- function hashHTMLBlocks($text) {
- #
- # Hashify HTML Blocks and "clean tags".
- #
- # We only want to do this for block-level HTML tags, such as headers,
- # lists, and tables. That's because we still want to wrap <p>s around
- # "paragraphs" that are wrapped in non-block-level tags, such as anchors,
- # phrase emphasis, and spans. The list of tags we're looking for is
- # hard-coded.
- #
- # This works by calling _HashHTMLBlocks_InMarkdown, which then calls
- # _HashHTMLBlocks_InHTML when it encounter block tags. When the markdown="1"
- # attribute is found whitin a tag, _HashHTMLBlocks_InHTML calls back
- # _HashHTMLBlocks_InMarkdown to handle the Markdown syntax within the tag.
- # These two functions are calling each other. It's recursive!
- #
- #
- # Call the HTML-in-Markdown hasher.
- #
- list($text, ) = $this->_hashHTMLBlocks_inMarkdown($text);
-
- return $text;
- }
- function _hashHTMLBlocks_inMarkdown($text, $indent = 0,
- $enclosing_tag_re = '', $span = false)
- {
- #
- # Parse markdown text, calling _HashHTMLBlocks_InHTML for block tags.
- #
- # * $indent is the number of space to be ignored when checking for code
- # blocks. This is important because if we don't take the indent into
- # account, something like this (which looks right) won't work as expected:
- #
- # <div>
- # <div markdown="1">
- # Hello World. <-- Is this a Markdown code block or text?
- # </div> <-- Is this a Markdown code block or a real tag?
- # <div>
- #
- # If you don't like this, just don't indent the tag on which
- # you apply the markdown="1" attribute.
- #
- # * If $enclosing_tag_re is not empty, stops at the first unmatched closing
- # tag with that name. Nested tags supported.
- #
- # * If $span is true, text inside must treated as span. So any double
- # newline will be replaced by a single newline so that it does not create
- # paragraphs.
- #
- # Returns an array of that form: ( processed text , remaining text )
- #
- if ($text === '') return array('', '');
-
- # Regex to check for the presense of newlines around a block tag.
- $newline_before_re = '/(?:^\n?|\n\n)*$/';
- $newline_after_re =
- '{
- ^ # Start of text following the tag.
- (?>[ ]*<!--.*?-->)? # Optional comment.
- [ ]*\n # Must be followed by newline.
- }xs';
-
- # Regex to match any tag.
- $block_tag_re =
- '{
- ( # $2: Capture hole tag.
- </? # Any opening or closing tag.
- (?> # Tag name.
- '.$this->block_tags_re.' |
- '.$this->context_block_tags_re.' |
- '.$this->clean_tags_re.' |
- (?!\s)'.$enclosing_tag_re.'
- )
- (?:
- (?=[\s"\'/a-zA-Z0-9]) # Allowed characters after tag name.
- (?>
- ".*?" | # Double quotes (can contain `>`)
- \'.*?\' | # Single quotes (can contain `>`)
- .+? # Anything but quotes and `>`.
- )*?
- )?
- > # End of tag.
- |
- <!-- .*? --> # HTML Comment
- |
- <\?.*?\?> | <%.*?%> # Processing instruction
- |
- <!\[CDATA\[.*?\]\]> # CData Block
- |
- # Code span marker
- `+
- '. ( !$span ? ' # If not in span.
- |
- # Indented code block
- (?: ^[ ]*\n | ^ | \n[ ]*\n )
- [ ]{'.($indent+4).'}[^\n]* \n
- (?>
- (?: [ ]{'.($indent+4).'}[^\n]* | [ ]* ) \n
- )*
- |
- # Fenced code block marker
- (?> ^ | \n )
- [ ]{0,'.($indent).'}~~~+[ ]*\n
- ' : '' ). ' # End (if not is span).
- )
- }xs';
-
-
- $depth = 0; # Current depth inside the tag tree.
- $parsed = ""; # Parsed text that will be returned.
-
- #
- # Loop through every tag until we find the closing tag of the parent
- # or loop until reaching the end of text if no parent tag specified.
- #
- do {
- #
- # Split the text using the first $tag_match pattern found.
- # Text before pattern will be first in the array, text after
- # pattern will be at the end, and between will be any catches made
- # by the pattern.
- #
- $parts = preg_split($block_tag_re, $text, 2,
- PREG_SPLIT_DELIM_CAPTURE);
-
- # If in Markdown span mode, add a empty-string span-level hash
- # after each newline to prevent triggering any block element.
- if ($span) {
- $void = $this->hashPart("", ':');
- $newline = "$void\n";
- $parts[0] = $void . str_replace("\n", $newline, $parts[0]) . $void;
- }
-
- $parsed .= $parts[0]; # Text before current tag.
-
- # If end of $text has been reached. Stop loop.
- if (count($parts) < 3) {
- $text = "";
- break;
- }
-
- $tag = $parts[1]; # Tag to handle.
- $text = $parts[2]; # Remaining text after current tag.
- $tag_re = preg_quote($tag); # For use in a regular expression.
-
- #
- # Check for: Code span marker
- #
- if ($tag{0} == "`") {
- # Find corresponding end marker.
- $tag_re = preg_quote($tag);
- if (preg_match('{^(?>.+?|\n(?!\n))*?(?<!`)'.$tag_re.'(?!`)}',
- $text, $matches))
- {
- # End marker found: pass text unchanged until marker.
- $parsed .= $tag . $matches[0];
- $text = substr($text, strlen($matches[0]));
- }
- else {
- # Unmatched marker: just skip it.
- $parsed .= $tag;
- }
- }
- #
- # Check for: Fenced code block marker.
- #
- else if (preg_match('{^\n?[ ]{0,'.($indent+3).'}~}', $tag)) {
- # Fenced code block marker: find matching end marker.
- $tag_re = preg_quote(trim($tag));
- if (preg_match('{^(?>.*\n)+?[ ]{0,'.($indent).'}'.$tag_re.'[ ]*\n}', $text,
- $matches))
- {
- # End marker found: pass text unchanged until marker.
- $parsed .= $tag . $matches[0];
- $text = substr($text, strlen($matches[0]));
- }
- else {
- # No end marker: just skip it.
- $parsed .= $tag;
- }
- }
- #
- # Check for: Indented code block.
- #
- else if ($tag{0} == "\n" || $tag{0} == " ") {
- # Indented code block: pass it unchanged, will be handled
- # later.
- $parsed .= $tag;
- }
- #
- # Check for: Opening Block level tag or
- # Opening Context Block tag (like ins and del)
- # used as a block tag (tag is alone on it's line).
- #
- else if (preg_match('{^<(?:'.$this->block_tags_re.')\b}', $tag) ||
- ( preg_match('{^<(?:'.$this->context_block_tags_re.')\b}', $tag) &&
- preg_match($newline_before_re, $parsed) &&
- preg_match($newline_after_re, $text) )
- )
- {
- # Need to parse tag and following text using the HTML parser.
- list($block_text, $text) =
- $this->_hashHTMLBlocks_inHTML($tag . $text, "hashBlock", true);
-
- # Make sure it stays outside of any paragraph by adding newlines.
- $parsed .= "\n\n$block_text\n\n";
- }
- #
- # Check for: Clean tag (like script, math)
- # HTML Comments, processing instructions.
- #
- else if (preg_match('{^<(?:'.$this->clean_tags_re.')\b}', $tag) ||
- $tag{1} == '!' || $tag{1} == '?')
- {
- # Need to parse tag and following text using the HTML parser.
- # (don't check for markdown attribute)
- list($block_text, $text) =
- $this->_hashHTMLBlocks_inHTML($tag . $text, "hashClean", false);
-
- $parsed .= $block_text;
- }
- #
- # Check for: Tag with same name as enclosing tag.
- #
- else if ($enclosing_tag_re !== '' &&
- # Same name as enclosing tag.
- preg_match('{^</?(?:'.$enclosing_tag_re.')\b}', $tag))
- {
- #
- # Increase/decrease nested tag count.
- #
- if ($tag{1} == '/') $depth--;
- else if ($tag{strlen($tag)-2} != '/') $depth++;
-
- if ($depth < 0) {
- #
- # Going out of parent element. Clean up and break so we
- # return to the calling function.
- #
- $text = $tag . $text;
- break;
- }
-
- $parsed .= $tag;
- }
- else {
- $parsed .= $tag;
- }
- } while ($depth >= 0);
-
- return array($parsed, $text);
- }
- function _hashHTMLBlocks_inHTML($text, $hash_method, $md_attr) {
- #
- # Parse HTML, calling _HashHTMLBlocks_InMarkdown for block tags.
- #
- # * Calls $hash_method to convert any blocks.
- # * Stops when the first opening tag closes.
- # * $md_attr indicate if the use of the `markdown="1"` attribute is allowed.
- # (it is not inside clean tags)
- #
- # Returns an array of that form: ( processed text , remaining text )
- #
- if ($text === '') return array('', '');
-
- # Regex to match `markdown` attribute inside of a tag.
- $markdown_attr_re = '
- {
- \s* # Eat whitespace before the `markdown` attribute
- markdown
- \s*=\s*
- (?>
- (["\']) # $1: quote delimiter
- (.*?) # $2: attribute value
- \1 # matching delimiter
- |
- ([^\s>]*) # $3: unquoted attribute value
- )
- () # $4: make $3 always defined (avoid warnings)
- }xs';
-
- # Regex to match any tag.
- $tag_re = '{
- ( # $2: Capture hole tag.
- </? # Any opening or closing tag.
- [\w:$]+ # Tag name.
- (?:
- (?=[\s"\'/a-zA-Z0-9]) # Allowed characters after tag name.
- (?>
- ".*?" | # Double quotes (can contain `>`)
- \'.*?\' | # Single quotes (can contain `>`)
- .+? # Anything but quotes and `>`.
- )*?
- )?
- > # End of tag.
- |
- <!-- .*? --> # HTML Comment
- |
- <\?.*?\?> | <%.*?%> # Processing instruction
- |
- <!\[CDATA\[.*?\]\]> # CData Block
- )
- }xs';
-
- $original_text = $text; # Save original text in case of faliure.
-
- $depth = 0; # Current depth inside the tag tree.
- $block_text = ""; # Temporary text holder for current text.
- $parsed = ""; # Parsed text that will be returned.
-
- #
- # Get the name of the starting tag.
- # (This pattern makes $base_tag_name_re safe without quoting.)
- #
- if (preg_match('/^<([\w:$]*)\b/', $text, $matches))
- $base_tag_name_re = $matches[1];
-
- #
- # Loop through every tag until we find the corresponding closing tag.
- #
- do {
- #
- # Split the text using the first $tag_match pattern found.
- # Text before pattern will be first in the array, text after
- # pattern will be at the end, and between will be any catches made
- # by the pattern.
- #
- $parts = preg_split($tag_re, $text, 2, PREG_SPLIT_DELIM_CAPTURE);
-
- if (count($parts) < 3) {
- #
- # End of $text reached with unbalenced tag(s).
- # In that case, we return original text unchanged and pass the
- # first character as filtered to prevent an infinite loop in the
- # parent function.
- #
- return array($original_text{0}, substr($original_text, 1));
- }
-
- $block_text .= $parts[0]; # Text before current tag.
- $tag = $parts[1]; # Tag to handle.
- $text = $parts[2]; # Remaining text after current tag.
-
- #
- # Check for: Auto-close tag (like <hr/>)
- # Comments and Processing Instructions.
- #
- if (preg_match('{^</?(?:'.$this->auto_close_tags_re.')\b}', $tag) ||
- $tag{1} == '!' || $tag{1} == '?')
- {
- # Just add the tag to the block as if it was text.
- $block_text .= $tag;
- }
- else {
- #
- # Increase/decrease nested tag count. Only do so if
- # the tag's name match base tag's.
- #
- if (preg_match('{^</?'.$base_tag_name_re.'\b}', $tag)) {
- if ($tag{1} == '/') $depth--;
- else if ($tag{strlen($tag)-2} != '/') $depth++;
- }
-
- #
- # Check for `markdown="1"` attribute and handle it.
- #
- if ($md_attr &&
- preg_match($markdown_attr_re, $tag, $attr_m) &&
- preg_match('/^1|block|span$/', $attr_m[2] . $attr_m[3]))
- {
- # Remove `markdown` attribute from opening tag.
- $tag = preg_replace($markdown_attr_re, '', $tag);
-
- # Check if text inside this tag must be parsed in span mode.
- $this->mode = $attr_m[2] . $attr_m[3];
- $span_mode = $this->mode == 'span' || $this->mode != 'block' &&
- preg_match('{^<(?:'.$this->contain_span_tags_re.')\b}', $tag);
-
- # Calculate indent before tag.
- if (preg_match('/(?:^|\n)( *?)(?! ).*?$/', $block_text, $matches)) {
- $strlen = $this->utf8_strlen;
- $indent = $strlen($matches[1], 'UTF-8');
- } else {
- $indent = 0;
- }
-
- # End preceding block with this tag.
- $block_text .= $tag;
- $parsed .= $this->$hash_method($block_text);
-
- # Get enclosing tag name for the ParseMarkdown function.
- # (This pattern makes $tag_name_re safe without quoting.)
- preg_match('/^<([\w:$]*)\b/', $tag, $matches);
- $tag_name_re = $matches[1];
-
- # Parse the content using the HTML-in-Markdown parser.
- list ($block_text, $text)
- = $this->_hashHTMLBlocks_inMarkdown($text, $indent,
- $tag_name_re, $span_mode);
-
- # Outdent markdown text.
- if ($indent > 0) {
- $block_text = preg_replace("/^[ ]{1,$indent}/m", "",
- $block_text);
- }
-
- # Append tag content to parsed text.
- if (!$span_mode) $parsed .= "\n\n$block_text\n\n";
- else $parsed .= "$block_text";
-
- # Start over a new block.
- $block_text = "";
- }
- else $block_text .= $tag;
- }
-
- } while ($depth > 0);
-
- #
- # Hash last block text that wasn't processed inside the loop.
- #
- $parsed .= $this->$hash_method($block_text);
-
- return array($parsed, $text);
- }
-
-
- function hashClean($text) {
- #
- # Called whenever a tag must be hashed when a function insert a "clean" tag
- # in $text, it pass through this function and is automaticaly escaped,
- # blocking invalid nested overlap.
- #
- return $this->hashPart($text, 'C');
- }
-
-
- function doHeaders($text) {
- #
- # Redefined to add id attribute support.
- #
- # Setext-style headers:
- # Header 1 {#header1}
- # ========
- #
- # Header 2 {#header2}
- # --------
- #
- $text = preg_replace_callback(
- '{
- (^.+?) # $1: Header text
- (?:[ ]+\{\#([-_:a-zA-Z0-9]+)\})? # $2: Id attribute
- [ ]*\n(=+|-+)[ ]*\n+ # $3: Header footer
- }mx',
- array(&$this, '_doHeaders_callback_setext'), $text);
-
- # atx-style headers:
- # # Header 1 {#header1}
- # ## Header 2 {#header2}
- # ## Header 2 with closing hashes ## {#header3}
- # ...
- # ###### Header 6 {#header2}
- #
- $text = preg_replace_callback('{
- ^(\#{1,6}) # $1 = string of #\'s
- [ ]*
- (.+?) # $2 = Header text
- [ ]*
- \#* # optional closing #\'s (not counted)
- (?:[ ]+\{\#([-_:a-zA-Z0-9]+)\})? # id attribute
- [ ]*
- \n+
- }xm',
- array(&$this, '_doHeaders_callback_atx'), $text);
-
- return $text;
- }
- function _doHeaders_attr($attr) {
- if (empty($attr)) return "";
- return " id=\"$attr\"";
- }
- function _doHeaders_callback_setext($matches) {
- if ($matches[3] == '-' && preg_match('{^- }', $matches[1]))
- return $matches[0];
- $level = $matches[3]{0} == '=' ? 1 : 2;
- $attr = $this->_doHeaders_attr($id =& $matches[2]);
- $block = "<h$level$attr>".$this->runSpanGamut($matches[1])."</h$level>";
- return "\n" . $this->hashBlock($block) . "\n\n";
- }
- function _doHeaders_callback_atx($matches) {
- $level = strlen($matches[1]);
- $attr = $this->_doHeaders_attr($id =& $matches[3]);
- $block = "<h$level$attr>".$this->runSpanGamut($matches[2])."</h$level>";
- return "\n" . $this->hashBlock($block) . "\n\n";
- }
-
-
- function doTables($text) {
- #
- # Form HTML tables.
- #
- $less_than_tab = $this->tab_width - 1;
- #
- # Find tables with leading pipe.
- #
- # | Header 1 | Header 2
- # | -------- | --------
- # | Cell 1 | Cell 2
- # | Cell 3 | Cell 4
- #
- $text = preg_replace_callback('
- {
- ^ # Start of a line
- [ ]{0,'.$less_than_tab.'} # Allowed whitespace.
- [|] # Optional leading pipe (present)
- (.+) \n # $1: Header row (at least one pipe)
-
- [ ]{0,'.$less_than_tab.'} # Allowed whitespace.
- [|] ([ ]*[-:]+[-| :]*) \n # $2: Header underline
-
- ( # $3: Cells
- (?>
- [ ]* # Allowed whitespace.
- [|] .* \n # Row content.
- )*
- )
- (?=\n|\Z) # Stop at final double newline.
- }xm',
- array(&$this, '_doTable_leadingPipe_callback'), $text);
-
- #
- # Find tables without leading pipe.
- #
- # Header 1 | Header 2
- # -------- | --------
- # Cell 1 | Cell 2
- # Cell 3 | Cell 4
- #
- $text = preg_replace_callback('
- {
- ^ # Start of a line
- [ ]{0,'.$less_than_tab.'} # Allowed whitespace.
- (\S.*[|].*) \n # $1: Header row (at least one pipe)
-
- [ ]{0,'.$less_than_tab.'} # Allowed whitespace.
- ([-:]+[ ]*[|][-| :]*) \n # $2: Header underline
-
- ( # $3: Cells
- (?>
- .* [|] .* \n # Row content
- )*
- )
- (?=\n|\Z) # Stop at final double newline.
- }xm',
- array(&$this, '_DoTable_callback'), $text);
-
- return $text;
- }
- function _doTable_leadingPipe_callback($matches) {
- $head = $matches[1];
- $underline = $matches[2];
- $content = $matches[3];
-
- # Remove leading pipe for each row.
- $content = preg_replace('/^ *[|]/m', '', $content);
-
- return $this->_doTable_callback(array($matches[0], $head, $underline, $content));
- }
- function _doTable_callback($matches) {
- $head = $matches[1];
- $underline = $matches[2];
- $content = $matches[3];
-
- # Remove any tailing pipes for each line.
- $head = preg_replace('/[|] *$/m', '', $head);
- $underline = preg_replace('/[|] *$/m', '', $underline);
- $content = preg_replace('/[|] *$/m', '', $content);
-
- # Reading alignement from header underline.
- $separators = preg_split('/ *[|] */', $underline);
- foreach ($separators as $n => $s) {
- if (preg_match('/^ *-+: *$/', $s)) $attr[$n] = ' align="right"';
- else if (preg_match('/^ *:-+: *$/', $s))$attr[$n] = ' align="center"';
- else if (preg_match('/^ *:-+ *$/', $s)) $attr[$n] = ' align="left"';
- else $attr[$n] = '';
- }
-
- # Parsing span elements, including code spans, character escapes,
- # and inline HTML tags, so that pipes inside those gets ignored.
- $head = $this->parseSpan($head);
- $headers = preg_split('/ *[|] */', $head);
- $col_count = count($headers);
-
- # Write column headers.
- $text = "<table>\n";
- $text .= "<thead>\n";
- $text .= "<tr>\n";
- foreach ($headers as $n => $header)
- $text .= " <th$attr[$n]>".$this->runSpanGamut(trim($header))."</th>\n";
- $text .= "</tr>\n";
- $text .= "</thead>\n";
-
- # Split content by row.
- $rows = explode("\n", trim($content, "\n"));
-
- $text .= "<tbody>\n";
- foreach ($rows as $row) {
- # Parsing span elements, including code spans, character escapes,
- # and inline HTML tags, so that pipes inside those gets ignored.
- $row = $this->parseSpan($row);
-
- # Split row by cell.
- $row_cells = preg_split('/ *[|] */', $row, $col_count);
- $row_cells = array_pad($row_cells, $col_count, '');
-
- $text .= "<tr>\n";
- foreach ($row_cells as $n => $cell)
- $text .= " <td$attr[$n]>".$this->runSpanGamut(trim($cell))."</td>\n";
- $text .= "</tr>\n";
- }
- $text .= "</tbody>\n";
- $text .= "</table>";
-
- return $this->hashBlock($text) . "\n";
- }
-
-
- function doDefLists($text) {
- #
- # Form HTML definition lists.
- #
- $less_than_tab = $this->tab_width - 1;
-
- # Re-usable pattern to match any entire dl list:
- $whole_list_re = '(?>
- ( # $1 = whole list
- ( # $2
- [ ]{0,'.$less_than_tab.'}
- ((?>.*\S.*\n)+) # $3 = defined term
- \n?
- [ ]{0,'.$less_than_tab.'}:[ ]+ # colon starting definition
- )
- (?s:.+?)
- ( # $4
- \z
- |
- \n{2,}
- (?=\S)
- (?! # Negative lookahead for another term
- [ ]{0,'.$less_than_tab.'}
- (?: \S.*\n )+? # defined term
- \n?
- [ ]{0,'.$less_than_tab.'}:[ ]+ # colon starting definition
- )
- (?! # Negative lookahead for another definition
- [ ]{0,'.$less_than_tab.'}:[ ]+ # colon starting definition
- )
- )
- )
- )'; // mx
-
- $text = preg_replace_callback('{
- (?>\A\n?|(?<=\n\n))
- '.$whole_list_re.'
- }mx',
- array(&$this, '_doDefLists_callback'), $text);
-
- return $text;
- }
- function _doDefLists_callback($matches) {
- # Re-usable patterns to match list item bullets and number markers:
- $list = $matches[1];
-
- # Turn double returns into triple returns, so that we can make a
- # paragraph for the last item in a list, if necessary:
- $result = trim($this->processDefListItems($list));
- $result = "<dl>\n" . $result . "\n</dl>";
- return $this->hashBlock($result) . "\n\n";
- }
-
-
- function processDefListItems($list_str) {
- #
- # Process the contents of a single definition list, splitting it
- # into individual term and definition list items.
- #
- $less_than_tab = $this->tab_width - 1;
-
- # trim trailing blank lines:
- $list_str = preg_replace("/\n{2,}\\z/", "\n", $list_str);
-
- # Process definition terms.
- $list_str = preg_replace_callback('{
- (?>\A\n?|\n\n+) # leading line
- ( # definition terms = $1
- [ ]{0,'.$less_than_tab.'} # leading whitespace
- (?![:][ ]|[ ]) # negative lookahead for a definition
- # mark (colon) or more whitespace.
- (?> \S.* \n)+? # actual term (not whitespace).
- )
- (?=\n?[ ]{0,3}:[ ]) # lookahead for following line feed
- # with a definition mark.
- }xm',
- array(&$this, '_processDefListItems_callback_dt'), $list_str);
-
- # Process actual definitions.
- $list_str = preg_replace_callback('{
- \n(\n+)? # leading line = $1
- ( # marker space = $2
- [ ]{0,'.$less_than_tab.'} # whitespace before colon
- [:][ ]+ # definition mark (colon)
- )
- ((?s:.+?)) # definition text = $3
- (?= \n+ # stop at next definition mark,
- (?: # next term or end of text
- [ ]{0,'.$less_than_tab.'} [:][ ] |
- <dt> | \z
- )
- )
- }xm',
- array(&$this, '_processDefListItems_callback_dd'), $list_str);
-
- return $list_str;
- }
- function _processDefListItems_callback_dt($matches) {
- $terms = explode("\n", trim($matches[1]));
- $text = '';
- foreach ($terms as $term) {
- $term = $this->runSpanGamut(trim($term));
- $text .= "\n<dt>" . $term . "</dt>";
- }
- return $text . "\n";
- }
- function _processDefListItems_callback_dd($matches) {
- $leading_line = $matches[1];
- $marker_space = $matches[2];
- $def = $matches[3];
-
- if ($leading_line || preg_match('/\n{2,}/', $def)) {
- # Replace marker with the appropriate whitespace indentation
- $def = str_repeat(' ', strlen($marker_space)) . $def;
- $def = $this->runBlockGamut($this->outdent($def . "\n\n"));
- $def = "\n". $def ."\n";
- }
- else {
- $def = rtrim($def);
- $def = $this->runSpanGamut($this->outdent($def));
- }
-
- return "\n<dd>" . $def . "</dd>\n";
- }
-
-
- function doFencedCodeBlocks($text) {
- #
- # Adding the fenced code block syntax to regular Markdown:
- #
- # ~~~
- # Code block
- # ~~~
- #
- $less_than_tab = $this->tab_width;
-
- $text = preg_replace_callback('{
- (?:\n|\A)
- # 1: Opening marker
- (
- ~{3,} # Marker: three tilde or more.
- )
- [ ]* \n # Whitespace and newline following marker.
-
- # 2: Content
- (
- (?>
- (?!\1 [ ]* \n) # Not a closing marker.
- .*\n+
- )+
- )
-
- # Closing marker.
- \1 [ ]* \n
- }xm',
- array(&$this, '_doFencedCodeBlocks_callback'), $text);
-
- return $text;
- }
- function _doFencedCodeBlocks_callback($matches) {
- $codeblock = $matches[2];
- $codeblock = htmlspecialchars($codeblock, ENT_NOQUOTES);
- $codeblock = preg_replace_callback('/^\n+/',
- array(&$this, '_doFencedCodeBlocks_newlines'), $codeblock);
- $codeblock = "<pre><code>$codeblock</code></pre>";
- return "\n\n".$this->hashBlock($codeblock)."\n\n";
- }
- function _doFencedCodeBlocks_newlines($matches) {
- return str_repeat("<br$this->empty_element_suffix",
- strlen($matches[0]));
- }
-
-
- #
- # Redefining emphasis markers so that emphasis by underscore does not
- # work in the middle of a word.
- #
- var $em_relist = array(
- '' => '(?:(?<!\*)\*(?!\*)|(?<![a-zA-Z0-9_])_(?!_))(?=\S|$)(?![\.,:;]\s)',
- '*' => '(?<=\S|^)(?<!\*)\*(?!\*)',
- '_' => '(?<=\S|^)(?<!_)_(?![a-zA-Z0-9_])',
- );
- var $strong_relist = array(
- '' => '(?:(?<!\*)\*\*(?!\*)|(?<![a-zA-Z0-9_])__(?!_))(?=\S|$)(?![\.,:;]\s)',
- '**' => '(?<=\S|^)(?<!\*)\*\*(?!\*)',
- '__' => '(?<=\S|^)(?<!_)__(?![a-zA-Z0-9_])',
- );
- var $em_strong_relist = array(
- '' => '(?:(?<!\*)\*\*\*(?!\*)|(?<![a-zA-Z0-9_])___(?!_))(?=\S|$)(?![\.,:;]\s)',
- '***' => '(?<=\S|^)(?<!\*)\*\*\*(?!\*)',
- '___' => '(?<=\S|^)(?<!_)___(?![a-zA-Z0-9_])',
- );
-
-
- function formParagraphs($text) {
- #
- # Params:
- # $text - string to process with html <p> tags
- #
- # Strip leading and trailing lines:
- $text = preg_replace('/\A\n+|\n+\z/', '', $text);
-
- $grafs = preg_split('/\n{2,}/', $text, -1, PREG_SPLIT_NO_EMPTY);
-
- #
- # Wrap <p> tags and unhashify HTML blocks
- #
- foreach ($grafs as $key => $value) {
- $value = trim($this->runSpanGamut($value));
-
- # Check if this should be enclosed in a paragraph.
- # Clean tag hashes & block tag hashes are left alone.
- $is_p = !preg_match('/^B\x1A[0-9]+B|^C\x1A[0-9]+C$/', $value);
-
- if ($is_p) {
- $value = "<p>$value</p>";
- }
- $grafs[$key] = $value;
- }
-
- # Join grafs in one text, then unhash HTML tags.
- $text = implode("\n\n", $grafs);
-
- # Finish by removing any tag hashes still present in $text.
- $text = $this->unhash($text);
-
- return $text;
- }
-
-
- ### Footnotes
-
- function stripFootnotes($text) {
- #
- # Strips link definitions from text, stores the URLs and titles in
- # hash references.
- #
- $less_than_tab = $this->tab_width - 1;
-
- # Link defs are in the form: [^id]: url "optional title"
- $text = preg_replace_callback('{
- ^[ ]{0,'.$less_than_tab.'}\[\^(.+?)\][ ]?: # note_id = $1
- [ ]*
- \n? # maybe *one* newline
- ( # text = $2 (no blank lines allowed)
- (?:
- .+ # actual text
- |
- \n # newlines but
- (?!\[\^.+?\]:\s)# negative lookahead for footnote marker.
- (?!\n+[ ]{0,3}\S)# ensure line is not blank and followed
- # by non-indented content
- )*
- )
- }xm',
- array(&$this, '_stripFootnotes_callback'),
- $text);
- return $text;
- }
- function _stripFootnotes_callback($matches) {
- $note_id = $this->fn_id_prefix . $matches[1];
- $this->footnotes[$note_id] = $this->outdent($matches[2]);
- return ''; # String that will replace the block
- }
-
-
- function doFootnotes($text) {
- #
- # Replace footnote references in $text [^id] with a special text-token
- # which will be replaced by the actual footnote marker in appendFootnotes.
- #
- if (!$this->in_anchor) {
- $text = preg_replace('{\[\^(.+?)\]}', "F\x1Afn:\\1\x1A:", $text);
- }
- return $text;
- }
-
-
- function appendFootnotes($text) {
- #
- # Append footnote list to text.
- #
- $text = preg_replace_callback('{F\x1Afn:(.*?)\x1A:}',
- array(&$this, '_appendFootnotes_callback'), $text);
-
- if (!empty($this->footnotes_ordered)) {
- $text .= "\n\n";
- $text .= "<div class=\"footnotes\">\n";
- $text .= "<hr". $this->empty_element_suffix ."\n";
- $text .= "<ol>\n\n";
-
- $attr = " rev=\"footnote\"";
- if ($this->fn_backlink_class != "") {
- $class = $this->fn_backlink_class;
- $class = $this->encodeAttribute($class);
- $attr .= " class=\"$class\"";
- }
- if ($this->fn_backlink_title != "") {
- $title = $this->fn_backlink_title;
- $title = $this->encodeAttribute($title);
- $attr .= " title=\"$title\"";
- }
- $num = 0;
-
- while (!empty($this->footnotes_ordered)) {
- $footnote = reset($this->footnotes_ordered);
- $note_id = key($this->footnotes_ordered);
- unset($this->footnotes_ordered[$note_id]);
-
- $footnote .= "\n"; # Need to append newline before parsing.
- $footnote = $this->runBlockGamut("$footnote\n");
- $footnote = preg_replace_callback('{F\x1Afn:(.*?)\x1A:}',
- array(&$this, '_appendFootnotes_callback'), $footnote);
-
- $attr = str_replace("%%", ++$num, $attr);
- $note_id = $this->encodeAttribute($note_id);
-
- # Add backlink to last paragraph; create new paragraph if needed.
- $backlink = "<a href=\"#fnref:$note_id\"$attr>↩</a>";
- if (preg_match('{</p>$}', $footnote)) {
- $footnote = substr($footnote, 0, -4) . " $backlink</p>";
- } else {
- $footnote .= "\n\n<p>$backlink</p>";
- }
-
- $text .= "<li id=\"fn:$note_id\">\n";
- $text .= $footnote . "\n";
- $text .= "</li>\n\n";
- }
-
- $text .= "</ol>\n";
- $text .= "</div>";
- }
- return $text;
- }
- function _appendFootnotes_callback($matches) {
- $node_id = $this->fn_id_prefix . $matches[1];
-
- # Create footnote marker only if it has a corresponding footnote *and*
- # the footnote hasn't been used by another marker.
- if (isset($this->footnotes[$node_id])) {
- # Transfert footnote content to the ordered list.
- $this->footnotes_ordered[$node_id] = $this->footnotes[$node_id];
- unset($this->footnotes[$node_id]);
-
- $num = $this->footnote_counter++;
- $attr = " rel=\"footnote\"";
- if ($this->fn_link_class != "") {
- $class = $this->fn_link_class;
- $class = $this->encodeAttribute($class);
- $attr .= " class=\"$class\"";
- }
- if ($this->fn_link_title != "") {
- $title = $this->fn_link_title;
- $title = $this->encodeAttribute($title);
- $attr .= " title=\"$title\"";
- }
-
- $attr = str_replace("%%", $num, $attr);
- $node_id = $this->encodeAttribute($node_id);
-
- return
- "<sup id=\"fnref:$node_id\">".
- "<a href=\"#fn:$node_id\"$attr>$num</a>".
- "</sup>";
- }
-
- return "[^".$matches[1]."]";
- }
-
-
- ### Abbreviations ###
-
- function stripAbbreviations($text) {
- #
- # Strips abbreviations from text, stores titles in hash references.
- #
- $less_than_tab = $this->tab_width - 1;
-
- # Link defs are in the form: [id]*: url "optional title"
- $text = preg_replace_callback('{
- ^[ ]{0,'.$less_than_tab.'}\*\[(.+?)\][ ]?: # abbr_id = $1
- (.*) # text = $2 (no blank lines allowed)
- }xm',
- array(&$this, '_stripAbbreviations_callback'),
- $text);
- return $text;
- }
- function _stripAbbreviations_callback($matches) {
- $abbr_word = $matches[1];
- $abbr_desc = $matches[2];
- if ($this->abbr_word_re)
- $this->abbr_word_re .= '|';
- $this->abbr_word_re .= preg_quote($abbr_word);
- $this->abbr_desciptions[$abbr_word] = trim($abbr_desc);
- return ''; # String that will replace the block
- }
-
-
- function doAbbreviations($text) {
- #
- # Find defined abbreviations in text and wrap them in <abbr> elements.
- #
- if ($this->abbr_word_re) {
- // cannot use the /x modifier because abbr_word_re may
- // contain significant spaces:
- $text = preg_replace_callback('{'.
- '(?<![\w\x1A])'.
- '(?:'.$this->abbr_word_re.')'.
- '(?![\w\x1A])'.
- '}',
- array(&$this, '_doAbbreviations_callback'), $text);
- }
- return $text;
- }
- function _doAbbreviations_callback($matches) {
- $abbr = $matches[0];
- if (isset($this->abbr_desciptions[$abbr])) {
- $desc = $this->abbr_desciptions[$abbr];
- if (empty($desc)) {
- return $this->hashPart("<abbr>$abbr</abbr>");
- } else {
- $desc = $this->encodeAttribute($desc);
- return $this->hashPart("<abbr title=\"$desc\">$abbr</abbr>");
- }
- } else {
- return $matches[0];
- }
- }
-
-}
-
-
-/*
-
-PHP Markdown Extra
-==================
-
-Description
------------
-
-This is a PHP port of the original Markdown formatter written in Perl
-by John Gruber. This special "Extra" version of PHP Markdown features
-further enhancements to the syntax for making additional constructs
-such as tables and definition list.
-
-Markdown is a text-to-HTML filter; it translates an easy-to-read /
-easy-to-write structured text format into HTML. Markdown's text format
-is most similar to that of plain text email, and supports features such
-as headers, *emphasis*, code blocks, blockquotes, and links.
-
-Markdown's syntax is designed not as a generic markup language, but
-specifically to serve as a front-end to (X)HTML. You can use span-level
-HTML tags anywhere in a Markdown document, and you can use block level
-HTML tags (like <div> and <table> as well).
-
-For more information about Markdown's syntax, see:
-
-<http://daringfireball.net/projects/markdown/>
-
-
-Bugs
-----
-
-To file bug reports please send email to:
-
-<mi...@michelf.com>
-
-Please include with your report: (1) the example input; (2) the output you
-expected; (3) the output Markdown actually produced.
-
-
-Version History
----------------
-
-See the readme file for detailed release notes for this version.
-
-
-Copyright and License
----------------------
-
-PHP Markdown & Extra
-Copyright (c) 2004-2009 Michel Fortin
-<http://michelf.com/>
-All rights reserved.
-
-Based on Markdown
-Copyright (c) 2003-2006 John Gruber
-<http://daringfireball.net/>
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-* Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-* Neither the name "Markdown" nor the names of its contributors may
- be used to endorse or promote products derived from this software
- without specific prior written permission.
-
-This software is provided by the copyright holders and contributors "as
-is" and any express or implied warranties, including, but not limited
-to, the implied warranties of merchantability and fitness for a
-particular purpose are disclaimed. In no event shall the copyright owner
-or contributors be liable for any direct, indirect, incidental, special,
-exemplary, or consequential damages (including, but not limited to,
-procurement of substitute goods or services; loss of use, data, or
-profits; or business interruption) however caused and on any theory of
-liability, whether in contract, strict liability, or tort (including
-negligence or otherwise) arising in any way out of the use of this
-software, even if advised of the possibility of such damage.
-
-*/
-?>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/schemas/schema.pdo.mysql
----------------------------------------------------------------------
diff --git a/balance/modules/puny/schemas/schema.pdo.mysql b/balance/modules/puny/schemas/schema.pdo.mysql
deleted file mode 100644
index e53d30d..0000000
--- a/balance/modules/puny/schemas/schema.pdo.mysql
+++ /dev/null
@@ -1,26 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to You under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
---
--- Table structure for table `puny_resource`
---
-
-CREATE TABLE IF NOT EXISTS `puny_resource` (
- `resourceId` varchar(60) NOT NULL,
- `version` int(10) unsigned NOT NULL,
- `parser` varchar(60) NOT NULL,
- `content` text NOT NULL,
- PRIMARY KEY (`resourceId`,`version`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Puny content resources';
[14/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/test/java/org/apache/oodt/profile/ResourceAttributesTest.java
----------------------------------------------------------------------
diff --git a/profile/src/test/java/org/apache/oodt/profile/ResourceAttributesTest.java b/profile/src/test/java/org/apache/oodt/profile/ResourceAttributesTest.java
deleted file mode 100644
index b69bd37..0000000
--- a/profile/src/test/java/org/apache/oodt/profile/ResourceAttributesTest.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import org.apache.oodt.commons.io.NullOutputStream;
-import org.apache.oodt.commons.util.XML;
-import junit.framework.TestCase;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * Unit test the {@link ResourceAttributes} class.
- *
- * @author Kelly
- */
-public class ResourceAttributesTest extends TestCase {
- /** Construct the test case for the {@link ResourceAttributes} class. */
- public ResourceAttributesTest(String name) {
- super(name);
- }
-
- public void testNoArgsCtor() {
- ResourceAttributes blank = new ResourceAttributes();
- assertEquals("UNKNOWN", blank.getIdentifier());
- assertEquals(0, blank.getFormats().size());
- assertEquals(0, blank.getCreators().size());
- assertEquals(0, blank.getSubjects().size());
- assertEquals(0, blank.getPublishers().size());
- assertEquals(0, blank.getContributors().size());
- assertEquals(0, blank.getDates().size());
- assertEquals(0, blank.getTypes().size());
- assertEquals(0, blank.getSources().size());
- assertEquals(0, blank.getLanguages().size());
- assertEquals(0, blank.getRelations().size());
- assertEquals(0, blank.getCoverages().size());
- assertEquals(0, blank.getRights().size());
- assertEquals(0, blank.getResContexts().size());
- assertEquals(0, blank.getResLocations().size());
- }
-
- public void testObjectMethods() {
- List contexts = new ArrayList();
- contexts.add("context");
- ResourceAttributes r1 = new ResourceAttributes(null, "1", "title", Collections.EMPTY_LIST, "desc",
- Collections.EMPTY_LIST, Collections.EMPTY_LIST, Collections.EMPTY_LIST,
- Collections.EMPTY_LIST, Collections.EMPTY_LIST, Collections.EMPTY_LIST, Collections.EMPTY_LIST,
- Collections.EMPTY_LIST, Collections.EMPTY_LIST, Collections.EMPTY_LIST, Collections.EMPTY_LIST,
- contexts, "aggregation", "class", Collections.EMPTY_LIST);
- ResourceAttributes r2 = new ResourceAttributes(null, "1", "title", Collections.EMPTY_LIST, "desc",
- Collections.EMPTY_LIST, Collections.EMPTY_LIST, Collections.EMPTY_LIST,
- Collections.EMPTY_LIST, Collections.EMPTY_LIST, Collections.EMPTY_LIST, Collections.EMPTY_LIST,
- Collections.EMPTY_LIST, Collections.EMPTY_LIST, Collections.EMPTY_LIST, Collections.EMPTY_LIST,
- contexts, "aggregation", "class", Collections.EMPTY_LIST);
- ResourceAttributes r3 = new ResourceAttributes(null, "2", "title2", Collections.EMPTY_LIST, "desc2",
- Collections.EMPTY_LIST, Collections.EMPTY_LIST, Collections.EMPTY_LIST,
- Collections.EMPTY_LIST, Collections.EMPTY_LIST, Collections.EMPTY_LIST, Collections.EMPTY_LIST,
- Collections.EMPTY_LIST, Collections.EMPTY_LIST, Collections.EMPTY_LIST, Collections.EMPTY_LIST,
- contexts, "aggregation2", "class2", Collections.EMPTY_LIST);
- assertEquals(r1, r1);
- assertEquals(r1, r2);
- assertTrue(!r1.equals(r3));
- ResourceAttributes r4 = (ResourceAttributes) r3.clone();
- assertEquals(r3, r4);
- assertTrue(r3 != r4);
- }
-
- public void testSetters() {
- ResourceAttributes q = (ResourceAttributes) TEST_RESOURCE_ATTRIBUTES.clone();
-
- assertEquals("identifier", q.getIdentifier());
- q.setIdentifier("newIdentifier");
- assertEquals("newIdentifier", q.getIdentifier());
-
- assertEquals("aggregation", q.getResAggregation());
- q.setResAggregation("newAggergation");
- assertEquals("newAggergation", q.getResAggregation());
-
- assertEquals("class", q.getResClass());
- q.setResClass("newClass");
- assertEquals("newClass", q.getResClass());
- }
-
- public void testXML() throws Exception {
- Document doc = XML.createDocument();
- Node root = TEST_RESOURCE_ATTRIBUTES.toXML(doc);
- assertEquals("resAttributes", root.getNodeName());
- NodeList children = root.getChildNodes();
- for (int i = 0; i < children.getLength(); ++i) {
- Node child = children.item(i);
- String name = child.getNodeName();
- if ("Identifier".equals(name)) {
- assertEquals("identifier", XML.text(child));
- } else if ("Title".equals(name)) {
- assertEquals("title", XML.text(child));
- } else if ("Format".equals(name)) {
- // ignore
- } else if ("Description".equals(name)) {
- assertEquals("desc", XML.text(child));
- } else if ("Creator".equals(name)) {
- // ignore
- } else if ("Subject".equals(name)) {
- // ignore
- } else if ("Publisher".equals(name)) {
- // ignore
- } else if ("Contributor".equals(name)) {
- // ignore
- } else if ("Date".equals(name)) {
- // ignore
- } else if ("Type".equals(name)) {
- // ignore
- } else if ("Source".equals(name)) {
- // ignore
- } else if ("Language".equals(name)) {
- // ignore
- } else if ("Coverage".equals(name)) {
- // ignore
- } else if ("Rights".equals(name)) {
- // ignore
- } else if ("resContext".equals(name)) {
- assertEquals("context", XML.text(child));
- } else if ("resAggregation".equals(name)) {
- assertEquals("aggregation", XML.text(child));
- } else if ("resClass".equals(name)) {
- assertEquals("class", XML.text(child));
- } else if ("resLocation".equals(name)) {
- // ignore
- } else fail("Unknown node \"" + name + "\" in XML result");
- }
- ResourceAttributes q = new ResourceAttributes(null, root);
- assertEquals(TEST_RESOURCE_ATTRIBUTES, q);
- }
-
- public void testXMLSerialization() throws Exception {
- Profile p = new Profile();
- ResourceAttributes ra = new ResourceAttributes(p);
- Document doc = XML.createDocument();
- Node root = ra.toXML(doc);
- TransformerFactory tf = TransformerFactory.newInstance();
- Transformer t = tf.newTransformer();
- DOMSource s = new DOMSource(root);
- StreamResult r = new StreamResult(new NullOutputStream());
- t.transform(s, r);
- }
-
- static ResourceAttributes TEST_RESOURCE_ATTRIBUTES; static {
- List contexts = Collections.singletonList("context");
- List locations = Collections.singletonList("location");
- TEST_RESOURCE_ATTRIBUTES = new ResourceAttributes(null, "identifier", "title",
- Collections.EMPTY_LIST, "desc", Collections.EMPTY_LIST, Collections.EMPTY_LIST,
- Collections.EMPTY_LIST, Collections.EMPTY_LIST, Collections.EMPTY_LIST, Collections.EMPTY_LIST,
- Collections.EMPTY_LIST, Collections.EMPTY_LIST, Collections.EMPTY_LIST, Collections.EMPTY_LIST,
- Collections.EMPTY_LIST, contexts, "aggregation", "class", locations);
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/test/java/org/apache/oodt/profile/handlers/lightweight/LightweightProfileServerTest.java
----------------------------------------------------------------------
diff --git a/profile/src/test/java/org/apache/oodt/profile/handlers/lightweight/LightweightProfileServerTest.java b/profile/src/test/java/org/apache/oodt/profile/handlers/lightweight/LightweightProfileServerTest.java
deleted file mode 100644
index d8373ee..0000000
--- a/profile/src/test/java/org/apache/oodt/profile/handlers/lightweight/LightweightProfileServerTest.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile.handlers.lightweight;
-
-import org.apache.oodt.profile.ProfileElement;
-import org.apache.oodt.profile.ProfileException;
-import org.apache.oodt.xmlquery.XMLQuery;
-
-import java.net.URI;
-import java.util.List;
-import java.util.Map;
-
-import junit.framework.TestCase;
-
-/**
- * Unit test the LightweightProfileServer class.
- *
- * @author Kelly
- */
-public class LightweightProfileServerTest extends TestCase {
- /** Construct the test case for the LightweightProfileServer class. */
- public LightweightProfileServerTest(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- URI uri = getClass().getResource("lightweightTest.xml").toURI();
- server = new LightweightProfileServer(uri, "testing");
- }
-
- /**
- * Test the getID method.
- */
- public void testGetID() {
- assertEquals("testing", server.getID());
- }
-
- /**
- * Test the searching methods.
- */
- public void testSearching() {
- try {
- List profiles;
-
- // Try a positive search.
- profiles = doSearch("TEST > 2 AND TEST < 30");
- assertEquals(1, profiles.size());
- SearchableProfile profile = (SearchableProfile) profiles.get(0);
- assertEquals("PROFILE1", profile.getProfileAttributes().getID());
- Map elements = profile.getProfileElements();
- assertEquals(3, elements.size());
- ProfileElement element = (ProfileElement) elements.get("TEST");
- assertNotNull(element);
- assertEquals("3.14159", element.getID());
-
- // Now a negative one.
- profiles = doSearch("NONEXISTENT = 452712917824812123125100884");
- assertEquals(0, profiles.size());
-
- // Now one that has multiple elements from one profile
- profiles = doSearch("TEST <= 14 AND TEST2 >= 10");
- assertEquals(1, profiles.size());
- profile = (SearchableProfile) profiles.get(0);
- assertEquals("PROFILE1", profile.getProfileAttributes().getID());
- elements = profile.getProfileElements();
- assertEquals(3, elements.size());
- assertTrue(elements.containsKey("TEST"));
- assertTrue(elements.containsKey("TEST2"));
-
- // And again, but with OR instead of AND
- profiles = doSearch("TEST <= 14 OR TEST2 >= 10");
- assertEquals(1, profiles.size());
- profile = (SearchableProfile) profiles.get(0);
- assertEquals("PROFILE1", profile.getProfileAttributes().getID());
- elements = profile.getProfileElements();
- assertEquals(3, elements.size());
- assertTrue(elements.containsKey("TEST"));
- assertTrue(elements.containsKey("TEST2"));
-
- // And again, but with one of the elements being not found
- profiles = doSearch("NONEXISTENT = 123456789 OR TEST2 <= 1000000");
- assertEquals(1, profiles.size());
- profile = (SearchableProfile) profiles.get(0);
- assertEquals("PROFILE1", profile.getProfileAttributes().getID());
- elements = profile.getProfileElements();
- assertEquals(3, elements.size());
- assertTrue(elements.containsKey("TEST2"));
-
- // And again, but spanning profiles
- profiles = doSearch("TEST2 = 48 OR TEST4 = 192");
- assertEquals(2, profiles.size());
- for (Object profile1 : profiles) {
- profile = (SearchableProfile) profile1;
- elements = profile.getProfileElements();
- assertEquals(3, elements.size());
- if (profile.getProfileAttributes().getID().equals("PROFILE1")) {
- assertTrue(elements.containsKey("TEST2"));
- } else if (profile.getProfileAttributes().getID().equals("PROFILE2")) {
- assertTrue(elements.containsKey("TEST4"));
- } else {
- fail("Profile \"" + profile.getProfileAttributes().getID() + "\" matched, but shouldn't");
- }
- }
-
- // And again, but with a query on the "from" part.
- profiles = doSearch("( TEST2 = 48 OR TEST4 = 192 ) AND Creator = Alice");
- assertEquals(1, profiles.size());
- profile = (SearchableProfile) profiles.get(0);
- assertEquals("PROFILE1", profile.getProfileAttributes().getID());
-
- // And again, but on a nonenumerated element with no min/max values.
- profiles = doSearch("TEST5 = GEEBA");
- assertEquals(1, profiles.size());
- profile = (SearchableProfile) profiles.get(0);
- assertEquals("PROFILE2", profile.getProfileAttributes().getID());
-
- // And again, but with "RETURN =" parts.
- //fail("Not yet implemented");
-
- } catch (ProfileException ex) {
- fail("Profile server failed with excepton: " + ex.getMessage());
- }
- }
-
- /**
- * Execute the given search.
- *
- * @param expr The search experssion.
- * @return List of matching profiles.
- * @throws ProfileException If the profile server fails.
- */
- private List doSearch(String expr) throws ProfileException {
- XMLQuery query = new XMLQuery(expr, "test1", "LightweightProfileServerTest",
- "This query is to test the LightweightProfileServer", /*ddId*/null, /*resultModeId*/null,
- /*propType*/null, /*propLevels*/null, XMLQuery.DEFAULT_MAX_RESULTS);
- return server.findProfiles(query);
- }
-
-
- /** The lightweight profile server being tested. */
- private LightweightProfileServer server;
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/test/resources/org/apache/oodt/profile/handlers/lightweight/lightweightTest.xml
----------------------------------------------------------------------
diff --git a/profile/src/test/resources/org/apache/oodt/profile/handlers/lightweight/lightweightTest.xml b/profile/src/test/resources/org/apache/oodt/profile/handlers/lightweight/lightweightTest.xml
deleted file mode 100644
index c7ffb63..0000000
--- a/profile/src/test/resources/org/apache/oodt/profile/handlers/lightweight/lightweightTest.xml
+++ /dev/null
@@ -1,119 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-http://www.apache.org/licenses/LICENSE-2.0
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-<!DOCTYPE profiles PUBLIC "-//JPL//DTD EDA Profile 1.1//EN" "http://oodt.jpl.nasa.gov/grid-profile/dtd/prof.dtd">
-<profiles>
- <profile>
- <profAttributes>
- <profId>PROFILE1</profId>
- <profType>profile</profType>
- <profStatusId>active</profStatusId>
- <profSecurityType>NULL</profSecurityType>
- <profRevisionNote>1.0</profRevisionNote>
- </profAttributes>
- <resAttributes>
- <Identifier>TEST_PROFILE_1</Identifier>
- <Title>Test profile number 1</Title>
- <Format>text/html</Format>
- <Creator>Alice</Creator>
- <resContext>TEST</resContext>
- <resAggregation>N/A</resAggregation>
- <resClass>system.profileServer</resClass>
- <resLocation>iiop://oodt.jpl.nasa.gov:10000/Test.Profile</resLocation>
- </resAttributes>
- <profElement>
- <elemId>3.14159</elemId>
- <elemName>TEST</elemName>
- <elemDesc>This is a test element</elemDesc>
- <elemType>Testing</elemType>
- <elemUnit>fortnights-per-furlong</elemUnit>
- <elemEnumFlag>F</elemEnumFlag>
- <elemMinValue>0</elemMinValue>
- <elemMaxValue>32</elemMaxValue>
- <elemComment>Testing only.</elemComment>
- </profElement>
- <profElement>
- <elemId>3.2</elemId>
- <elemName>TEST2</elemName>
- <elemDesc>This is another test element</elemDesc>
- <elemType>Testing</elemType>
- <elemUnit>fleas-per-tick</elemUnit>
- <elemEnumFlag>F</elemEnumFlag>
- <elemMinValue>32</elemMinValue>
- <elemMaxValue>64</elemMaxValue>
- <elemComment>More testing.</elemComment>
- </profElement>
- <profElement>
- <elemId>3.5</elemId>
- <elemName>TEST3</elemName>
- <elemDesc>Yet another test element</elemDesc>
- <elemType>Testing</elemType>
- <elemEnumFlag>T</elemEnumFlag>
- <elemValue>alpha</elemValue>
- <elemValue>beta</elemValue>
- <elemValue>gamma</elemValue>
- <elemValue>delta</elemValue>
- <elemComment>A bunch of greek letters, eh?</elemComment>
- </profElement>
- </profile>
-
- <profile>
- <profAttributes>
- <profId>PROFILE2</profId>
- <profType>profile</profType>
- <profStatusId>active</profStatusId>
- <profSecurityType>NULL</profSecurityType>
- <profRevisionNote>1.0</profRevisionNote>
- </profAttributes>
- <resAttributes>
- <Identifier>TEST_PROFILE_2</Identifier>
- <Title>Test profile number 2</Title>
- <Format>text/html</Format>
- <Creator>Bill</Creator>
- <resContext>TEST</resContext>
- <resAggregation>N/A</resAggregation>
- <resClass>system.profileServer</resClass>
- <resLocation>iiop://oodt.jpl.nasa.gov:10000/Test.Profile</resLocation>
- </resAttributes>
- <profElement>
- <elemId>3.5</elemId>
- <elemName>TEST3</elemName>
- <elemDesc>Yet another test element</elemDesc>
- <elemType>Testing</elemType>
- <elemEnumFlag>T</elemEnumFlag>
- <elemValue>alpha</elemValue>
- <elemValue>beta</elemValue>
- <elemValue>gamma</elemValue>
- <elemValue>delta</elemValue>
- <elemComment>A bunch of greek letters, eh?</elemComment>
- </profElement>
- <profElement>
- <elemId>3.6</elemId>
- <elemName>TEST4</elemName>
- <elemDesc>And still another test element</elemDesc>
- <elemType>Testing</elemType>
- <elemEnumFlag>F</elemEnumFlag>
- <elemMinValue>128</elemMinValue>
- <elemMaxValue>256</elemMaxValue>
- </profElement>
- <profElement>
- <elemId>3.7</elemId>
- <elemName>TEST5</elemName>
- <elemDesc>This is a nonenumerated field with no min/max values, meaning it should always match.</elemDesc>
- <elemType>char</elemType>
- <elemEnumFlag>F</elemEnumFlag>
- </profElement>
- </profile>
-</profiles>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/test/resources/org/apache/oodt/profile/test.xml
----------------------------------------------------------------------
diff --git a/profile/src/test/resources/org/apache/oodt/profile/test.xml b/profile/src/test/resources/org/apache/oodt/profile/test.xml
deleted file mode 100644
index 8e38c82..0000000
--- a/profile/src/test/resources/org/apache/oodt/profile/test.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-<!-- DO NOT put the XML processing instruction or DOCTYPE decl in this -->
-<!-- file! They're added by the unit test automatically. -->
-<!-- $Id: test.xml,v 1.1.1.1 2004/03/02 20:53:39 kelly Exp $ -->
-<!--
-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.
--->
-<profile>
- <profAttributes>
- <profId>OODT_PDS_PROFILE_SERVER</profId>
- <profType>profile</profType>
- <profStatusId>active</profStatusId>
- <profSecurityType>NULL</profSecurityType>
- <profRevisionNote>1999-09-30</profRevisionNote>
- </profAttributes>
- <resAttributes>
- <Identifier>PDS_PROFILE_SERVER</Identifier>
- <Title>Planetary Data System (PDS) - Profile Server V1.0</Title>
- <Format>text/html</Format>
- <resContext>PDS</resContext>
- <resAggregation>N/A</resAggregation>
- <resClass>system.profileServer</resClass>
- <resLocation>iiop://oodt.jpl.nasa.gov:10000/JPL.PDS.PROFILE</resLocation>
- </resAttributes>
- <profElement>
- <elemId>3.14159</elemId>
- <elemName>TEST</elemName>
- <elemDesc>This is a test element</elemDesc>
- <elemType>Testing</elemType>
- <elemUnit>fortnights-per-furlong</elemUnit>
- <elemEnumFlag>F</elemEnumFlag>
- <elemMinValue>0</elemMinValue>
- <elemMaxValue>32</elemMaxValue>
- <elemComment>Testing only.</elemComment>
- </profElement>
- <profElement>
- <elemId>3.2</elemId>
- <elemName>TEST2</elemName>
- <elemDesc>This is another test element</elemDesc>
- <elemType>Testing</elemType>
- <elemUnit>fleas-per-tick</elemUnit>
- <elemEnumFlag>F</elemEnumFlag>
- <elemMinValue>32</elemMinValue>
- <elemMaxValue>64</elemMaxValue>
- <elemComment>More testing.</elemComment>
- </profElement>
- <profElement>
- <elemId>3.5</elemId>
- <elemName>TEST3</elemName>
- <elemDesc>Yet another test element</elemDesc>
- <elemType>Testing</elemType>
- <elemEnumFlag>T</elemEnumFlag>
- <elemValue>alpha</elemValue>
- <elemValue>beta</elemValue>
- <elemValue>gamma</elemValue>
- <elemValue>delta</elemValue>
- <elemComment>A bunch of greek letters, eh?</elemComment>
- </profElement>
-</profile>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/test/resources/test.xml
----------------------------------------------------------------------
diff --git a/profile/src/test/resources/test.xml b/profile/src/test/resources/test.xml
deleted file mode 100644
index 8e38c82..0000000
--- a/profile/src/test/resources/test.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-<!-- DO NOT put the XML processing instruction or DOCTYPE decl in this -->
-<!-- file! They're added by the unit test automatically. -->
-<!-- $Id: test.xml,v 1.1.1.1 2004/03/02 20:53:39 kelly Exp $ -->
-<!--
-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.
--->
-<profile>
- <profAttributes>
- <profId>OODT_PDS_PROFILE_SERVER</profId>
- <profType>profile</profType>
- <profStatusId>active</profStatusId>
- <profSecurityType>NULL</profSecurityType>
- <profRevisionNote>1999-09-30</profRevisionNote>
- </profAttributes>
- <resAttributes>
- <Identifier>PDS_PROFILE_SERVER</Identifier>
- <Title>Planetary Data System (PDS) - Profile Server V1.0</Title>
- <Format>text/html</Format>
- <resContext>PDS</resContext>
- <resAggregation>N/A</resAggregation>
- <resClass>system.profileServer</resClass>
- <resLocation>iiop://oodt.jpl.nasa.gov:10000/JPL.PDS.PROFILE</resLocation>
- </resAttributes>
- <profElement>
- <elemId>3.14159</elemId>
- <elemName>TEST</elemName>
- <elemDesc>This is a test element</elemDesc>
- <elemType>Testing</elemType>
- <elemUnit>fortnights-per-furlong</elemUnit>
- <elemEnumFlag>F</elemEnumFlag>
- <elemMinValue>0</elemMinValue>
- <elemMaxValue>32</elemMaxValue>
- <elemComment>Testing only.</elemComment>
- </profElement>
- <profElement>
- <elemId>3.2</elemId>
- <elemName>TEST2</elemName>
- <elemDesc>This is another test element</elemDesc>
- <elemType>Testing</elemType>
- <elemUnit>fleas-per-tick</elemUnit>
- <elemEnumFlag>F</elemEnumFlag>
- <elemMinValue>32</elemMinValue>
- <elemMaxValue>64</elemMaxValue>
- <elemComment>More testing.</elemComment>
- </profElement>
- <profElement>
- <elemId>3.5</elemId>
- <elemName>TEST3</elemName>
- <elemDesc>Yet another test element</elemDesc>
- <elemType>Testing</elemType>
- <elemEnumFlag>T</elemEnumFlag>
- <elemValue>alpha</elemValue>
- <elemValue>beta</elemValue>
- <elemValue>gamma</elemValue>
- <elemValue>delta</elemValue>
- <elemComment>A bunch of greek letters, eh?</elemComment>
- </profElement>
-</profile>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/api/.gitignore
----------------------------------------------------------------------
diff --git a/protocol/api/.gitignore b/protocol/api/.gitignore
deleted file mode 100644
index b54523f..0000000
--- a/protocol/api/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/maven-eclipse.xml
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/api/pom.xml
----------------------------------------------------------------------
diff --git a/protocol/api/pom.xml b/protocol/api/pom.xml
deleted file mode 100644
index 0cbe0a4..0000000
--- a/protocol/api/pom.xml
+++ /dev/null
@@ -1,147 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
- license agreements. See the NOTICE file distributed with this work for additional
- information regarding copyright ownership. The ASF licenses this file to
- You under the Apache License, Version 2.0 (the "License"); you may not use
- this file except in compliance with the License. You may obtain a copy of
- the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
- by applicable law or agreed to in writing, software distributed under the
- License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, either express or implied. See the License for the specific
- language governing permissions and limitations under the License. -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.oodt</groupId>
- <artifactId>oodt-core</artifactId>
- <version>1.1-SNAPSHOT</version>
- <relativePath>../../core/pom.xml</relativePath>
- </parent>
- <artifactId>cas-protocol-api</artifactId>
- <name>CAS Protocol</name>
- <!-- All dependencies should be listed in core/pom.xml and be ordered alphabetically by package and artifact.
- Once the dependency is in the core pom, it can then be used in other modules without the version tags.
- For example, within core/pom.xml:
-
- <dependency>
- <groupId>com.amazonaws</groupId>
- <artifactId>aws-java-sdk</artifactId>
- <version>1.7.4</version>
- </dependency>
-
- Elsewhere in the platform:
- <dependency>
- <groupId>com.amazonaws</groupId>
- <artifactId>aws-java-sdk</artifactId>
- </dependency>
-
- Where possible the same dependency version should be used across the whole platform but if required the version
- can be overridden in a specific pom and should have a comment explaing why the version has been overridden
- -->
- <dependencies>
- <dependency>
- <groupId>com.thoughtworks.xstream</groupId>
- <artifactId>xstream</artifactId>
- <version>1.3.1</version>
- <exclusions>
- <exclusion>
- <!-- xom is an optional dependency of xstream. Its also an Apache incompatible
- license -->
- <groupId>xom</groupId>
- <artifactId>xom</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.oodt</groupId>
- <artifactId>cas-cli</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.oodt</groupId>
- <artifactId>cas-metadata</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.oodt</groupId>
- <artifactId>oodt-commons</artifactId>
- </dependency>
- <dependency>
- <groupId>xmlrpc</groupId>
- <artifactId>xmlrpc</artifactId>
- </dependency>
- </dependencies>
- <build>
- <resources>
- <resource>
- <targetPath>org/apache/oodt/cas/protocol</targetPath>
- <directory>${basedir}/src/main/resources/policy</directory>
- <includes>
- <include>protocol-config.xml</include>
- </includes>
- </resource>
- </resources>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>2.2-beta-2</version>
- <configuration>
- <descriptors>
- <descriptor>src/main/assembly/assembly.xml</descriptor>
- </descriptors>
- <archive>
- <manifest>
- <mainClass>org.apache.oodt.cas.protocol.system.CLProtocolManager</mainClass>
- </manifest>
- </archive>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>single</goal>
- </goals>
- <phase>package</phase>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- <profiles>
- <profile>
- <id>audit</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>rat-maven-plugin</artifactId>
- <configuration>
- <excludes>
- <exclude>**/resources/examples/**/*</exclude>
- </excludes>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>check</goal>
- </goals>
- <phase>verify</phase>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-</project>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/api/src/main/assembly/assembly.xml
----------------------------------------------------------------------
diff --git a/protocol/api/src/main/assembly/assembly.xml b/protocol/api/src/main/assembly/assembly.xml
deleted file mode 100644
index 9af13fd..0000000
--- a/protocol/api/src/main/assembly/assembly.xml
+++ /dev/null
@@ -1,94 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more contributor
-license agreements. See the NOTICE.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.
--->
-<assembly>
- <id>dist</id>
- <formats>
- <format>tar.gz</format>
- <format>zip</format>
- </formats>
- <includeBaseDirectory>true</includeBaseDirectory>
- <baseDirectory>${project.artifactId}-${project.version}</baseDirectory>
- <includeSiteDirectory>false</includeSiteDirectory>
- <fileSets>
- <fileSet>
- <directory>${basedir}</directory>
- <outputDirectory>.</outputDirectory>
- <includes>
- <include>LICENSE.txt</include>
- <include>CHANGES.txt</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>${basedir}/src/main/bin</directory>
- <outputDirectory>bin</outputDirectory>
- <includes/>
- <fileMode>755</fileMode>
- </fileSet>
- <fileSet>
- <directory>${basedir}/src/main/resources</directory>
- <outputDirectory>etc</outputDirectory>
- <includes>
- <include>*.properties</include>
- <include>jssecacerts</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>${basedir}/src/main/resources/examples</directory>
- <outputDirectory>etc/examples</outputDirectory>
- <excludes/>
- </fileSet>
- <fileSet>
- <directory>${basedir}/src/main/resources</directory>
- <outputDirectory>logs</outputDirectory>
- <includes>
- <include>REMOVE.log</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>${basedir}/src/main/resources/policy</directory>
- <outputDirectory>policy</outputDirectory>
- <includes>
- <include>cmd-line-actions.xml</include>
- <include>cmd-line-options.xml</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>${basedir}/src/main/java/org/apache/oodt/cas/protocol</directory>
- <outputDirectory>policy</outputDirectory>
- <includes>
- <include>protocol-config.xml</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>target/site/apidocs</directory>
- <filtered>false</filtered>
- <outputDirectory>doc</outputDirectory>
- <excludes/>
- </fileSet>
- </fileSets>
- <dependencySets>
- <dependencySet>
- <outputDirectory>lib</outputDirectory>
- <unpack>false</unpack>
- <useProjectArtifact>true</useProjectArtifact>
- <useTransitiveDependencies>true</useTransitiveDependencies>
- <unpackOptions/>
- </dependencySet>
- </dependencySets>
-</assembly>
-
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/api/src/main/bin/protocol
----------------------------------------------------------------------
diff --git a/protocol/api/src/main/bin/protocol b/protocol/api/src/main/bin/protocol
deleted file mode 100644
index ff4cc20..0000000
--- a/protocol/api/src/main/bin/protocol
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/csh
-
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-set args
-
-if ( $#args > 0 ) then
- set args = "$*"
-endif
-
-${JAVA_HOME}/bin/java \
- -Djava.ext.dirs=../lib \
- -Djava.util.logging.config.file=../etc/logging.properties \
- -Dorg.apache.oodt.cas.cli.action.spring.config=../policy/cmd-line-actions.xml \
- -Dorg.apache.oodt.cas.cli.option.spring.config=../policy/cmd-line-options.xml \
- org.apache.oodt.cas.protocol.system.ProtocolCommandLine ${args}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/api/src/main/java/org/apache/oodt/cas/protocol/Protocol.java
----------------------------------------------------------------------
diff --git a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/Protocol.java b/protocol/api/src/main/java/org/apache/oodt/cas/protocol/Protocol.java
deleted file mode 100644
index 54df836..0000000
--- a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/Protocol.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol;
-
-//OODT imports
-import org.apache.oodt.cas.protocol.auth.Authentication;
-import org.apache.oodt.cas.protocol.exceptions.ProtocolException;
-import org.apache.oodt.cas.protocol.util.ProtocolFileFilter;
-
-//JDK imports
-import java.io.File;
-import java.util.List;
-
-/**
- * Interface for communication over different transfer protocols
- *
- * @author bfoster
- * @version $Revision$
- */
-public interface Protocol {
-
- void connect(String host, Authentication authentication) throws ProtocolException;
-
- void close() throws ProtocolException;
-
- boolean connected();
-
- void cd(ProtocolFile file) throws ProtocolException;
-
- void cdRoot() throws ProtocolException;
-
- void cdHome() throws ProtocolException;
-
- void get(ProtocolFile fromFile, File toFile) throws ProtocolException;
-
- void put(File fromFile, ProtocolFile toFile) throws ProtocolException;
-
- ProtocolFile pwd() throws ProtocolException;
-
- List<ProtocolFile> ls() throws ProtocolException;
-
- List<ProtocolFile> ls(ProtocolFileFilter filter) throws ProtocolException;
-
- void delete(ProtocolFile file) throws ProtocolException;
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/api/src/main/java/org/apache/oodt/cas/protocol/ProtocolFactory.java
----------------------------------------------------------------------
diff --git a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/ProtocolFactory.java b/protocol/api/src/main/java/org/apache/oodt/cas/protocol/ProtocolFactory.java
deleted file mode 100644
index e0ffd61..0000000
--- a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/ProtocolFactory.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol;
-
-/**
- * Factory for creating {@link Protocol}s
- *
- * @author bfoster
- * @version $Revision$
- */
-public interface ProtocolFactory {
-
- Protocol newInstance();
-
- String getSchema();
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/api/src/main/java/org/apache/oodt/cas/protocol/ProtocolFile.java
----------------------------------------------------------------------
diff --git a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/ProtocolFile.java b/protocol/api/src/main/java/org/apache/oodt/cas/protocol/ProtocolFile.java
deleted file mode 100644
index 835dcc7..0000000
--- a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/ProtocolFile.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol;
-
-//APACHE imports
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.Validate;
-
-/**
- * A path representing a file/directory over some {@link Protocol}
- *
- * @author bfoster
- */
-public class ProtocolFile {
-
- public static final String SEPARATOR = "/";
-
- private String path;
- private boolean isDir;
- private ProtocolFile parent;
-
- public ProtocolFile(String path, boolean isDir) {
- this(null, path, isDir);
- }
-
- public ProtocolFile(ProtocolFile parent, String path, boolean isDir) {
- this.parent = parent;
- this.isDir = isDir;
- Validate.notNull(path, "ProtocolFile's path cannot be NULL");
- this.path = path.length() > 0 && !path.equals(SEPARATOR) ? StringUtils
- .chomp(path, SEPARATOR) : path;
- }
-
- /**
- * True is this path is a directory.
- *
- * @return True if directory, false otherwise
- */
- public boolean isDir() {
- return isDir;
- }
-
- /**
- * Gets the {@link String} representation of this path.
- *
- * @return The {@link String} representation of this path
- */
- public String getPath() {
- return path;
- }
-
- /**
- * Gets the name of this file this path represents (i.e. '/path/to/file' will
- * return 'file')
- *
- * @return The name of the file this path represents
- */
- public String getName() {
- return path.substring(path.lastIndexOf(SEPARATOR) + 1);
- }
-
- /**
- * True if this path is a relative path (i.e. does not start with
- * {@link SEPARATOR}).
- *
- * @return True is this a relative path, false otherwise
- */
- public boolean isRelative() {
- return !path.startsWith(SEPARATOR);
- }
-
- /**
- * Gets the parent {@link ProtocolFile} for this path.
- *
- * @return The parent {@link ProtocolFile}
- */
- public ProtocolFile getParent() {
- if (parent != null) {
- return parent;
- } else {
- int index = StringUtils.lastIndexOf(path, SEPARATOR);
- return (index > 0) ? new ProtocolFile(StringUtils.substring(path, 0, index), true) : null;
- }
- }
-
- /**
- * Get Absolute pathed {@link ProtocolFile} version of this {@link ProtocolFile}.
- *
- * @return the absolute pathed version of this {@link ProtocolFile}
- */
- public ProtocolFile getAbsoluteFile() {
- if (this.isRelative()) {
- ProtocolFile parent = this.getParent();
- if (parent != null) {
- return new ProtocolFile(StringUtils.chomp(parent.getAbsoluteFile().getPath(), SEPARATOR)
- + SEPARATOR + this.getPath(), this.isDir());
- }
- }
- return this;
- }
-
- /**
- * {@inheritDoc}
- */
- public int hashCode() {
- return this.getPath().hashCode();
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean equals(Object path) {
- if (path instanceof ProtocolFile) {
- ProtocolFile p = (ProtocolFile) path;
- return (p.getAbsoluteFile().getPath()
- .equals(this.getAbsoluteFile().getPath()) && p.isDir() == this
- .isDir());
- }
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- public String toString() {
- return "{parent = '" + this.parent + "', path = '" + path + "', isDir = '" + isDir + "'}";
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/api/src/main/java/org/apache/oodt/cas/protocol/auth/Authentication.java
----------------------------------------------------------------------
diff --git a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/auth/Authentication.java b/protocol/api/src/main/java/org/apache/oodt/cas/protocol/auth/Authentication.java
deleted file mode 100644
index d387933..0000000
--- a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/auth/Authentication.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.auth;
-
-/**
- * Authentication interface for {@link Protocol} connections
- *
- * @author bfoster
- */
-public interface Authentication {
-
- String getUser();
-
- String getPass();
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/api/src/main/java/org/apache/oodt/cas/protocol/auth/BasicAuthentication.java
----------------------------------------------------------------------
diff --git a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/auth/BasicAuthentication.java b/protocol/api/src/main/java/org/apache/oodt/cas/protocol/auth/BasicAuthentication.java
deleted file mode 100644
index 27e4435..0000000
--- a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/auth/BasicAuthentication.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.auth;
-
-import org.apache.commons.lang.Validate;
-
-/**
- * Basic username and password {@link Authentication}
- *
- * @author bfoster
- * @version $Revision$
- */
-public class BasicAuthentication implements Authentication {
-
- private String user;
- private String pass;
-
- public BasicAuthentication(String user, String pass) {
- Validate.notNull(user, "NULL user not allowed");
- Validate.notNull(pass, "NULL pass not allowed");
- this.user = user;
- this.pass = pass;
- }
-
- public String getUser() {
- return user;
- }
-
- public String getPass() {
- return pass;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/api/src/main/java/org/apache/oodt/cas/protocol/auth/NoAuthentication.java
----------------------------------------------------------------------
diff --git a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/auth/NoAuthentication.java b/protocol/api/src/main/java/org/apache/oodt/cas/protocol/auth/NoAuthentication.java
deleted file mode 100644
index 2f402d5..0000000
--- a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/auth/NoAuthentication.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.auth;
-
-/**
- * Use when {@link Protocol} requires no {@link Authentication}
- *
- * @author bfoster
- */
-public class NoAuthentication implements Authentication {
-
- public String getUser() {
- return "";
- }
-
- public String getPass() {
- return "";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/api/src/main/java/org/apache/oodt/cas/protocol/cli/action/BasicVerifyCliAction.java
----------------------------------------------------------------------
diff --git a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/cli/action/BasicVerifyCliAction.java b/protocol/api/src/main/java/org/apache/oodt/cas/protocol/cli/action/BasicVerifyCliAction.java
deleted file mode 100644
index f76dc0e..0000000
--- a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/cli/action/BasicVerifyCliAction.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.cli.action;
-
-//OODT imports
-import org.apache.oodt.cas.cli.exception.CmdLineActionException;
-import org.apache.oodt.cas.protocol.Protocol;
-import org.apache.oodt.cas.protocol.ProtocolFactory;
-import org.apache.oodt.cas.protocol.verify.ProtocolVerifier;
-
-/**
- * Action for determining whether a given {@link Protocol} or auto-determined
- * {@link Protocol} via {@link org.apache.oodt.cas.protocol.system.ProtocolManager} can connect and pass
- * verification of the given {@link Verifier} for given site.
- *
- * @author bfoster (Brian Foster)
- */
-public class BasicVerifyCliAction extends ProtocolCliAction {
-
- private ProtocolVerifier verifier;
- private ProtocolFactory factory;
-
- private boolean lastVerificationResult;
-
- @Override
- public void execute(ActionMessagePrinter printer)
- throws CmdLineActionException {
- try {
- if (factory != null) {
- Protocol protocol = factory.newInstance();
- if (lastVerificationResult = verifier.verify(protocol, getSite(),
- getAuthentication())) {
- printer.println("Protocol '"
- + protocol.getClass().getCanonicalName()
- + "' PASSED verification!");
- } else {
- printer.println("Protocol '"
- + protocol.getClass().getCanonicalName()
- + "' FAILED verification!");
- }
- } else {
- Protocol protocol = getProtocolManager().getProtocolBySite(
- getSite(), getAuthentication(), verifier);
- if (lastVerificationResult = protocol != null) {
- printer.println("Protocol '"
- + protocol.getClass().getCanonicalName()
- + "' PASSED verification!");
- } else {
- printer.println("No Protocol determined, FAILED verification!");
- }
- }
- } catch (Exception e) {
- throw new CmdLineActionException("Failed to verify factory '"
- + factory + "' : " + e.getMessage(), e);
- }
- }
-
- public void setVerifier(ProtocolVerifier verifier) {
- this.verifier = verifier;
- }
-
- public void setProtocolFactory(ProtocolFactory factory) {
- this.factory = factory;
- }
-
- protected boolean getLastVerificationResults() {
- return lastVerificationResult;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/api/src/main/java/org/apache/oodt/cas/protocol/cli/action/CrossProtocolTransferCliAction.java
----------------------------------------------------------------------
diff --git a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/cli/action/CrossProtocolTransferCliAction.java b/protocol/api/src/main/java/org/apache/oodt/cas/protocol/cli/action/CrossProtocolTransferCliAction.java
deleted file mode 100644
index 94005e7..0000000
--- a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/cli/action/CrossProtocolTransferCliAction.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.cli.action;
-
-//OODT imports
-import java.io.File;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.UUID;
-
-//OODT imports
-import org.apache.oodt.cas.cli.exception.CmdLineActionException;
-import org.apache.oodt.cas.protocol.Protocol;
-import org.apache.oodt.cas.protocol.ProtocolFile;
-import org.apache.oodt.cas.protocol.auth.Authentication;
-import org.apache.oodt.cas.protocol.auth.BasicAuthentication;
-import org.apache.oodt.cas.protocol.auth.NoAuthentication;
-import org.apache.oodt.cas.protocol.system.ProtocolManager;
-import org.apache.oodt.cas.protocol.verify.ProtocolVerifier;
-import org.apache.oodt.cas.protocol.verify.ProtocolVerifierFactory;
-
-/**
- * {@link ProtocolAction} for transferring a file from one host to another
- *
- * @author bfoster (Brian Foster)
- */
-public class CrossProtocolTransferCliAction extends ProtocolCliAction {
-
- private URI fromUri;
- private URI toUri;
- private ProtocolVerifierFactory verifierFactory;
-
- @Override
- public void execute(ActionMessagePrinter printer)
- throws CmdLineActionException {
- try {
- ProtocolVerifier verifier = null;
- if (verifierFactory != null) {
- verifier = verifierFactory.newInstance();
- }
-
- File localFile = createTempDownloadFile();
- if (localFile == null) {
- throw new Exception("Failed to create tempory local file");
- }
-
- ProtocolManager protocolManager = getProtocolManager();
- Protocol fromProtocol = protocolManager.getProtocolBySite(fromUri,
- getAuthentication(fromUri), verifier);
- if (fromProtocol == null) {
- throw new Exception("Failed to get protocol for 'from' URI '"
- + fromUri + "'");
- }
-
- Protocol toProtocol = protocolManager.getProtocolBySite(toUri,
- getAuthentication(toUri), verifier);
- if (toProtocol == null) {
- throw new Exception("Failed to get protocol for 'to' URI '" + toUri
- + "'");
- }
-
- fromProtocol
- .get(new ProtocolFile(fromUri.getPath(), false), localFile);
- toProtocol.put(localFile, new ProtocolFile(toUri.getPath(), false));
- } catch (Exception e) {
- throw new CmdLineActionException(
- "Failed to transfer between 2 protocols : " + e.getMessage(), e);
- }
- }
-
- public void setFromUri(String fromUri) throws URISyntaxException {
- this.fromUri = new URI(fromUri);
- }
-
- public void setToUri(String toUri) throws URISyntaxException {
- this.toUri = new URI(toUri);
- }
-
- public void setVerifierFactory(ProtocolVerifierFactory verifierFactory) {
- this.verifierFactory = verifierFactory;
- }
-
- private File createTempDownloadFile() {
- File bogusFile = null;
- try {
- bogusFile = File.createTempFile("bogus", "bogus");
- File tmpDir = new File(bogusFile.getParentFile(), "ProtocolTransfer/"
- + UUID.randomUUID().toString());
- tmpDir.mkdirs();
- return new File(tmpDir, "temp_file");
- } catch (Exception e) {
- return null;
- } finally {
- try {
- bogusFile.delete();
- } catch (Exception ignored) {
- }
- }
- }
-
- private Authentication getAuthentication(URI uri) {
- if (uri.getUserInfo() != null) {
- String[] userInfo = uri.getUserInfo().split("\\:");
- return new BasicAuthentication(userInfo[0], userInfo[1]);
- } else {
- return new NoAuthentication();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/api/src/main/java/org/apache/oodt/cas/protocol/cli/action/DeleteEmptyDirectoriesCliAction.java
----------------------------------------------------------------------
diff --git a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/cli/action/DeleteEmptyDirectoriesCliAction.java b/protocol/api/src/main/java/org/apache/oodt/cas/protocol/cli/action/DeleteEmptyDirectoriesCliAction.java
deleted file mode 100644
index 5464164..0000000
--- a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/cli/action/DeleteEmptyDirectoriesCliAction.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.cli.action;
-
-// JDK imports
-import java.util.List;
-import java.util.regex.Pattern;
-
-
-
-// OODT imports
-import org.apache.oodt.cas.cli.exception.CmdLineActionException;
-import org.apache.oodt.cas.protocol.Protocol;
-import org.apache.oodt.cas.protocol.ProtocolFile;
-import org.apache.oodt.cas.protocol.verify.ProtocolVerifierFactory;
-
-/**
- * {@link ProtocolAction} for deleting empty files from site.
- *
- * @author bfoster (Brian Foster)
- */
-public class DeleteEmptyDirectoriesCliAction extends ProtocolCliAction {
-
- private String directoryRegex = ".+";
- private ProtocolVerifierFactory verifierFactory;
-
- @Override
- public void execute(ActionMessagePrinter printer) throws CmdLineActionException {
- try {
- Protocol protocol = getProtocolManager().getProtocolBySite(
- getSite(), getAuthentication(), verifierFactory.newInstance());
- List<ProtocolFile> files = protocol.ls();
- for (ProtocolFile file : files) {
- if (file.isDir() && Pattern.matches(directoryRegex, file.getName())) {
- try {
- protocol.delete(file);
- printer.println("Success: " + file.getPath());
- } catch (Exception e) {
- printer.println("Failed: " + file.getPath());
- }
- }
- }
- } catch (Exception e) {
- throw new CmdLineActionException("Failed to delete directories", e);
- }
- }
-
- public void setDirectoryRegex(String directoryRegex) {
- this.directoryRegex = directoryRegex;
- }
-
- public void setVerifierFactory(ProtocolVerifierFactory verifierFactory) {
- this.verifierFactory = verifierFactory;
- }
-}
-
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/api/src/main/java/org/apache/oodt/cas/protocol/cli/action/DownloadCliAction.java
----------------------------------------------------------------------
diff --git a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/cli/action/DownloadCliAction.java b/protocol/api/src/main/java/org/apache/oodt/cas/protocol/cli/action/DownloadCliAction.java
deleted file mode 100644
index 9497d02..0000000
--- a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/cli/action/DownloadCliAction.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.cli.action;
-
-//JDK imports
-import java.io.File;
-import java.net.URI;
-import java.net.URISyntaxException;
-
-//OODT imports
-import org.apache.oodt.cas.cli.exception.CmdLineActionException;
-import org.apache.oodt.cas.protocol.Protocol;
-import org.apache.oodt.cas.protocol.ProtocolFile;
-import org.apache.oodt.cas.protocol.system.ProtocolManager;
-
-/**
- * A {@link ProtocolAction} which will downlaod a url
- *
- * @author bfoster (Brian Foster)
- */
-public class DownloadCliAction extends ProtocolCliAction {
-
- protected URI uri;
- protected String toDir;
- protected Protocol usedProtocol;
-
- @Override
- public void execute(ActionMessagePrinter printer)
- throws CmdLineActionException {
- try {
- usedProtocol = createProtocol(getProtocolManager());
- ProtocolFile fromFile = createProtocolFile();
- String toFilename = fromFile.equals(ProtocolFile.SEPARATOR)
- || fromFile.getName().isEmpty() ? uri.getHost() : fromFile
- .getName();
- File toFile = (toDir != null) ? new File(toDir, toFilename)
- : new File(toFilename);
- usedProtocol.get(fromFile, toFile.getAbsoluteFile());
- } catch (Exception e) {
- throw new CmdLineActionException("Failed to download : "
- + e.getMessage(), e);
- }
- }
-
- public void setUrl(String urlString) throws URISyntaxException {
- uri = new URI(urlString);
- }
-
- public void setToDir(String toDir) {
- this.toDir = toDir;
- }
-
- protected Protocol getUsedProtocol() {
- return usedProtocol;
- }
-
- protected ProtocolFile createProtocolFile() {
- return new ProtocolFile(uri.getPath(), false);
- }
-
- protected Protocol createProtocol(ProtocolManager protocolManager)
- throws URISyntaxException {
- return protocolManager.getProtocolBySite(
- new URI(uri.getScheme(), uri.getHost(), null, null),
- getAuthentication(), null);
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/api/src/main/java/org/apache/oodt/cas/protocol/cli/action/GetSupportedFactoriesCliAction.java
----------------------------------------------------------------------
diff --git a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/cli/action/GetSupportedFactoriesCliAction.java b/protocol/api/src/main/java/org/apache/oodt/cas/protocol/cli/action/GetSupportedFactoriesCliAction.java
deleted file mode 100644
index 9402949..0000000
--- a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/cli/action/GetSupportedFactoriesCliAction.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.cli.action;
-
-//OODT imports
-import org.apache.oodt.cas.cli.exception.CmdLineActionException;
-import org.apache.oodt.cas.protocol.ProtocolFactory;
-
-/**
- * {@link ProtocolAction} for get a list of supported {@link ProtocolFactory}s.
- *
- * @author bfoster (Brian Foster)
- */
-public class GetSupportedFactoriesCliAction extends ProtocolCliAction {
-
- @Override
- public void execute(ActionMessagePrinter printer)
- throws CmdLineActionException {
- try {
- printer.println("Supported Factories:");
- for (ProtocolFactory factory : getProtocolManager().getFactories()) {
- System.out.println(" - " + factory.getClass().getCanonicalName());
- }
- } catch (Exception e) {
- throw new CmdLineActionException(
- "Failed to get supported factories : " + e.getMessage(), e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/api/src/main/java/org/apache/oodt/cas/protocol/cli/action/ProtocolCliAction.java
----------------------------------------------------------------------
diff --git a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/cli/action/ProtocolCliAction.java b/protocol/api/src/main/java/org/apache/oodt/cas/protocol/cli/action/ProtocolCliAction.java
deleted file mode 100644
index 39e8784..0000000
--- a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/cli/action/ProtocolCliAction.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.cli.action;
-
-//JDK imports
-import java.net.URI;
-import java.net.URISyntaxException;
-
-//OODT imports
-import org.apache.oodt.cas.cli.action.CmdLineAction;
-import org.apache.oodt.cas.metadata.util.PathUtils;
-import org.apache.oodt.cas.protocol.auth.Authentication;
-import org.apache.oodt.cas.protocol.auth.BasicAuthentication;
-import org.apache.oodt.cas.protocol.auth.NoAuthentication;
-import org.apache.oodt.cas.protocol.config.SpringProtocolConfig;
-import org.apache.oodt.cas.protocol.system.ProtocolManager;
-
-/**
- * Action used to perform some task via a {@link ProtocolManager}
- *
- * @author bfoster (Brian Foster)
- */
-public abstract class ProtocolCliAction extends CmdLineAction {
-
- private String user;
- private String pass;
- private String site;
- private ProtocolManager protocolManager;
-
- public void setUser(String user) {
- this.user = user;
- }
-
- public void setPass(String pass) {
- this.pass = pass;
- }
-
- public void setSite(String site) {
- this.site = site;
- }
-
- public URI getSite() throws URISyntaxException {
- return site != null ? new URI(site) : null;
- }
-
- public Authentication getAuthentication() {
- if (user == null || pass == null) {
- return new NoAuthentication();
- } else {
- return new BasicAuthentication(user, pass);
- }
- }
-
- public void setProtocolManager(ProtocolManager protocolManager) {
- this.protocolManager = protocolManager;
- }
-
- public ProtocolManager getProtocolManager() throws Exception {
- if (protocolManager != null) {
- return protocolManager;
- }
- String protocolConfig = PathUtils
- .doDynamicReplacement(System
- .getProperty(
- "org.apache.oodt.cas.protocol.manager.config.file",
- "classpath:/org/apache/oodt/cas/protocol/protocol-config.xml"));
- return protocolManager = new ProtocolManager(new SpringProtocolConfig(
- protocolConfig));
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/api/src/main/java/org/apache/oodt/cas/protocol/config/ProtocolConfig.java
----------------------------------------------------------------------
diff --git a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/config/ProtocolConfig.java b/protocol/api/src/main/java/org/apache/oodt/cas/protocol/config/ProtocolConfig.java
deleted file mode 100644
index 6c36b62..0000000
--- a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/config/ProtocolConfig.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.config;
-
-
-//OODT imports
-import org.apache.oodt.cas.protocol.ProtocolFactory;
-
-//JDK imports
-import java.net.URI;
-import java.util.List;
-
-
-/**
- * Protocol configuration for configuring {@link org.apache.oodt.cas.protocol.system.ProtocolManager}.
- *
- * @author bfoster
- */
-public interface ProtocolConfig {
-
- List<ProtocolFactory> getAllFactories();
-
- List<ProtocolFactory> getFactoriesBySite(URI site);
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/api/src/main/java/org/apache/oodt/cas/protocol/config/SpringProtocolConfig.java
----------------------------------------------------------------------
diff --git a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/config/SpringProtocolConfig.java b/protocol/api/src/main/java/org/apache/oodt/cas/protocol/config/SpringProtocolConfig.java
deleted file mode 100644
index 9f27c86..0000000
--- a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/config/SpringProtocolConfig.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.config;
-
-//JDK imports
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.List;
-import java.util.Map;
-
-//Spring imports
-import org.apache.commons.lang.Validate;
-import org.apache.oodt.cas.protocol.ProtocolFactory;
-import org.springframework.context.support.FileSystemXmlApplicationContext;
-
-/**
- * Spring Framework base {@link ProtocolConfig} which loads {@link ProtocolFactory}s
- * from a Spring xml bean file.
- *
- * @author bfoster
- */
-public class SpringProtocolConfig implements ProtocolConfig {
-
- protected Map<String, List<ProtocolFactory>> factoryMap;
-
- public SpringProtocolConfig(String configFile) {
- Validate.notNull(configFile, "SpringProtocolConfig configFile cannnot be NULL");
- factoryMap = new ConcurrentHashMap<String, List<ProtocolFactory>>();
- loadFactories(new FileSystemXmlApplicationContext(configFile));
- }
-
- private void loadFactories(FileSystemXmlApplicationContext appContext) {
- Collection<ProtocolFactory> protocolFactories = appContext.getBeansOfType(ProtocolFactory.class).values();
- for (ProtocolFactory factory : protocolFactories) {
- List<ProtocolFactory> factories = factoryMap.get(factory.getSchema());
- if (factories == null) {
- factories = new ArrayList<ProtocolFactory>();
- }
- factories.add(factory);
- factoryMap.put(factory.getSchema(), factories);
- }
- }
-
- public List<ProtocolFactory> getAllFactories() {
- ArrayList<ProtocolFactory> factories = new ArrayList<ProtocolFactory>();
- for (List<ProtocolFactory> groupOfFactories : factoryMap.values()) {
- factories.addAll(groupOfFactories);
- }
- return factories;
- }
-
- public List<ProtocolFactory> getFactoriesBySite(URI site) {
- Validate.notNull(site, "URI site cannot be NULL");
- List<ProtocolFactory> factories = factoryMap.get(site.getScheme());
- if (factories == null) {
- factories = new ArrayList<ProtocolFactory>();
- }
- return factories;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/api/src/main/java/org/apache/oodt/cas/protocol/exceptions/ProtocolException.java
----------------------------------------------------------------------
diff --git a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/exceptions/ProtocolException.java b/protocol/api/src/main/java/org/apache/oodt/cas/protocol/exceptions/ProtocolException.java
deleted file mode 100644
index 8ac2e99..0000000
--- a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/exceptions/ProtocolException.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.exceptions;
-
-/**
- * @author bfoster
- * @version $Revision$
- */
-public class ProtocolException extends Exception {
-
- private static final long serialVersionUID = -8463387026167921360L;
-
- public ProtocolException(String msg) {
- super(msg);
- }
-
- public ProtocolException(String msg, Throwable throwable) {
- super(msg, throwable);
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/api/src/main/java/org/apache/oodt/cas/protocol/system/ProtocolCommandLine.java
----------------------------------------------------------------------
diff --git a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/system/ProtocolCommandLine.java b/protocol/api/src/main/java/org/apache/oodt/cas/protocol/system/ProtocolCommandLine.java
deleted file mode 100644
index 5f463d5..0000000
--- a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/system/ProtocolCommandLine.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.system;
-
-//OODT imports
-import org.apache.oodt.cas.cli.CmdLineUtility;
-
-/**
- * @author bfoster (Brian Foster)
- */
-public class ProtocolCommandLine {
-
- public static void main(String[] args) throws Exception {
- CmdLineUtility cmdLineUtility = new CmdLineUtility();
- cmdLineUtility.run(args);
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/api/src/main/java/org/apache/oodt/cas/protocol/system/ProtocolManager.java
----------------------------------------------------------------------
diff --git a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/system/ProtocolManager.java b/protocol/api/src/main/java/org/apache/oodt/cas/protocol/system/ProtocolManager.java
deleted file mode 100644
index 462e0d5..0000000
--- a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/system/ProtocolManager.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.system;
-
-//OODT imports
-import org.apache.commons.lang.Validate;
-import org.apache.oodt.cas.protocol.auth.Authentication;
-import org.apache.oodt.cas.protocol.config.ProtocolConfig;
-import org.apache.oodt.cas.protocol.verify.ProtocolVerifier;
-import org.apache.oodt.cas.protocol.Protocol;
-import org.apache.oodt.cas.protocol.ProtocolFactory;
-
-//JDK imports
-import java.net.URI;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.logging.Logger;
-
-/**
- * A Manager responsible for managing site to {@link ProtocolFactory} mapping
- *
- * @author bfoster
- */
-public class ProtocolManager {
-
- private static final Logger LOG = Logger.getLogger(ProtocolManager.class.getName());
-
- private ProtocolConfig protocolConfig;
- private Map<URI, ProtocolFactory> verifiedMap;
-
- public ProtocolManager(ProtocolConfig protocolConfig) {
- Validate.notNull(protocolConfig, "protocolConfig must not be NULL");
- this.protocolConfig = protocolConfig;
- verifiedMap = new ConcurrentHashMap<URI, ProtocolFactory>();
- }
-
- public ProtocolConfig getConfig() {
- return protocolConfig;
- }
-
- public List<ProtocolFactory> getFactories() {
- return protocolConfig.getAllFactories();
- }
-
- /**
- * Determines/creates the appropriate {@link Protocol} for the given site and {@link Authentication}.
- * {@link ProtocolVerifier} is run and the first {@link Protocol} to pass its verification, will be
- * returned already connected to the given site. If a {@link Protocol} is returned once for a given
- * site/Authentication combination, then it will be remember next time this method is called an
- * {@link ProtocolVerifier} will not be run (assumed pass).
- *
- * @param site The URI for which a {@link Protocol} will be created
- * @param auth The connection {@link Authentication} to be used to connect to the given site
- * @param verifier The {@link ProtocolVerifier} which any {@link Protocol} must pass to be returned
- * as the approved {@link Protocol} for the given site and {@link Authentication}; may be null,
- * in which case as long as the {@link Protocol} can connect to the site it is considered a pass
- * as will be returned
- * @return A verified {@link Protocol} for the given site and {@link Authentication}, otherwise null if
- * no {@link Protocol} could be determined.
- */
- public Protocol getProtocolBySite(URI site, Authentication auth, ProtocolVerifier verifier) {
- if (verifiedMap.containsKey(site)) {
- return verifiedMap.get(site).newInstance();
- } else {
- for (ProtocolFactory factory : protocolConfig.getFactoriesBySite(site)) {
- Protocol protocol;
- try {
- protocol = factory.newInstance();
- if (verifier == null || verifier.verify(protocol, site, auth)) {
- verifiedMap.put(site, factory);
- if (protocol.connected()) {
- protocol.close();
- }
- protocol.connect(site.getHost(), auth);
- return protocol;
- }
- } catch (Exception e) {
- LOG.warning("Failed to create/verify protocol from factory '"
- + factory.getClass().getCanonicalName()
- + "' : "
- + e.getMessage());
- }
- }
- return null;
- }
- }
-
- /**
- *
- * @param site
- * @param auth
- * @param factory
- * @throws IllegalArgumentException if any of the arguments are null
- */
- public void setProtocol(URI site, Authentication auth, ProtocolFactory factory) {
- Validate.notNull(site, "site must not be NULL");
- Validate.notNull(auth, "auth must not be NULL");
- Validate.notNull(factory, "factory must not be NULL");
- verifiedMap.put(site, factory);
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/api/src/main/java/org/apache/oodt/cas/protocol/util/ProtocolFileFilter.java
----------------------------------------------------------------------
diff --git a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/util/ProtocolFileFilter.java b/protocol/api/src/main/java/org/apache/oodt/cas/protocol/util/ProtocolFileFilter.java
deleted file mode 100644
index 5f99845..0000000
--- a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/util/ProtocolFileFilter.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.util;
-
-//OODT imports
-import org.apache.oodt.cas.protocol.ProtocolFile;
-
-/**
- * Filter for filtering {@ProtocolFile}s.
- *
- * @author bfoster
- * @version $Revision$
- */
-public interface ProtocolFileFilter {
-
- boolean accept(ProtocolFile file);
-
-}
[12/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/http/pom.xml
----------------------------------------------------------------------
diff --git a/protocol/http/pom.xml b/protocol/http/pom.xml
deleted file mode 100644
index 22013f5..0000000
--- a/protocol/http/pom.xml
+++ /dev/null
@@ -1,105 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
- license agreements. See the NOTICE file distributed with this work for additional
- information regarding copyright ownership. The ASF licenses this file to
- You under the Apache License, Version 2.0 (the "License"); you may not use
- this file except in compliance with the License. You may obtain a copy of
- the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
- by applicable law or agreed to in writing, software distributed under the
- License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, either express or implied. See the License for the specific
- language governing permissions and limitations under the License. -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.oodt</groupId>
- <artifactId>oodt-core</artifactId>
- <version>1.1-SNAPSHOT</version>
- <relativePath>../../core/pom.xml</relativePath>
- </parent>
- <artifactId>cas-protocol-http</artifactId>
- <name>CAS Protocol HTTP Implementation</name>
- <!-- All dependencies should be listed in core/pom.xml and be ordered alphabetically by package and artifact.
- Once the dependency is in the core pom, it can then be used in other modules without the version tags.
- For example, within core/pom.xml:
-
- <dependency>
- <groupId>com.amazonaws</groupId>
- <artifactId>aws-java-sdk</artifactId>
- <version>1.7.4</version>
- </dependency>
-
- Elsewhere in the platform:
- <dependency>
- <groupId>com.amazonaws</groupId>
- <artifactId>aws-java-sdk</artifactId>
- </dependency>
-
- Where possible the same dependency version should be used across the whole platform but if required the version
- can be overridden in a specific pom and should have a comment explaing why the version has been overridden
- -->
- <dependencies>
- <dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>nekohtml</groupId>
- <artifactId>nekohtml</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.oodt</groupId>
- <artifactId>cas-protocol-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.tika</groupId>
- <artifactId>tika-parsers</artifactId>
- </dependency>
- </dependencies>
- <build>
- <resources>
- <resource>
- <targetPath>org/apache/oodt/cas/protocol/http</targetPath>
- <directory>${basedir}/src/main/resources/policy</directory>
- <includes>
- <include>http-protocol-config.xml</include>
- </includes>
- </resource>
- </resources>
- </build>
- <profiles>
- <profile>
- <id>audit</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>rat-maven-plugin</artifactId>
- <configuration>
- <excludes>
- <exclude>**/resources/examples/**/*</exclude>
- </excludes>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>check</goal>
- </goals>
- <phase>verify</phase>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-</project>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/http/src/main/java/org/apache/oodt/cas/protocol/http/HttpFile.java
----------------------------------------------------------------------
diff --git a/protocol/http/src/main/java/org/apache/oodt/cas/protocol/http/HttpFile.java b/protocol/http/src/main/java/org/apache/oodt/cas/protocol/http/HttpFile.java
deleted file mode 100644
index 5e38940..0000000
--- a/protocol/http/src/main/java/org/apache/oodt/cas/protocol/http/HttpFile.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.http;
-
-//OODT imports
-import org.apache.commons.lang.Validate;
-import org.apache.oodt.cas.protocol.ProtocolFile;
-
-//JDK imports
-import java.net.URL;
-
-/**
- * HTTP extension of {@link ProtocolFile}
- *
- * @author bfoster
- * @version $Revision$
- */
-public class HttpFile extends ProtocolFile {
-
- private static final long serialVersionUID = -7780059889413081800L;
-
- private URL link;
-
- public HttpFile(String virtualPath, boolean isDir, URL link) {
- this(null, virtualPath, isDir, link);
- }
-
- public HttpFile(HttpFile parent, String virtualPath, boolean isDir, URL link) {
- super(parent, virtualPath, isDir);
- Validate.notNull(link, "URL link must not be NULL");
- this.link = link;
- }
-
- public URL getLink() {
- return this.link;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/http/src/main/java/org/apache/oodt/cas/protocol/http/HttpProtocol.java
----------------------------------------------------------------------
diff --git a/protocol/http/src/main/java/org/apache/oodt/cas/protocol/http/HttpProtocol.java b/protocol/http/src/main/java/org/apache/oodt/cas/protocol/http/HttpProtocol.java
deleted file mode 100644
index dc0d6a8..0000000
--- a/protocol/http/src/main/java/org/apache/oodt/cas/protocol/http/HttpProtocol.java
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.http;
-
-import org.apache.oodt.cas.protocol.Protocol;
-import org.apache.oodt.cas.protocol.ProtocolFile;
-import org.apache.oodt.cas.protocol.auth.Authentication;
-import org.apache.oodt.cas.protocol.exceptions.ProtocolException;
-import org.apache.oodt.cas.protocol.http.util.HttpUtils;
-import org.apache.oodt.cas.protocol.util.ProtocolFileFilter;
-
-//JDK imports
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-/**
- *
- * Http Protocol communication class
- *
- *
- * @author bfoster
- * @version $Revision$
- *
- */
-public class HttpProtocol implements Protocol {
-
- public static final int INT = 1024;
- private static Map<String, List<HttpFile>> linkChildren = new ConcurrentHashMap<String, List<HttpFile>>();
-
- private HttpFile parentFile;
- private HttpFile currentFile;
- private boolean isConnected;
-
- public HttpProtocol() {
- isConnected = false;
- }
-
- public void cd(ProtocolFile file) throws ProtocolException {
- try {
- HttpFile httpFile;
- if (file instanceof HttpFile) {
- httpFile = (HttpFile) file;
- } else {
- URL link = HttpUtils.resolveUri(currentFile.getLink().toURI(), file.getPath()).toURL();
- httpFile = new HttpFile(link.getPath(), file.isDir(), link);
- }
-
- if (!HttpUtils
- .isDirectory(httpFile.getLink(), file.getPath())) {
- throw new ProtocolException(file
- + " is not a directory (mime type must be text/html)");
- }
- this.currentFile = httpFile;
- } catch (Exception e) {
- throw new ProtocolException("Failed to cd to " + file + " : "
- + e.getMessage(), e);
- }
- }
-
- public void cdRoot() {
- currentFile = parentFile;
- }
-
- public void cdHome() {
- cdRoot();
- }
-
- public void connect(String host, Authentication auth)
- throws ProtocolException {
- try {
- URL url = new URL("http://" + host + "/");
- url.openStream().close();
- currentFile = parentFile = new HttpFile("/", true, url);
- isConnected = true;
- } catch (Exception e) {
- throw new ProtocolException("Failed to connect to http://" + host + " : "
- + e.getMessage());
- }
- }
-
- public void close() throws ProtocolException {
- currentFile = parentFile = null;
- }
-
- public void get(ProtocolFile fromFile, File toFile)
- throws ProtocolException {
-
- OutputStream out = null;
- InputStream in = null;
- try {
- out = new BufferedOutputStream(new FileOutputStream(toFile));
- if (fromFile instanceof HttpFile) {
- in = ((HttpFile) fromFile).getLink().openStream();
- } else {
- in = HttpUtils.resolveUri(currentFile.getLink().toURI(), fromFile.getPath()).toURL().openStream();
- }
-
- byte[] buffer = new byte[INT];
- int numRead;
- long numWritten = 0;
- while ((numRead = in.read(buffer)) != -1) {
- out.write(buffer, 0, numRead);
- numWritten += numRead;
- }
- in.close();
- out.close();
- } catch (Exception e) {
- throw new ProtocolException("Failed to get file '" + fromFile + "' : "
- + e.getMessage(), e);
- } finally {
- if (in != null) {
- try {
- in.close();
- } catch (Exception e) {
- // log failure
- }
- }
- if (out != null) {
- try {
- out.close();
- } catch (Exception e) {
- // log failure
- }
- }
- }
- }
-
- public void put(File fromFile, ProtocolFile toFile) {
- //do nothing
- }
-
- public List<ProtocolFile> ls() throws ProtocolException {
- List<ProtocolFile> lsResults = new ArrayList<ProtocolFile>();
- for (HttpFile file : parseLink(currentFile)) {
- lsResults.add(file);
- }
- return lsResults;
- }
-
- public List<ProtocolFile> ls(ProtocolFileFilter filter)
- throws ProtocolException {
- List<ProtocolFile> lsResults = new ArrayList<ProtocolFile>();
- for (HttpFile file : parseLink(currentFile)) {
- if (filter.accept(file)) {
- lsResults.add(file);
- }
- }
- return lsResults;
- }
-
- public ProtocolFile pwd() throws ProtocolException {
- try {
- return currentFile;
- } catch (Exception e) {
- throw new ProtocolException("Failed to get current working directory : "
- + e.getMessage());
- }
- }
-
- public boolean connected() {
- return this.isConnected;
- }
-
- public List<HttpFile> parseLink(HttpFile file)
- throws ProtocolException {
- List<HttpFile> children = linkChildren.get(file.getLink()
- .toString());
- if (file.isDir() && children == null) {
- try {
-
- // Open link.
- HttpURLConnection conn = HttpUtils.connect(file.getLink());
-
- // If redirection took place, then change the ProtocolFile's URL.
- if (HttpUtils.checkForRedirection(file.getLink(), conn.getURL())) {
- file = new HttpFile(file, file.getPath(), file.isDir(), conn.getURL());
- }
-
- // Find links in URL.
- children = new LinkedList<HttpFile>();
- children.addAll(HttpUtils.findLinks(file));
-
- // Save children links found.
- linkChildren.put(file.getLink().toString(), children);
-
- } catch (Exception e) {
- throw new ProtocolException("Failed to get children links for " + file
- + " : " + e.getMessage(), e);
- }
- }
- return children;
- }
-
- public void delete(ProtocolFile file) {}
-
- public static void main(String[] args) throws Exception {
- String urlString = null, downloadToDir = null;
- for (int i = 0; i < args.length; i++) {
- if (args[i].equals("--url")) {
- urlString = args[++i];
- } else if (args[i].equals("--downloadToDir")) {
- downloadToDir = args[++i];
- }
- }
-
- if (urlString == null) {
- throw new Exception("Must specify a url to download: --url <url>");
- }
-
- URL url = new URL(urlString);
- ProtocolFile urlFile = new HttpFile(url.getPath(), false, url);
- File toFile = new File(downloadToDir, urlFile.getName());
- toFile = toFile.getAbsoluteFile();
- toFile.createNewFile();
- new HttpProtocol().get(urlFile, toFile);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/http/src/main/java/org/apache/oodt/cas/protocol/http/HttpProtocolFactory.java
----------------------------------------------------------------------
diff --git a/protocol/http/src/main/java/org/apache/oodt/cas/protocol/http/HttpProtocolFactory.java b/protocol/http/src/main/java/org/apache/oodt/cas/protocol/http/HttpProtocolFactory.java
deleted file mode 100644
index 05b5bb3..0000000
--- a/protocol/http/src/main/java/org/apache/oodt/cas/protocol/http/HttpProtocolFactory.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.http;
-
-//OODT imports
-import org.apache.oodt.cas.protocol.ProtocolFactory;
-
-/**
- * Factory for creating {@link HttpProtocol}s
- *
- * @author bfoster
- * @version $Revision$
- */
-public class HttpProtocolFactory implements ProtocolFactory {
-
- public HttpProtocol newInstance() {
- return new HttpProtocol();
- }
-
- public String getSchema() {
- return "http";
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/http/src/main/java/org/apache/oodt/cas/protocol/http/util/HttpUtils.java
----------------------------------------------------------------------
diff --git a/protocol/http/src/main/java/org/apache/oodt/cas/protocol/http/util/HttpUtils.java b/protocol/http/src/main/java/org/apache/oodt/cas/protocol/http/util/HttpUtils.java
deleted file mode 100644
index 9a35934..0000000
--- a/protocol/http/src/main/java/org/apache/oodt/cas/protocol/http/util/HttpUtils.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.http.util;
-
-//JDK imports
-import java.io.IOException;
-import java.net.HttpURLConnection;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Scanner;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-//APACHE imports
-import org.apache.commons.lang.Validate;
-
-//OODT imports
-import org.apache.oodt.cas.metadata.util.MimeTypeUtils;
-import org.apache.oodt.cas.protocol.http.HttpFile;
-
-/**
- * Utility methods for HTTP Protocol related tasks.
- *
- * @author bfoster
- */
-public class HttpUtils {
-
- static final MimeTypeUtils MIME_TYPES = new MimeTypeUtils();
-
- // Pattern looking for <a href="(group-2)"/>(group-3)</a> . . . group-1 is for either " or '
- static final Pattern XHTML_LINK_PATTERN = Pattern.compile("<\\s*a\\s+href\\s*=\\s*(['\"])(.+?)\\1\\s*>(.+?)<\\s*/\\s*a\\s*>");
- static final Pattern LAZY_LINK_PATTERN = Pattern.compile("<\\s*a\\s+href\\s*=\\s*(['\"])(.+?)\\1\\s*/\\s*>");
-
- private HttpUtils() {}
-
- /**
- * Resolves a path against given {@link URI} and creates the resolved {@link URI}.
- * (i.e. base = "http://localhost" ; path = "/path/to/file" ; resolved = "http://localhost/path/to/file")
- * Handles all cases: if base already has a path, if path is relative, if path is absolute.
- *
- * @param base The base {@link URI} which the given path will be resolved against.
- * @param path The path to be resolved against the given {@link URI}
- * @return resolved {@link URI}.
- * @throws URISyntaxException
- */
- public static URI resolveUri(URI base, String path) throws URISyntaxException {
- Validate.notNull(base, "base URI must not be NULL");
- Validate.notNull(path, "resolve path must not be NULL");
- if (path.startsWith("http://")) {
- return new URI(path);
- } else if (path.startsWith("/")) {
- return new URI(base.getScheme() + "://" + base.getHost() + path);
- } else {
- if (base.toString().endsWith("/")) {
- return new URI(base.toString() + path);
- } else {
- return new URI(base.toString() + "/" + path);
- }
- }
- }
-
- public static HttpURLConnection connect(URL url) throws IOException {
- HttpURLConnection conn = (HttpURLConnection) url.openConnection();
- conn.connect();
- conn.getResponseMessage();
- return conn;
- }
-
- public static boolean checkForRedirection(URL beforeConnUrl, URL afterConnUrl) {
- return !beforeConnUrl.toString().equals(afterConnUrl.toString());
- }
-
- public static String readUrl(HttpURLConnection conn) throws IOException {
- // create URL source reader
- Scanner scanner = new Scanner(conn.getInputStream());
-
- // Read in link
- StringBuilder sb = new StringBuilder("");
- while (scanner.hasNext()) {
- sb.append(scanner.nextLine());
- }
-
- return sb.toString();
- }
-
- public static List<HttpFile> findLinks(HttpFile file) throws IOException, URISyntaxException {
- Matcher matcher = XHTML_LINK_PATTERN.matcher(HttpUtils.readUrl(connect(file.getLink())));
- List<HttpFile> httpFiles = new ArrayList<HttpFile>();
- while (matcher.find()) {
- String link = matcher.group(2).trim();
- String virtualPath = matcher.group(3).trim();
- URL url = resolveUri(file.getLink().toURI(), link).toURL();
- httpFiles.add(new HttpFile(file, link, isDirectory(url, virtualPath), url));
- }
- matcher = LAZY_LINK_PATTERN.matcher(HttpUtils.readUrl(connect(file.getLink())));
- while (matcher.find()) {
- String link = matcher.group(2).trim();
- URL url = resolveUri(file.getLink().toURI(), link).toURL();
- httpFiles.add(new HttpFile(file, link, isDirectory(url, link), url));
- }
- return httpFiles;
- }
-
- public static boolean isDirectory(URL url, String virtualPath) throws IOException {
- try {
- String mime = MIME_TYPES.autoResolveContentType(url.toString(),
- MimeTypeUtils.readMagicHeader(url.openStream()));
- return (mime.equals("text/html") && !virtualPath.endsWith(".html"));
- } catch (Exception e) {
- throw new IOException("URL does not exist '" + url + "'", e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/http/src/main/resources/policy/http-protocol-config.xml
----------------------------------------------------------------------
diff --git a/protocol/http/src/main/resources/policy/http-protocol-config.xml b/protocol/http/src/main/resources/policy/http-protocol-config.xml
deleted file mode 100644
index 3b96e58..0000000
--- a/protocol/http/src/main/resources/policy/http-protocol-config.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!--
-
- Author: bfoster
- Description: ProtocolManager Configuration
-
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:p="http://www.springframework.org/schema/p"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
- <bean class="org.apache.oodt.cas.protocol.http.HttpProtocolFactory"/>
-
-</beans>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/http/src/test/java/org/apache/oodt/cas/protocol/http/TestHttpFile.java
----------------------------------------------------------------------
diff --git a/protocol/http/src/test/java/org/apache/oodt/cas/protocol/http/TestHttpFile.java b/protocol/http/src/test/java/org/apache/oodt/cas/protocol/http/TestHttpFile.java
deleted file mode 100644
index f0ad7b4..0000000
--- a/protocol/http/src/test/java/org/apache/oodt/cas/protocol/http/TestHttpFile.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.http;
-
-//JUnit imports
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import junit.framework.TestCase;
-
-/**
- * Test class for {@link HttpFile}.
- *
- * @author bfoster
- */
-public class TestHttpFile extends TestCase {
-
- public void testInitialState() throws MalformedURLException {
- HttpFile parent = new HttpFile("/path/to", false, new URL("http://some-site"));
- HttpFile file = new HttpFile(parent, "/path/to/file", false, new URL("http://some-site"));
- assertNotNull(file.getLink());
- assertEquals("http://some-site", file.getLink().toString());
- assertFalse(file.isDir());
- assertFalse(file.isRelative());
- assertNotNull(file.getParent());
- assertEquals(parent, file.getParent());
- }
-
- public void testNullCase() throws MalformedURLException {
- try {
- new HttpFile(null, false, new URL("http://some-site"));
- fail("Should have thrown an IllegalArgumentException");
- } catch (IllegalArgumentException ignored) {}
- try {
- new HttpFile("/path/to/file", false, null);
- fail("Should have thrown an IllegalArgumentException");
- } catch (IllegalArgumentException ignored) {}
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/http/src/test/java/org/apache/oodt/cas/protocol/http/TestHttpProtocol.java
----------------------------------------------------------------------
diff --git a/protocol/http/src/test/java/org/apache/oodt/cas/protocol/http/TestHttpProtocol.java b/protocol/http/src/test/java/org/apache/oodt/cas/protocol/http/TestHttpProtocol.java
deleted file mode 100644
index 05a7c4f..0000000
--- a/protocol/http/src/test/java/org/apache/oodt/cas/protocol/http/TestHttpProtocol.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.http;
-
-//JUnit imports
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-import java.util.List;
-import java.util.Scanner;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.oodt.cas.protocol.ProtocolFile;
-import org.apache.oodt.cas.protocol.auth.NoAuthentication;
-import org.apache.oodt.cas.protocol.exceptions.ProtocolException;
-import org.apache.oodt.cas.protocol.http.util.HttpUtils;
-
-import junit.framework.TestCase;
-
-/**
- * Test class for {@link HttpProtocol}.
- *
- * @author bfoster
- */
-public class TestHttpProtocol extends TestCase {
-
- public void testConnection() throws InstantiationException, ProtocolException {
- HttpProtocol httpProtocol = new HttpProtocol();
- assertFalse(httpProtocol.connected());
- httpProtocol.connect("svn.apache.org", new NoAuthentication());
- assertTrue(httpProtocol.connected());
- }
-
- public void testLSandCD() throws ProtocolException, InstantiationException {
- HttpProtocol httpProtocol = new HttpProtocol();
- httpProtocol.connect("svn.apache.org", new NoAuthentication());
- assertTrue(httpProtocol.connected());
- httpProtocol.cd(new ProtocolFile("repos/asf/oodt/trunk/protocol/http/src/main/java/org/apache/oodt/cas/protocol/http", true));
- List<ProtocolFile> files = httpProtocol.ls();
- boolean foundFile = false;
- for (ProtocolFile file : files) {
- if (file.getName().equals("HttpProtocol.java")) {
- foundFile = true;
- break;
- }
- }
- assertTrue(foundFile);
- }
-
- public void testPWD() throws ProtocolException {
- HttpProtocol httpProtocol = new HttpProtocol();
- httpProtocol.connect("svn.apache.org", new NoAuthentication());
- assertTrue(httpProtocol.connected());
- ProtocolFile gotoDir = new ProtocolFile(httpProtocol.pwd(),
- "repos/asf/oodt/trunk/protocol/http/src/test/java/org/apache/oodt/cas/protocol/http", true);
- httpProtocol.cd(gotoDir);
- ProtocolFile currentDir = httpProtocol.pwd();
- System.out.println(gotoDir.getAbsoluteFile());
- System.out.println(currentDir.getAbsoluteFile());
- assertEquals(gotoDir, currentDir);
- }
-
- public void testGET() throws ProtocolException, IOException {
- HttpProtocol httpProtocol = new HttpProtocol();
- httpProtocol.connect("svn.apache.org", new NoAuthentication());
- assertTrue(httpProtocol.connected());
- httpProtocol.cd(new ProtocolFile("repos/asf/oodt/trunk/protocol/http/src/test/java/org/apache/oodt/cas"
- + "/protocol/http", true));
- File bogus = File.createTempFile("bogus", "bogus");
- File tmpDir = new File(bogus.getParentFile(), "TestHttpProtocol");
- bogus.delete();
- tmpDir.mkdirs();
- File toFile = new File(tmpDir, "TestHttpProtocol.java");
- httpProtocol.get(new ProtocolFile("TestHttpProtocol.java", false), toFile);
- assertTrue(toFile.exists());
- assertNotSame(0, toFile.length());
-
- String fileContent = "";
- Scanner scanner = new Scanner(toFile);
- while(scanner.hasNextLine()) {
- fileContent += scanner.nextLine();
- }
- assertEquals(fileContent, HttpUtils.readUrl(HttpUtils.connect(new URL("http://svn.apache.org/repos/asf/oodt/"
- + "trunk/protocol/http/src/test/java/org/"
- + "apache/oodt/cas/protocol/http/"
- + "TestHttpProtocol.java"))));
- FileUtils.forceDelete(tmpDir);
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/http/src/test/java/org/apache/oodt/cas/protocol/http/util/TestHttpUtils.java
----------------------------------------------------------------------
diff --git a/protocol/http/src/test/java/org/apache/oodt/cas/protocol/http/util/TestHttpUtils.java b/protocol/http/src/test/java/org/apache/oodt/cas/protocol/http/util/TestHttpUtils.java
deleted file mode 100644
index a6a16dc..0000000
--- a/protocol/http/src/test/java/org/apache/oodt/cas/protocol/http/util/TestHttpUtils.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.http.util;
-
-//JDK imports
-import java.io.IOException;
-import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.List;
-import java.util.regex.Matcher;
-
-//OODT imports
-import org.apache.oodt.cas.protocol.http.HttpFile;
-
-//JUnits imports
-import junit.framework.TestCase;
-
-/**
- * Test class for {@link HttpUtils}.
- *
- * @author bfoster
- */
-public class TestHttpUtils extends TestCase {
-
- private static final String APACHE_SVN_SITE = "http://svn.apache.org";
-
- private static final String PROTOCOL_HTTP_SVN_LOC = "/repos/asf/oodt/trunk/protocol/http";
- private static final String PARENT_URL_OF_THIS_TEST = PROTOCOL_HTTP_SVN_LOC +
- "/src/test/java/org/apache/oodt/cas/protocol/http/util";
- private static final String URL_OF_THIS_TEST = PARENT_URL_OF_THIS_TEST + "/TestHttpUtils.java";
-
- public void testResolveUri() throws URISyntaxException {
- URI baseUri = new URI("http://localhost/base/directory/");
-
- // Test absolute resolve.
- URI resolvedAbsoluteUri = HttpUtils.resolveUri(baseUri, "/path/to/file");
- assertEquals("http://localhost/path/to/file", resolvedAbsoluteUri.toString());
-
- // Test relative resolve.
- URI resolvedRelativeUri = HttpUtils.resolveUri(baseUri, "path/to/file");
- assertEquals("http://localhost/base/directory/path/to/file", resolvedRelativeUri.toString());
-
- // Test relative with base not ending in /
- baseUri = new URI("http://localhost/base/directory");
- assertEquals("http://localhost/base/directory/path/to/file", resolvedRelativeUri.toString());
- }
-
- public void testConnectUrl() throws IOException {
- HttpURLConnection conn = HttpUtils.connect(new URL(APACHE_SVN_SITE + URL_OF_THIS_TEST));
- assertNotSame(0, conn.getDate());
- String urlText = HttpUtils.readUrl(conn);
- assertTrue(urlText.contains("public class TestHttpUtils extends TestCase {"));
- conn.disconnect();
- }
-
- public void testRedirector() throws MalformedURLException {
- URL url = new URL("http://localhost:80");
- URL redirectedURL = new URL("http://localhost:8080");
- assertFalse(HttpUtils.checkForRedirection(url, url));
- assertTrue(HttpUtils.checkForRedirection(url, redirectedURL));
- }
-
- public void testXhtmlLinkPattern() {
- // SUCCESS cases
- Matcher matcher = HttpUtils.XHTML_LINK_PATTERN.matcher("<a href=\"http://localhost\">localhost</a>");
- assertTrue(matcher.find());
- assertEquals("\"", matcher.group(1).trim());
- assertEquals("http://localhost", matcher.group(2).trim());
- assertEquals("localhost", matcher.group(3).trim());
-
- matcher = HttpUtils.XHTML_LINK_PATTERN.matcher("<a href='http://localhost'>localhost</a>");
- assertTrue(matcher.find());
- assertEquals("'", matcher.group(1).trim());
- assertEquals("http://localhost", matcher.group(2).trim());
- assertEquals("localhost", matcher.group(3).trim());
-
- matcher = HttpUtils.XHTML_LINK_PATTERN.matcher("< a href = \" http://localhost \" > localhost < / a >");
- assertTrue(matcher.find());
- assertEquals("\"", matcher.group(1).trim());
- assertEquals("http://localhost", matcher.group(2).trim());
- assertEquals("localhost", matcher.group(3).trim());
-
- matcher = HttpUtils.XHTML_LINK_PATTERN.matcher("< a href = ' http://localhost ' > localhost < / a >");
- assertTrue(matcher.find());
- assertEquals("'", matcher.group(1).trim());
- assertEquals("http://localhost", matcher.group(2).trim());
- assertEquals("localhost", matcher.group(3).trim());
-
- //Should not find case: open with " end with '
- matcher = HttpUtils.XHTML_LINK_PATTERN.matcher("<a href=\"http://localhost\'>localhost</a>");
- assertFalse(matcher.find());
-
- //Should not find case: open with ' end with "
- matcher = HttpUtils.XHTML_LINK_PATTERN.matcher("<a href=\'http://localhost\">localhost</a>");
- assertFalse(matcher.find());
-
- //Should not find case: lazy link pattern
- matcher = HttpUtils.XHTML_LINK_PATTERN.matcher("<a href=\"http://localhost\"/>");
- assertFalse(matcher.find());
- }
-
- public void testLazyLinkPattern() {
- Matcher matcher = HttpUtils.LAZY_LINK_PATTERN.matcher("<a href=\"http://localhost\"/>");
- assertTrue(matcher.find());
- assertEquals("\"", matcher.group(1).trim());
- assertEquals("http://localhost", matcher.group(2).trim());
-
- matcher = HttpUtils.LAZY_LINK_PATTERN.matcher("<a href='http://localhost'/>");
- assertTrue(matcher.find());
- assertEquals("'", matcher.group(1).trim());
- assertEquals("http://localhost", matcher.group(2).trim());
-
- matcher = HttpUtils.LAZY_LINK_PATTERN.matcher("< a href = \" http://localhost \" / >");
- assertTrue(matcher.find());
- assertEquals("\"", matcher.group(1).trim());
- assertEquals("http://localhost", matcher.group(2).trim());
-
- matcher = HttpUtils.LAZY_LINK_PATTERN.matcher("< a href = ' http://localhost ' / >");
- assertTrue(matcher.find());
- assertEquals("'", matcher.group(1).trim());
- assertEquals("http://localhost", matcher.group(2).trim());
-
- //Should not find case: open with " end with '
- matcher = HttpUtils.LAZY_LINK_PATTERN.matcher("<a href=\"http://localhost\'/>");
- assertFalse(matcher.find());
-
- //Should not find case: open with ' end with "
- matcher = HttpUtils.LAZY_LINK_PATTERN.matcher("<a href=\'http://localhost\"/>");
- assertFalse(matcher.find());
-
- //Should not find case: xhtml link pattern
- matcher = HttpUtils.LAZY_LINK_PATTERN.matcher("<a href='http://localhost'>localhost</a>");
- assertFalse(matcher.find());
- }
-
- public void testFindLinks() throws IOException, URISyntaxException {
- URL url = new URL(APACHE_SVN_SITE + PARENT_URL_OF_THIS_TEST);
- HttpFile parent = new HttpFile(PARENT_URL_OF_THIS_TEST, true, url);
- HttpURLConnection conn = HttpUtils.connect(url);
- List<HttpFile> httpFiles = HttpUtils.findLinks(parent);
- boolean foundThisTest = false;
- for (HttpFile httpFile : httpFiles) {
- if (httpFile.getName().equals("TestHttpUtils.java")) {
- foundThisTest = true;
- break;
- }
- }
- assertTrue(foundThisTest);
- }
-
- public void testIsDirectory() throws IOException {
- assertTrue(HttpUtils.isDirectory(new URL(APACHE_SVN_SITE + PARENT_URL_OF_THIS_TEST), ""));
- assertFalse(HttpUtils.isDirectory(new URL(APACHE_SVN_SITE + URL_OF_THIS_TEST), ""));
- assertTrue(HttpUtils.isDirectory(new URL(APACHE_SVN_SITE), ""));
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/imaps/.gitignore
----------------------------------------------------------------------
diff --git a/protocol/imaps/.gitignore b/protocol/imaps/.gitignore
deleted file mode 100644
index b54523f..0000000
--- a/protocol/imaps/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/maven-eclipse.xml
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/imaps/pom.xml
----------------------------------------------------------------------
diff --git a/protocol/imaps/pom.xml b/protocol/imaps/pom.xml
deleted file mode 100644
index 9e54a1f..0000000
--- a/protocol/imaps/pom.xml
+++ /dev/null
@@ -1,114 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
- license agreements. See the NOTICE file distributed with this work for additional
- information regarding copyright ownership. The ASF licenses this file to
- You under the Apache License, Version 2.0 (the "License"); you may not use
- this file except in compliance with the License. You may obtain a copy of
- the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
- by applicable law or agreed to in writing, software distributed under the
- License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, either express or implied. See the License for the specific
- language governing permissions and limitations under the License. -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.oodt</groupId>
- <artifactId>oodt-core</artifactId>
- <version>1.1-SNAPSHOT</version>
- <relativePath>../../core/pom.xml</relativePath>
- </parent>
- <artifactId>cas-protocol-imaps</artifactId>
- <name>CAS Protocol IMAPS Implementation</name>
- <!-- All dependencies should be listed in core/pom.xml and be ordered alphabetically by package and artifact.
- Once the dependency is in the core pom, it can then be used in other modules without the version tags.
- For example, within core/pom.xml:
-
- <dependency>
- <groupId>com.amazonaws</groupId>
- <artifactId>aws-java-sdk</artifactId>
- <version>1.7.4</version>
- </dependency>
-
- Elsewhere in the platform:
- <dependency>
- <groupId>com.amazonaws</groupId>
- <artifactId>aws-java-sdk</artifactId>
- </dependency>
-
- Where possible the same dependency version should be used across the whole platform but if required the version
- can be overridden in a specific pom and should have a comment explaing why the version has been overridden
- -->
- <dependencies>
- <dependency>
- <groupId>com.icegreen</groupId>
- <artifactId>greenmail</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.javamail</groupId>
- <artifactId>geronimo-javamail_1.4_mail</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-activation_1.1_spec</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.oodt</groupId>
- <artifactId>cas-protocol-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.tika</groupId>
- <artifactId>tika-parsers</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- </dependency>
- </dependencies>
- <build>
- <resources>
- <resource>
- <targetPath>org/apache/oodt/cas/protocol/imaps</targetPath>
- <directory>${basedir}/src/main/resources/policy</directory>
- <includes>
- <include>imaps-protocol-config.xml</include>
- </includes>
- </resource>
- </resources>
- </build>
- <profiles>
- <profile>
- <id>audit</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>rat-maven-plugin</artifactId>
- <configuration>
- <excludes>
- <exclude>**/resources/examples/**/*</exclude>
- </excludes>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>check</goal>
- </goals>
- <phase>verify</phase>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-</project>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/imaps/src/main/java/org/apache/oodt/cas/protocol/imaps/ImapsProtocol.java
----------------------------------------------------------------------
diff --git a/protocol/imaps/src/main/java/org/apache/oodt/cas/protocol/imaps/ImapsProtocol.java b/protocol/imaps/src/main/java/org/apache/oodt/cas/protocol/imaps/ImapsProtocol.java
deleted file mode 100644
index ce47398..0000000
--- a/protocol/imaps/src/main/java/org/apache/oodt/cas/protocol/imaps/ImapsProtocol.java
+++ /dev/null
@@ -1,385 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.imaps;
-
-//JDK imports
-import org.apache.oodt.cas.protocol.Protocol;
-import org.apache.oodt.cas.protocol.ProtocolFile;
-import org.apache.oodt.cas.protocol.auth.Authentication;
-import org.apache.oodt.cas.protocol.exceptions.ProtocolException;
-import org.apache.oodt.cas.protocol.util.ProtocolFileFilter;
-import org.apache.tika.exception.TikaException;
-import org.apache.tika.metadata.Metadata;
-import org.apache.tika.parser.html.HtmlParser;
-import org.apache.tika.sax.BodyContentHandler;
-import org.apache.tika.sax.TextContentHandler;
-
-import org.xml.sax.SAXException;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.PrintStream;
-import java.util.Arrays;
-import java.util.Enumeration;
-import java.util.LinkedHashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
-import javax.mail.Address;
-import javax.mail.Flags;
-import javax.mail.Folder;
-import javax.mail.Header;
-import javax.mail.Message;
-import javax.mail.MessagingException;
-import javax.mail.Multipart;
-import javax.mail.Part;
-import javax.mail.Session;
-import javax.mail.Store;
-
-
-/**
- * IMAP Secure {@link Protocol} implementation
- *
- * @author bfoster
- * @version $Revision$
- */
-public class ImapsProtocol implements Protocol {
-
- static Store store;
-
- static Folder currentFolder;
-
- static Folder homeFolder;
-
- static int port = 993;
-
- static Session session;
-
- static int openCalls = 0;
-
- static int connectCalls = 0;
-
- public synchronized void cd(ProtocolFile file) throws ProtocolException {
- try {
- String remotePath = file.getPath();
- if (remotePath.startsWith("/")) {
- remotePath = remotePath.substring(1);
- }
- if (remotePath.trim().equals("")) {
- homeFolder = currentFolder = store.getDefaultFolder();
- } else {
- homeFolder = currentFolder = store.getFolder(remotePath);
- }
- } catch (Exception e) {
- throw new ProtocolException("Failed to change directory to '"
- + file + "' : " + e.getMessage(), e);
- }
- }
-
- public synchronized void cdRoot() throws ProtocolException {
- try {
- cd(new ProtocolFile("/", true));
- } catch (Exception e) {
- throw new ProtocolException("Failed to cd to root : " + e.getMessage(), e);
- }
- }
-
- public synchronized void cdHome() throws ProtocolException {
- try {
- cd(new ProtocolFile("", true));
- } catch (Exception e) {
- throw new ProtocolException("Failed to cd to home : " + e.getMessage(), e);
- }
- }
-
- public synchronized void connect(String host, Authentication auth)
- throws ProtocolException {
- try {
- if (store == null) {
- store = (session = Session.getInstance(System.getProperties()))
- .getStore("imaps");
- store.connect(host, port, auth.getUser(), auth.getPass());
- currentFolder = store.getDefaultFolder();
- }
- this.incrementConnections();
- } catch (Exception e) {
- throw new ProtocolException("Failed to connected to IMAPS server " + host
- + " with username " + auth.getUser() + " : " + e.getMessage(), e);
- }
- }
-
- public synchronized void close() throws ProtocolException {
- decrementConnections();
- if (connectCalls <= 0) {
- try {
- store.close();
- } catch (Exception e) {
- throw new ProtocolException("Failed to close connection : " + e.getMessage(), e);
- } finally {
- store = null;
- }
- }
- }
-
- private synchronized void incrementConnections() {
- connectCalls++;
- }
-
- private synchronized void decrementConnections() {
- if (connectCalls > 0) {
- connectCalls--;
- }
- }
-
- public synchronized void get(ProtocolFile fromFile, File toFile)
- throws ProtocolException {
- try {
- openFolder(currentFolder);
- Message[] messages = currentFolder.getMessages();
- for (Message message : messages) {
- if (this.getMessageName(message).equals(fromFile.getName())) {
- writeMessageToLocalFile(message, toFile);
- break;
- }
- }
- } catch (Exception e) {
- throw new ProtocolException("Failed to download " + fromFile + " to "
- + toFile + " : " + e.getMessage(), e);
- } finally {
- try {
- closeFolder(currentFolder);
- } catch (Exception ignored) {
- }
- }
- }
-
- public synchronized void put(File fromFile, ProtocolFile toFile) {
- //do nothing;
- }
-
- private void writeMessageToLocalFile(Message message, File toLocalFile)
- throws MessagingException, IOException, SAXException,
- TikaException {
- PrintStream ps = new PrintStream(new FileOutputStream(toLocalFile));
-
- ps.print("From:");
- Address[] senders = message.getFrom();
- for (Address address : senders) {
- ps.print(" " + address.toString());
- }
-
- ps.print("\nTo:");
- Set<Address> recipients = new LinkedHashSet<Address>(Arrays.asList(message
- .getAllRecipients()));
- for (Address address : recipients) {
- ps.print(" " + address.toString());
- }
-
- ps.println("\nSubject: " + message.getSubject());
-
- ps.println("----- ~ Message ~ -----");
- String content = this.getContentFromHTML(message);
- if (content.equals("")) {
- content = this.getContentFromPlainText(message);
- }
- ps.println(content);
-
- ps.close();
- }
-
- public synchronized boolean connected() {
- return store.isConnected();
- }
-
- public List<ProtocolFile> ls() throws ProtocolException {
- LinkedList<ProtocolFile> currentFilesForCurrentFolder = new LinkedList<ProtocolFile>();
- try {
- openFolder(currentFolder);
- if (!currentFolder.getFullName().equals(
- store.getDefaultFolder().getFullName())) {
- Message[] messages = currentFolder.getMessages();
- for (Message message : messages) {
- currentFilesForCurrentFolder.add(new ProtocolFile(this.pwd().getPath()
- + "/" + this.getMessageName(message), false));
- }
- }
- // changedDir = false;
- } catch (Exception e) {
- if (!currentFolder.getFullName().equals("")) {
- throw new ProtocolException("Failed to ls : " + e.getMessage(), e);
- }
- } finally {
- try {
- closeFolder(currentFolder);
- } catch (Exception ignored) {
- }
- }
- // }
- return currentFilesForCurrentFolder;
- }
-
- public List<ProtocolFile> ls(ProtocolFileFilter filter)
- throws ProtocolException {
- LinkedList<ProtocolFile> currentFilesForCurrentFolder = new LinkedList<ProtocolFile>();
- try {
- openFolder(currentFolder);
- if (!currentFolder.getFullName().equals(
- store.getDefaultFolder().getFullName())) {
- Message[] messages = currentFolder.getMessages();
- for (Message message : messages) {
- ProtocolFile pFile = new ProtocolFile(this.pwd().getPath()
- + "/" + this.getMessageName(message), false);
- if (filter.accept(pFile)) {
- currentFilesForCurrentFolder.add(pFile);
- }
- }
- }
- } catch (Exception e) {
- if (!currentFolder.getFullName().equals("")) {
- throw new ProtocolException("Failed to ls : " + e.getMessage(), e);
- }
- } finally {
- try {
- closeFolder(currentFolder);
- } catch (Exception ignored) {
- }
- }
- return currentFilesForCurrentFolder;
- }
-
- public synchronized ProtocolFile pwd()
- throws ProtocolException {
- try {
- String pwd = currentFolder.getFullName();
- if (!pwd.equals("") && !pwd.startsWith("/")) {
- pwd = "/" + pwd;
- }
- return new ProtocolFile(pwd, true);
- } catch (Exception e) {
- throw new ProtocolException("Failed to pwd : " + e.getMessage(), e);
- }
- }
-
- private String getMessageName(Message msg) throws MessagingException {
- Enumeration headers = msg.getAllHeaders();
- while (headers.hasMoreElements()) {
- Header header = (Header) headers.nextElement();
- if (header.getName().toLowerCase().equals("message-id")) {
- String stringHeader = header.getValue();
- stringHeader = stringHeader.replace("<", "");
- return stringHeader.substring(0, stringHeader.indexOf("@"));
- }
- }
- return null;
- }
-
- private String getContentFromPlainText(Part p) throws MessagingException,
- IOException {
- StringBuilder content = new StringBuilder("");
- if (p.isMimeType("text/plain")) {
- content.append((String) p.getContent());
- } else if (p.isMimeType("multipart/*")) {
- Multipart mp = (Multipart) p.getContent();
- int count = mp.getCount();
- for (int i = 0; i < count; i++) {
- content.append(getContentFromPlainText(mp.getBodyPart(i)));
- }
- } else {
- Object obj = p.getContent();
- if (obj instanceof Part) {
- content.append(getContentFromPlainText((Part) p.getContent()));
- }
- }
- return content.toString().replaceAll(" \\r\\n", "").replaceAll(" \\n", "");
- }
-
- private String getContentFromHTML(Part p) throws MessagingException,
- IOException, SAXException, TikaException {
- StringBuilder content = new StringBuilder("");
- if (p.isMimeType("multipart/*")) {
- Multipart mp = (Multipart) p.getContent();
- int count = mp.getCount();
- for (int i = 0; i < count; i++) {
- content.append(getContentFromHTML(mp.getBodyPart(i)));
- }
- } else if (p.isMimeType("text/html")) {
- HtmlParser parser = new HtmlParser();
- Metadata met = new Metadata();
- TextContentHandler handler = new TextContentHandler(
- new BodyContentHandler());
- parser.parse(new ByteArrayInputStream(((String) p.getContent())
- .getBytes()), handler, met);
- content.append(handler.toString());
- } else {
- Object obj = p.getContent();
- if (obj instanceof Part) {
- content.append(getContentFromHTML((Part) p.getContent()));
- }
- }
- return content.toString();
- }
-
- private synchronized void openFolder(Folder folder) throws ProtocolException {
- if (!folder.isOpen()) {
- try {
- folder.open(Folder.READ_WRITE);
- } catch (Exception e) {
- try {
- folder.open(Folder.READ_ONLY);
- } catch (Exception e2) {
- throw new ProtocolException("Failed to open folder : "
- + e.getMessage() + " : " + e2.getMessage());
- }
- }
- }
- openCalls++;
- }
-
- private synchronized void closeFolder(Folder folder) {
- if (openCalls > 0) {
- openCalls--;
- }
-
- if (openCalls <= 0) {
- try {
- folder.close(true);
- } catch (Exception ignored) {
- }
- }
- }
-
- public synchronized void delete(ProtocolFile file) throws ProtocolException {
- try {
- openFolder(currentFolder);
- Message[] messages = currentFolder.getMessages();
- for (Message message : messages) {
- if (this.getMessageName(message).equals(file.getName())) {
- message.setFlag(Flags.Flag.DELETED, true);
- break;
- }
- }
- } catch (Exception e) {
- throw new ProtocolException("Failed to delete file '" + file + "' : " + e.getMessage(), e);
- } finally {
- closeFolder(currentFolder);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/imaps/src/main/java/org/apache/oodt/cas/protocol/imaps/ImapsProtocolFactory.java
----------------------------------------------------------------------
diff --git a/protocol/imaps/src/main/java/org/apache/oodt/cas/protocol/imaps/ImapsProtocolFactory.java b/protocol/imaps/src/main/java/org/apache/oodt/cas/protocol/imaps/ImapsProtocolFactory.java
deleted file mode 100644
index b3a83b9..0000000
--- a/protocol/imaps/src/main/java/org/apache/oodt/cas/protocol/imaps/ImapsProtocolFactory.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.imaps;
-
-//OODT imports
-import org.apache.oodt.cas.protocol.ProtocolFactory;
-
-/**
- * Factory for creating {@link ImapsProtocol}s.
- *
- * @author bfoster
- * @version $Revision$
- */
-public class ImapsProtocolFactory implements ProtocolFactory {
-
- private ImapsProtocol imapsClient;
-
- public ImapsProtocol newInstance() {
- if (this.imapsClient == null) {
- this.imapsClient = new ImapsProtocol();
- }
- return this.imapsClient;
- }
-
- public String getSchema() {
- return "imaps";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/imaps/src/main/resources/policy/imaps-protocol-config.xml
----------------------------------------------------------------------
diff --git a/protocol/imaps/src/main/resources/policy/imaps-protocol-config.xml b/protocol/imaps/src/main/resources/policy/imaps-protocol-config.xml
deleted file mode 100644
index da206b4..0000000
--- a/protocol/imaps/src/main/resources/policy/imaps-protocol-config.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!--
-
- Author: bfoster
- Description: ProtocolManager Configuration
-
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:p="http://www.springframework.org/schema/p"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
- <bean class="org.apache.oodt.cas.protocol.imaps.ImapsProtocolFactory"/>
-
-</beans>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/imaps/src/test/java/org/apache/oodt/cas/protocol/imaps/TestImapsProtocol.java
----------------------------------------------------------------------
diff --git a/protocol/imaps/src/test/java/org/apache/oodt/cas/protocol/imaps/TestImapsProtocol.java b/protocol/imaps/src/test/java/org/apache/oodt/cas/protocol/imaps/TestImapsProtocol.java
deleted file mode 100644
index f2b78b3..0000000
--- a/protocol/imaps/src/test/java/org/apache/oodt/cas/protocol/imaps/TestImapsProtocol.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.imaps;
-
-//JDK imports
-import java.io.File;
-import java.io.IOException;
-import java.util.List;
-
-//Apache imports
-import org.apache.commons.io.FileUtils;
-
-//OODT imports
-import org.apache.oodt.cas.protocol.ProtocolFile;
-import org.apache.oodt.cas.protocol.auth.BasicAuthentication;
-import org.apache.oodt.cas.protocol.exceptions.ProtocolException;
-
-//GreenMail imports
-import com.icegreen.greenmail.util.DummySSLSocketFactory;
-import com.icegreen.greenmail.util.GreenMail;
-import com.icegreen.greenmail.util.GreenMailUtil;
-
-//JUnit imports
-import junit.framework.TestCase;
-
-/**
- * Test class for {@link ImapsProtocol}.
- *
- * @author bfoster
- */
-public class TestImapsProtocol extends TestCase {
-
- private GreenMail gMail;
- private ImapsProtocol imapsProtocol;
-
- @Override
- public void setUp() {
- System.setProperty("mail.imaps.socketFactory.class", DummySSLSocketFactory.class.getCanonicalName());
- System.setProperty("mail.imaps.socketFactory.fallback", "false");
- gMail = new GreenMail();
- gMail.setUser("bfoster@google.com", "password");
- gMail.start();
- ImapsProtocol.port = gMail.getImaps().getPort();
- imapsProtocol = new ImapsProtocol();
- try {
- imapsProtocol.connect("localhost", new BasicAuthentication("bfoster@google.com", "password"));
- } catch (ProtocolException e) {
- fail("Failed to connect to GreenMail IMAPS server : " + e.getMessage());
- }
- assertEquals(1, ImapsProtocol.connectCalls);
- }
-
- @Override
- public void tearDown() {
- gMail.stop();
- try {
- imapsProtocol.close();
- } catch (Exception ignored) {}
- assertEquals(0, ImapsProtocol.connectCalls);
- }
-
- public void testCDAndPWD() throws ProtocolException {
- assertEquals("", imapsProtocol.pwd().getPath());
- imapsProtocol.cd(new ProtocolFile("INBOX", true));
- assertEquals("/INBOX", imapsProtocol.pwd().getPath());
- }
-
- public void testLSandGET() throws ProtocolException, IOException {
- GreenMailUtil.sendTextEmailSecureTest("bfoster@google.com", "tom@bumster.org", "Test Subject", "Test Body");
- imapsProtocol.cd(new ProtocolFile("INBOX", true));
- List<ProtocolFile> emails = imapsProtocol.ls();
- assertEquals(1, emails.size());
- File bogusFile = File.createTempFile("bogus", "bogus");
- File tmpDir = new File(bogusFile.getParentFile(), "TestImapsProtocol");
- bogusFile.delete();
- tmpDir.mkdirs();
-
- File email = new File(tmpDir, "test-email");
- imapsProtocol.get(emails.get(0), email);
- String[] splitEmail = FileUtils.readFileToString(email, "UTF-8").split("\n");
- assertEquals("From: tom@bumster.org", splitEmail[0]);
- assertEquals("To: bfoster@google.com", splitEmail[1]);
- assertEquals("Subject: Test Subject", splitEmail[2]);
- // 3 is divider text (i.e. ----- ~ Message ~ -----)
- assertEquals("Test Body", splitEmail[4]);
- tmpDir.delete();
- }
-
- public void testDelete() throws ProtocolException {
- GreenMailUtil.sendTextEmailSecureTest("bfoster@google.com", "tom@bumster.org", "Test Subject", "Test Body");
- imapsProtocol.cd(new ProtocolFile("INBOX", true));
- List<ProtocolFile> emails = imapsProtocol.ls();
- assertEquals(1, emails.size());
- imapsProtocol.delete(emails.get(0));
- emails = imapsProtocol.ls();
- assertEquals(0, emails.size());
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/sftp/.gitignore
----------------------------------------------------------------------
diff --git a/protocol/sftp/.gitignore b/protocol/sftp/.gitignore
deleted file mode 100644
index b54523f..0000000
--- a/protocol/sftp/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/maven-eclipse.xml
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/sftp/pom.xml
----------------------------------------------------------------------
diff --git a/protocol/sftp/pom.xml b/protocol/sftp/pom.xml
deleted file mode 100644
index 71ab9df..0000000
--- a/protocol/sftp/pom.xml
+++ /dev/null
@@ -1,140 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
- license agreements. See the NOTICE file distributed with this work for additional
- information regarding copyright ownership. The ASF licenses this file to
- You under the Apache License, Version 2.0 (the "License"); you may not use
- this file except in compliance with the License. You may obtain a copy of
- the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
- by applicable law or agreed to in writing, software distributed under the
- License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, either express or implied. See the License for the specific
- language governing permissions and limitations under the License. -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.oodt</groupId>
- <artifactId>oodt-core</artifactId>
- <version>1.1-SNAPSHOT</version>
- <relativePath>../../core/pom.xml</relativePath>
- </parent>
- <artifactId>cas-protocol-sftp</artifactId>
- <name>CAS Protocol SFTP Implementation</name>
- <!-- All dependencies should be listed in core/pom.xml and be ordered alphabetically by package and artifact.
- Once the dependency is in the core pom, it can then be used in other modules without the version tags.
- For example, within core/pom.xml:
-
- <dependency>
- <groupId>com.amazonaws</groupId>
- <artifactId>aws-java-sdk</artifactId>
- <version>1.7.4</version>
- </dependency>
-
- Elsewhere in the platform:
- <dependency>
- <groupId>com.amazonaws</groupId>
- <artifactId>aws-java-sdk</artifactId>
- </dependency>
-
- Where possible the same dependency version should be used across the whole platform but if required the version
- can be overridden in a specific pom and should have a comment explaing why the version has been overridden
- -->
- <dependencies>
- <dependency>
- <groupId>com.jcraft</groupId>
- <artifactId>jsch</artifactId>
- <version>0.1.42</version>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.0.3</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.2</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.mina</groupId>
- <artifactId>mina-core</artifactId>
- <version>2.0.4</version>
- </dependency>
- <dependency>
- <groupId>org.apache.oodt</groupId>
- <artifactId>cas-protocol-api</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-all</artifactId>
- <version>1.3</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <version>1.9.5</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>sshtools</groupId>
- <artifactId>j2ssh-core</artifactId>
- <version>0.2.9</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>sshtools</groupId>
- <artifactId>j2ssh-daemon</artifactId>
- <version>0.2.9</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
- <build>
- <resources>
- <resource>
- <targetPath>org/apache/oodt/cas/protocol/sftp</targetPath>
- <directory>${basedir}/src/main/resources/policy</directory>
- <includes>
- <include>sftp-protocol-config.xml</include>
- </includes>
- </resource>
- </resources>
- </build>
- <profiles>
- <profile>
- <id>audit</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>rat-maven-plugin</artifactId>
- <configuration>
- <excludes>
- <exclude>**/resources/examples/**/*</exclude>
- </excludes>
- <numUnapprovedLicenses>3</numUnapprovedLicenses>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>check</goal>
- </goals>
- <phase>verify</phase>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-</project>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/sftp/src/main/java/org/apache/oodt/cas/protocol/sftp/JschSftpProtocol.java
----------------------------------------------------------------------
diff --git a/protocol/sftp/src/main/java/org/apache/oodt/cas/protocol/sftp/JschSftpProtocol.java b/protocol/sftp/src/main/java/org/apache/oodt/cas/protocol/sftp/JschSftpProtocol.java
deleted file mode 100644
index 1ddbe45..0000000
--- a/protocol/sftp/src/main/java/org/apache/oodt/cas/protocol/sftp/JschSftpProtocol.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.sftp;
-
-//OODT imports
-import org.apache.oodt.cas.protocol.auth.Authentication;
-import org.apache.oodt.cas.protocol.exceptions.ProtocolException;
-import org.apache.oodt.cas.protocol.sftp.auth.HostKeyAuthentication;
-import org.apache.oodt.cas.protocol.util.ProtocolFileFilter;
-import org.apache.oodt.cas.protocol.Protocol;
-import org.apache.oodt.cas.protocol.ProtocolFile;
-
-//JSCH imports
-import com.jcraft.jsch.ChannelSftp;
-import com.jcraft.jsch.JSch;
-import com.jcraft.jsch.Session;
-import com.jcraft.jsch.UserInfo;
-
-//JDK imports
-import java.io.File;
-import java.util.List;
-import java.util.Vector;
-
-/**
- *
- * An implement of an SFTP provider based on <a
- * href="http://www.jcraft.org">Jcraft's</a> <a
- * href="http://www.jcraft.org/jsch/">JSCH</a> library.
- *
- * @author bfoster
- * @version $Revision$
- */
-public class JschSftpProtocol implements Protocol {
-
- public static final int PORT = 22;
- private Session session;
-
- private ChannelSftp sftpChannel;
-
- private ProtocolFile homeDir;
-
- private int port;
-
- private static final JSch jsch = new JSch();
-
- public JschSftpProtocol() {
- this(PORT);
- }
-
- public JschSftpProtocol(int port) {
- session = null;
- sftpChannel = null;
- this.port = port;
- }
-
- public void cd(ProtocolFile file) throws ProtocolException {
- try {
- sftpChannel.cd(file.getPath());
- } catch (Exception e) {
- throw new ProtocolException("Failed to cd to " + file + " : "
- + e.getMessage());
- }
- }
-
- public void cdRoot() throws ProtocolException {
- cd(new ProtocolFile(ProtocolFile.SEPARATOR, true));
- }
-
- public void cdHome() throws ProtocolException {
- cd(homeDir);
- }
-
- public void connect(String host, final Authentication auth) throws ProtocolException {
- try {
- if (auth instanceof HostKeyAuthentication) {
- jsch.setKnownHosts(((HostKeyAuthentication) auth).getHostKeyFile());
- } else {
- jsch.setKnownHosts(System.getProperty("user.home") + "/.ssh/known_hosts");
- }
- session = jsch.getSession(auth.getUser(), host, this.port);
- session.setUserInfo(new UserInfo() {
- public String getPassphrase() {
- return (auth instanceof HostKeyAuthentication) ? ((HostKeyAuthentication) auth)
- .getPassphrase() : null;
- }
- public String getPassword() {
- return auth.getPass();
- }
- public boolean promptPassphrase(String arg0) {
- return (auth instanceof HostKeyAuthentication && ((HostKeyAuthentication) auth)
- .getPassphrase() != null);
- }
- public boolean promptPassword(String arg0) {
- return true;
- }
- public boolean promptYesNo(String arg0) {
- return false;
- }
- public void showMessage(String arg0) {}
- });
- session.connect();
- sftpChannel = (ChannelSftp) session.openChannel("sftp");
- sftpChannel.connect();
- homeDir = pwd();
- } catch (Exception e) {
- throw new ProtocolException("Failed to connect to host " + host + " : "
- + e.getMessage(), e);
- }
- }
-
- public void close() throws ProtocolException {
- session.disconnect();
- }
-
- public void get(ProtocolFile fromFile, File toFile)
- throws ProtocolException {
- try {
- sftpChannel.get(fromFile.getPath(), toFile
- .getAbsolutePath());
- } catch (Exception e) {
- throw new ProtocolException("Failed to download " + fromFile + " : "
- + e.getMessage());
- }
- }
-
- public void put(File fromFile, ProtocolFile toFile) throws ProtocolException {
- try {
- sftpChannel.put(fromFile.getAbsolutePath(), toFile.getPath());
- } catch (Exception e) {
- throw new ProtocolException("Failed to put file '" + fromFile + "' : " + e.getMessage(), e);
- }
- }
-
- public List<ProtocolFile> ls() throws ProtocolException {
- try {
- Vector<ChannelSftp.LsEntry> sftpFiles = (Vector<ChannelSftp.LsEntry>) sftpChannel
- .ls(sftpChannel.pwd());
- Vector<ProtocolFile> returnFiles = new Vector<ProtocolFile>();
- for (ChannelSftp.LsEntry sftpFile : sftpFiles) {
- String path = this.pwd().getPath();
- returnFiles.add(new ProtocolFile(path + "/" + sftpFile.getFilename(), sftpFile
- .getAttrs().isDir()));
- }
- return returnFiles;
- } catch (Exception e) {
- throw new ProtocolException("Failed to get file list : " + e.getMessage());
- }
- }
-
- public List<ProtocolFile> ls(ProtocolFileFilter filter)
- throws ProtocolException {
- try {
- Vector<ChannelSftp.LsEntry> sftpFiles = (Vector<ChannelSftp.LsEntry>) sftpChannel
- .ls(sftpChannel.pwd());
- Vector<ProtocolFile> returnFiles = new Vector<ProtocolFile>();
- for (ChannelSftp.LsEntry sftpFile : sftpFiles) {
- String path = this.pwd().getPath();
- ProtocolFile pFile = new ProtocolFile(path + "/" + sftpFile.getFilename(), sftpFile
- .getAttrs().isDir());
- if (filter.accept(pFile)) {
- returnFiles.add(pFile);
- }
- }
- return returnFiles;
- } catch (Exception e) {
- throw new ProtocolException("Failed to get file list : " + e.getMessage());
- }
- }
-
- public ProtocolFile pwd() throws ProtocolException {
- try {
- return new ProtocolFile(sftpChannel.pwd(), true);
- } catch (Exception e) {
- throw new ProtocolException("Failed to pwd : " + e.getMessage());
- }
- }
-
- public boolean connected() {
- return session.isConnected();
- }
-
- public void delete(ProtocolFile file) throws ProtocolException {
- try {
- if (file.isDir()) {
- sftpChannel.rmdir(file.getPath());
- } else {
- sftpChannel.rm(file.getPath());
- }
- } catch (Exception e) {
- throw new ProtocolException("Failed to download file '" + file + "' : " + e.getMessage(), e);
- }
- }
-
- public JschSftpProtocol createJschSftpProtocol(int port){
- return new JschSftpProtocol(port);
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/sftp/src/main/java/org/apache/oodt/cas/protocol/sftp/JschSftpProtocolFactory.java
----------------------------------------------------------------------
diff --git a/protocol/sftp/src/main/java/org/apache/oodt/cas/protocol/sftp/JschSftpProtocolFactory.java b/protocol/sftp/src/main/java/org/apache/oodt/cas/protocol/sftp/JschSftpProtocolFactory.java
deleted file mode 100644
index c36829a..0000000
--- a/protocol/sftp/src/main/java/org/apache/oodt/cas/protocol/sftp/JschSftpProtocolFactory.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.sftp;
-
-//OODT imports
-import org.apache.oodt.cas.protocol.ProtocolFactory;
-
-/**
- * Creates new {@link JschSftpProtocol}s.
- *
- * @author bfoster
- * @author mattmann
- * @version $Revision$
- */
-public class JschSftpProtocolFactory implements ProtocolFactory {
-
- private int port = -1;
-
- public JschSftpProtocol newInstance() {
- if (port > 0) {
- return new JschSftpProtocol(port);
- } else {
- return new JschSftpProtocol();
- }
- }
-
- public String getSchema() {
- return "sftp";
- }
-
- public void setPort(int port) {
- this.port = port;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/sftp/src/main/java/org/apache/oodt/cas/protocol/sftp/auth/HostKeyAuthentication.java
----------------------------------------------------------------------
diff --git a/protocol/sftp/src/main/java/org/apache/oodt/cas/protocol/sftp/auth/HostKeyAuthentication.java b/protocol/sftp/src/main/java/org/apache/oodt/cas/protocol/sftp/auth/HostKeyAuthentication.java
deleted file mode 100644
index 0384734..0000000
--- a/protocol/sftp/src/main/java/org/apache/oodt/cas/protocol/sftp/auth/HostKeyAuthentication.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.sftp.auth;
-
-//OODT imports
-import org.apache.oodt.cas.protocol.auth.BasicAuthentication;
-
-/**
- * {@link Authentication} implementation allowing a SSH host key file to be specified.
- *
- * @author bfoster
- */
-public class HostKeyAuthentication extends BasicAuthentication {
-
- private String hostKeyFile;
- private String passphrase;
-
- public HostKeyAuthentication(String user, String pass, String hostKeyFile) {
- this(user, pass, hostKeyFile, null);
- }
-
- public HostKeyAuthentication(String user, String pass, String hostKeyFile, String passphrase) {
- super(user, pass);
- this.hostKeyFile = hostKeyFile;
- this.passphrase = passphrase;
- }
-
- public String getHostKeyFile() {
- return hostKeyFile;
- }
-
- public String getPassphrase() {
- return passphrase;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/sftp/src/main/resources/policy/sftp-protocol-config.xml
----------------------------------------------------------------------
diff --git a/protocol/sftp/src/main/resources/policy/sftp-protocol-config.xml b/protocol/sftp/src/main/resources/policy/sftp-protocol-config.xml
deleted file mode 100644
index de44a3f..0000000
--- a/protocol/sftp/src/main/resources/policy/sftp-protocol-config.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-http://www.apache.org/licenses/LICENSE-2.0
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:p="http://www.springframework.org/schema/p"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
- <bean class="org.apache.oodt.cas.protocol.sftp.JschSftpProtocolFactory"/>
-
-</beans>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/DummyAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/DummyAuthenticationProvider.java b/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/DummyAuthenticationProvider.java
deleted file mode 100644
index 61da8ec..0000000
--- a/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/DummyAuthenticationProvider.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.sftp;
-
-//JDK imports
-import java.io.File;
-import java.io.IOException;
-
-//Apache imports
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-//SshTools imports
-import com.sshtools.daemon.platform.NativeAuthenticationProvider;
-import com.sshtools.daemon.platform.PasswordChangeException;
-
-/**
- * This authentication provider provides no authentication at all, and just lets
- * anybody in so you should never use it!
- *
- * It is really just for testing.
- */
-public class DummyAuthenticationProvider extends NativeAuthenticationProvider {
-
- Log log = LogFactory.getLog(DummyAuthenticationProvider.class);
-
- public DummyAuthenticationProvider() {
- log.error("DummyAuthenticationProvider is in use. This is only for testing.");
- }
-
- @Override
- public boolean changePassword(String username, String oldpassword,
- String newpassword) {
- return false;
- }
-
- @Override
- public String getHomeDirectory(String username) throws IOException {
- return new File("src/test/resources").getAbsolutePath();
- }
-
- @Override
- public void logoffUser() throws IOException {
-
- }
-
- @Override
- public boolean logonUser(String username, String password)
- throws PasswordChangeException, IOException {
- return true;
- }
-
- @Override
- public boolean logonUser(String username) throws IOException {
- return true;
- }
-}
[22/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/opendapps/src/main/java/org/apache/oodt/opendapps/util/ProfileUtils.java
----------------------------------------------------------------------
diff --git a/opendapps/src/main/java/org/apache/oodt/opendapps/util/ProfileUtils.java b/opendapps/src/main/java/org/apache/oodt/opendapps/util/ProfileUtils.java
deleted file mode 100644
index 8ed95f9..0000000
--- a/opendapps/src/main/java/org/apache/oodt/opendapps/util/ProfileUtils.java
+++ /dev/null
@@ -1,421 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.opendapps.util;
-
-import org.apache.oodt.cas.metadata.Metadata;
-import org.apache.oodt.cas.metadata.util.PathUtils;
-import org.apache.oodt.opendapps.OpendapProfileElementExtractor;
-import org.apache.oodt.opendapps.config.ConstantSpec;
-import org.apache.oodt.opendapps.config.DatasetMetElem;
-import org.apache.oodt.opendapps.config.OpendapConfig;
-import org.apache.oodt.opendapps.config.RewriteSpec;
-import org.apache.oodt.profile.EnumeratedProfileElement;
-import org.apache.oodt.profile.Profile;
-import org.apache.oodt.profile.ProfileAttributes;
-import org.apache.oodt.profile.ProfileElement;
-import org.apache.oodt.profile.ResourceAttributes;
-
-import org.springframework.util.StringUtils;
-
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.Enumeration;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.TimeZone;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import opendap.dap.BaseType;
-import opendap.dap.DArray;
-import opendap.dap.DConnect;
-import opendap.dap.DDS;
-import opendap.dap.DGrid;
-
-import static org.apache.oodt.opendapps.config.OpendapConfigMetKeys.*;
-
-//JDK imports
-//OPENDAP imports
-//OODT imports
-
-/**
- *
- * Static methods for unraveling and generating {@link ProfileElement}s,
- * {@link ProfileAttributes} and {@link ResourceAttributes} for a
- * {@link Profile}, derived from a set of OPeNDAP dataset information and an
- * {@link OpendapConfig}.
- *
- *
- */
-public class ProfileUtils {
-
- static {
- // Note: must override the CAS PathUtils delimiter otherwise every sentence is split at the ',' as different metadata fields.
- // The delimiter must be a character that is not commonly used in the metadata values,
- // and that it does not a special regular expression character.
- // Cannot use '#' as it is used in URL anchors, such as THREDDS urls.
- // Cannot user '?', '&' as they are used in URL query strings.
- // Cannot use '|' as it is used as multi-part separators in encoding of metadata fields.
- PathUtils.DELIMITER = "~";
- }
-
- // character separating multiple parts of the same metadata field,
- // when more than one piece of information needs to be stored in one field
- public final static String CHAR = "|";
-
- // HTTP mime types
- public final static String MIME_TYPE_THREDDS = "application/xml+thredds";
- public final static String MIME_TYPE_NETCDF = "application/netcdf";
- public final static String MIME_TYPE_GRIDFTP = "application/gridftp";
- public final static String MIME_TYPE_FTP = "application/ftp";
- public final static String MIME_TYPE_LAS = "application/las";
- public final static String MIME_TYPE_HTML = "text/html";
- public final static String MIME_TYPE_GOOGLE_EARTH = "application/vnd.google-earth.kmz";
- public final static String MIME_TYPE_HDF = "application/x-hdf";
- public final static String MIME_TYPE_OPENDAP = "application/opendap";
- public final static String MIME_TYPE_OPENDAP_DODS = "application/opendap-dods";
- public final static String MIME_TYPE_OPENDAP_DAS = "application/opendap-das";
- public final static String MIME_TYPE_OPENDAP_DDS = "application/opendap-dds";
- public final static String MIME_TYPE_OPENDAP_HTML = "application/opendap-html";
- public final static String MIME_TYPE_RSS = "application/rss+xml";
- public final static String MIME_TYPE_GIS = "application/gis";
-
-
- private static final Logger LOG = Logger.getLogger(ProfileUtils.class
- .getName());
-
- public static ResourceAttributes getResourceAttributes(OpendapConfig conf,
- String opendapUrl, DConnect dConn, Metadata datasetMet) {
- ResourceAttributes resAttr = new ResourceAttributes();
- for (ConstantSpec spec : conf.getConstSpecs()) {
- if (spec.getType().equals(RES_ATTR_SPEC_TYPE)) {
- try {
-
- // first process expanded '[@...]' instructions
- List<String> values = multipleEnvVariablesReplacement(spec.getValue(), datasetMet);
-
- // then process standard '[...]' instructions
- for (String value : values) {
- String _value = PathUtils.replaceEnvVariables(value, datasetMet, true);
- if (StringUtils.hasText(_value)) {
- setResourceAttributes(resAttr, spec.getName(), _value);
- }
-
- }
-
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- LOG.log(Level.WARNING, "Error setting field: [" + spec.getName()
- + "] in resource attributes: Message: " + e.getMessage());
- }
- }
- }
-
-
- return resAttr;
- }
-
- /**
- * Utility method to process environment replacement instructions of the form '[@key]'
- * resulting in as many output values as there are values for the environment variable 'key'.
- * Note that currently only one such pattern '[@key']' can be processed.
- *
- * @param value
- * @param metadata
- * @return
- */
- private static List<String> multipleEnvVariablesReplacement(String value, Metadata metadata) {
-
- List<String> newValues = new ArrayList<String>();
-
- // regexp matching found > replace values
- int start = value.indexOf("[@");
- if (start>=0) {
-
- int end = value.indexOf("]",start+2);
- // remove '[@',']' to obtain environment variable key
- String envKey = value.substring(start+2,end);
- List<String> envValues = metadata.getAllMetadata(envKey);
- if (envValues!=null) {
- for (String envValue : envValues) {
- // create new metadata value for this environment replacement
- String newValue = value.replaceAll("\\[@"+envKey+"\\]", envValue);
- newValues.add(newValue);
- }
- }
-
- // regexp matching not found > return original value
- } else {
- newValues.add(value);
- }
-
- return newValues;
-
- }
-
- public static ProfileAttributes getProfileAttributes(OpendapConfig conf, Metadata datasetMet) {
- ProfileAttributes profAttr = new ProfileAttributes();
- for (ConstantSpec spec : conf.getConstSpecs()) {
- if (spec.getType().equals(PROF_ATTR_SPEC_TYPE)) {
- setProfileAttributesProperty(profAttr, spec.getName(), PathUtils
- .replaceEnvVariables(spec.getValue(), datasetMet, true));
- }
- }
-
- return profAttr;
-
- }
-
- public static Map<String, ProfileElement> getProfileElements(
- OpendapConfig conf, DConnect dConn, Metadata datasetMet, Profile profile) throws Exception {
-
- OpendapProfileElementExtractor pe = new OpendapProfileElementExtractor(conf);
- Map<String, ProfileElement> profElements = new ConcurrentHashMap<String, ProfileElement>();
-
- // extracts all variables defined in DDS
- try {
-
- DDS dds = dConn.getDDS();
-
- // loop over all variables found
- Enumeration variables = dds.getVariables();
- while (variables.hasMoreElements()) {
-
- BaseType variable = (BaseType)variables.nextElement();
- String varName = variable.getName();
- if (variable instanceof DArray) {
- LOG.log(Level.FINE, "Extracting Darray variable: "+varName);
- } else if (variable instanceof DGrid) {
- LOG.log(Level.FINE, "Extracting Dgrid variable: "+varName);
- }
-
- RewriteSpec spec = getProfileElementSpec(varName, conf);
- if (spec!=null) {
- // use configuration to set variable re-name and type
- String peName = spec.getRename() != null && !spec.getRename().equals("") ? spec.getRename() : spec.getOrigName();
- if (spec.getElementType().equals(RANGED_ELEMENT_TYPE)) {
- profElements.put(peName, pe.extractRangedProfileElement(peName, spec.getOrigName(), profile, dConn.getDAS()));
- } else if (spec.getElementType().equals(ENUM_ELEMENT_TYPE)) {
- profElements.put(peName, pe.extractEnumeratedProfileElement(peName, spec.getOrigName(), profile, dConn.getDAS()));
- }
- } else {
- // if not explicitly configured, assume variable if of RANGED_ELEMENT_TYPE
- profElements.put(varName, pe.extractRangedProfileElement(varName, varName, profile, dConn.getDAS()));
- }
-
- }
-
- } catch(Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- LOG.log(Level.WARNING, "Error extracting metadata from DDS ("+dConn.URL()+") :" +e.getMessage());
- // rethrow the exception so that this dataset is not harvested
- throw e;
- }
-
- // add profile elements from <datasetMetadata> specification
- if (datasetMet != null) {
- for (DatasetMetElem datasetSpec : conf.getDatasetMetSpecs()) {
- // retrieve values from metadata container
- List<String> values = datasetMet.getAllMetadata(datasetSpec.getValue());
- addValuesToEnumeratedProfileElement(datasetSpec.getProfileElementName(), values, profile, profElements);
- }
- }
-
- // add profile elements from <constants> specification
- for (ConstantSpec spec : conf.getConstSpecs()) {
- if (spec.getType().equals(PROF_ELEM_SPEC_TYPE)) {
- // retrieve value from XML configuration file, replace with value from metadata container if required,
- // split according to delimiter
- String replaceVal = PathUtils.replaceEnvVariables(spec.getValue(), datasetMet);
- List<String> values = Arrays.asList(replaceVal.split(PathUtils.DELIMITER));
- addValuesToEnumeratedProfileElement(spec.getName(), values, profile, profElements);
- }
- }
-
- return profElements;
-
- }
-
- /**
- * Method to add one or more values to an EnumeratedProfileElement, creating the element if not existing already.
- * The supplied values are added only if valid.
- */
- private static void addValuesToEnumeratedProfileElement(final String name, final List<String> values, Profile profile, Map<String, ProfileElement> profElements) {
-
- // try retrieve existing profile element
- ProfileElement epe = profElements.get(name);
- // or create a new one if not found
- if (epe==null) {
- epe = new EnumeratedProfileElement(profile);
- epe.setName(name);
- }
- if (values!=null) {
- for (String value : values) {
- if (StringUtils.hasText(value) && !value.equalsIgnoreCase("null")) {
- epe.getValues().add(value);
- }
- }
- }
- // only save profile elements with one or more values
- if (epe.getValues().size()>0) {
- profElements.put(name, epe);
- }
-
- }
-
- private static void setProfileAttributesProperty(ProfileAttributes attr,
- String propName, String value) {
- if (propName.equals("profId")) {
- attr.setID(value);
- } else if (propName.equals("profVersion")) {
- attr.setVersion(value);
- } else if (propName.equals("profType")) {
- attr.setType(value);
- } else if (propName.equals("profStatusId")) {
- attr.setStatusID(value);
- } else if (propName.equals("profSecurityType")) {
- attr.setSecurityType(value);
- } else if (propName.equals("profParentId")) {
- attr.setParent(value);
- } else if (propName.equals("profRegAuthority")) {
- attr.setRegAuthority(value);
- } else if (propName.equals("profChildId")) {
- attr.getChildren().addAll(Arrays.asList(value.split(PathUtils.DELIMITER)));
- } else if (propName.equals("profRevisionNote")) {
- attr.getRevisionNotes().addAll(Arrays.asList(value.split(PathUtils.DELIMITER)));
- }
-
- }
-
- private static void setResourceAttributes(ResourceAttributes resAttr,
- String propName, String value) {
- if (StringUtils.hasText(value) && !value.equalsIgnoreCase("null")) {
- if (propName.equals("Identifier")) {
- resAttr.setIdentifier(value);
- } else if (propName.equals("Title")) {
- resAttr.setTitle(value);
- } else if (propName.equals("Format")) {
- resAttr.getFormats().addAll( parseValues(value) );
- } else if (propName.equals("Description")) {
- resAttr.setDescription(value);
- } else if (propName.equals("Creator")) {
- resAttr.getCreators().addAll( parseValues(value) );
- } else if (propName.equals("Subject")) {
- resAttr.getSubjects().addAll( parseValues(value) );
- } else if (propName.equals("Publisher")) {
- resAttr.getPublishers().addAll( parseValues(value) );
- } else if (propName.equals("Contributor")) {
- resAttr.getContributors().addAll( parseValues(value) );
- } else if (propName.equals("Date")) {
- resAttr.getDates().addAll( parseValues(value) );
- } else if (propName.equals("Type")) {
- resAttr.getTypes().addAll( parseValues(value) );
- } else if (propName.equals("Source")) {
- resAttr.getSources().addAll( parseValues(value) );
- } else if (propName.equals("Language")) {
- resAttr.getLanguages().addAll( parseValues(value) );
- } else if (propName.equals("Relation")) {
- resAttr.getRelations().addAll( parseValues(value) );
- } else if (propName.equals("Coverage")) {
- resAttr.getCoverages().addAll( parseValues(value) );
- } else if (propName.equals("Rights")) {
- resAttr.getRights().addAll( parseValues(value) );
- } else if (propName.equals("resContext")) {
- resAttr.getResContexts().addAll( parseValues(value) );
- } else if (propName.equals("resAggregation")) {
- resAttr.setResAggregation(value);
- } else if (propName.equals("resClass")) {
- resAttr.setResClass(value);
- } else if (propName.equals("resLocation")) {
- resAttr.getResLocations().addAll( parseValues(value) );
- }
- }
- }
-
- /**
- * Utility method to discover the rewrite specification for a named variable, if available.
- * @param conf
- */
- private static RewriteSpec getProfileElementSpec(String origName, OpendapConfig conf) {
- for (RewriteSpec spec : conf.getRewriteSpecs()) {
- if (spec.getOrigName().equals(origName)) {
- return spec;
- }
- }
- return null;
- }
-
- /**
- * Utility method to split a metadata field value according to the known delimiter.
- * @param value
- * @return
- */
- public static List<String> parseValues(String value) {
- List<String> values = new ArrayList<String>();
- for (String val : value.split(PathUtils.DELIMITER)) {
- if (StringUtils.hasText(val) && !val.equalsIgnoreCase("null")) {
- values.add(val);
- }
- }
-
- return values;
- }
-
- /**
- * Method to add a (name,value) pair to the metadata container if the value is not null or empty,
- * and doesn't exist already.
- * @param met
- * @param value
- */
- public static void addIfNotNull(Metadata met, String key, String value) {
- // do not add a null value
- if (StringUtils.hasText(value) && !value.equalsIgnoreCase("null")) {
- // do not add the same value twice for the same metadata key
- if (!met.containsKey(key) || !met.getAllMetadata(key).contains(value)) {
- met.addMetadata(key, value);
- }
- }
- }
-
- /**
- * Method to add multiple (key, value) pairs to the metadata container if not existing already.
- */
- public static void addIfNotExisting(Metadata metadata, String key, Enumeration<String> values) {
- if (StringUtils.hasText(key) && !metadata.containsKey(key)) {
- while (values.hasMoreElements()) {
- String value = values.nextElement();
- if (StringUtils.hasText(value) && !value.equalsIgnoreCase("null")) {
- metadata.addMetadata(key,value);
- }
- }
- }
- }
-
- // inspired from ASLv2 code at:
- // http://www.java2s.com/Code/Java/Data-Type/ISO8601dateparsingutility.htm
- public static String toISO8601(Date date) {
- SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
- TimeZone tz = TimeZone.getTimeZone("UTC");
- df.setTimeZone(tz);
- return df.format(date);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/opendapps/src/main/resources/logging.properties
----------------------------------------------------------------------
diff --git a/opendapps/src/main/resources/logging.properties b/opendapps/src/main/resources/logging.properties
deleted file mode 100644
index 663006a..0000000
--- a/opendapps/src/main/resources/logging.properties
+++ /dev/null
@@ -1,35 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Specify the handlers to create in the root logger
-# (all loggers are children of the root logger)
-# The following creates two handlers
-handlers = java.util.logging.ConsoleHandler
-
-# Set the default logging level for the root logger
-.level = ALL
-
-# Set the default logging level for new ConsoleHandler instances
-java.util.logging.ConsoleHandler.level = ALL
-
-# Set the default formatter for new ConsoleHandler instances
-java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
-
-org.apache.oodt.opendapps.level = INFO
-org.apache.oodt.opendapps.util.level = INFO
-org.apache.oodt.opendapps.config.level = INFO
-
-# Tone down the Sun log messages
-sun.net.www.level=SEVERE
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/opendapps/src/main/resources/opendap.config.xml
----------------------------------------------------------------------
diff --git a/opendapps/src/main/resources/opendap.config.xml b/opendapps/src/main/resources/opendap.config.xml
deleted file mode 100644
index a338130..0000000
--- a/opendapps/src/main/resources/opendap.config.xml
+++ /dev/null
@@ -1,192 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-Description: This file defines a set of information used by an OODT Profile Server
-to extract and deliver back OODT Profile metadata from an underlying OPeNDAP/THREDDS
-accessible data source. This configuration file builds on prior work that was only
-configurable in Java code, but is now configurable via this file.
-
--->
-<oodt:opendap xmlns:oodt="http://oodt.apache.org/1.0" id="urn:oodt:opendap:psid" name="OPeNDAP Handler">
-
- <!--
- A set of THREDDS catalog roots to derive datasets from. Must specify at least one root.
-
- datasetURL - the original URL to the THREDDS dataset.
- catalogURL - the original URL to the THREDDS catalog.xml file used to obtain dataset metadata
- and information from.
- filter (optional) - defines an optional dataset filter for inclusion/exclusion.
-
- -->
- <root datasetURL="http://thredds1.pfeg.noaa.gov/thredds/dodsC/" catalogURL="http://thredds1.pfeg.noaa.gov/thredds/Satellite/aggregsatMW/chla/catalog.xml" filter=".*" />
- <root datasetURL="http://thredds1.pfeg.noaa.gov/thredds/dodsC/" catalogURL="http://thredds1.pfeg.noaa.gov/thredds/Satellite/aggregsatMH/chla/catalog.xml" filter=".*" />
- <root datasetURL="http://thredds1.pfeg.noaa.gov/thredds/dodsC/" catalogURL="http://thredds1.pfeg.noaa.gov/thredds/Satellite/aggregsatSW/chla/catalog.xml" filter=".*" />
- <root datasetURL="http://thredds1.pfeg.noaa.gov/thredds/dodsC/" catalogURL="http://thredds1.pfeg.noaa.gov/thredds/Satellite/aggregsatSA/chla/catalog.xml" filter=".*" />
- <root datasetURL="http://thredds1.pfeg.noaa.gov/thredds/dodsC/" catalogURL="http://thredds1.pfeg.noaa.gov/thredds/Satellite/aggregsatAG/tanm/catalog.xml" filter=".*" />
- <root datasetURL="http://thredds1.pfeg.noaa.gov/thredds/dodsC/" catalogURL="http://thredds1.pfeg.noaa.gov/thredds/Satellite/aggregsatAA/ssta/catalog.xml" filter=".*" />
- <root datasetURL="http://thredds1.pfeg.noaa.gov/thredds/dodsC/" catalogURL="http://thredds1.pfeg.noaa.gov/thredds/Satellite/aggregsatMH/sstd/catalog.xml" filter=".*" />
-
-
- <!--
- A set of specifications for how to rewrite the names of underlying OPeNDAP/THREDDS dataset variables
- into profile elements within the generated OODT profile. These information are used only to transform
- OPeNDAP variables into OODT profile elements. If an OPeNDAP element part of a dataset is not specified
- in this rewrite block, the variable not be extracted.
-
- name: The original name of the OPeNDAP variable.
- rename (optional): What to rename the variable to in the OODT Profile Elements section.
- type: Either EnumeratedProfileElement or RangedProfileElement. EnumeratedProfileElement indicates this is
- a variable with a select vocabulary of choices, with multiple values to specify those choices. RangedProfileElement
- indicates this is an OPeNDAP variable with a specified min/max value.
-
- -->
- <rewrite>
- <var name="altitude" type="RangedProfileElement"/>
- <var name="lat" rename="latitude" type="RangedProfileElement"/>
- <var name="lon" rename="longitude" type="RangedProfileElement"/>
- <var name="time" type="RangedProfileElement"/>
- </rewrite>
-
-
- <!--
- THREDDS Dataset metadata that you want to flow into the Profile
- Elements portion of the profile. Each specified dataset metadata
- will be turned into an EnumeratedProfileElement with 1 or more values.
-
- name: The name of the profile element.
- value: The dataset metadata element to extract the metadata from. The
- extracted metadata is shoved into the generated EnumeratedProfileElement's
- value set.
- -->
- <datasetMetadata>
-
- <!-- variable names -->
- <elem name="variable" value="Variables"/>
- <elem name="cf_standard_name" value="CF Standard Names"/>
- <elem name="variable_long_name" value="Variable Long Names"/>
-
- <!-- geospatial coverage -->
- <elem name="south_deegrees" value="GeospatialCoverageLatSouth"/>
- <elem name="north_deegrees" value="GeospatialCoverageLatNorth"/>
- <elem name="west_deegrees" value="GeospatialCoverageLonWest"/>
- <elem name="east_deegrees" value="GeospatialCoverageLonEast"/>
- <elem name="spatial_coverage" value="GeospatialCoverage"/>
- <elem name="latitude_resolution" value="GeospatialCoverageLatitudeResolution"/>
- <elem name="longitude_resolution" value="GeospatialCoverageLongitudeResolution"/>
-
- <!-- temporal coverage -->
- <elem name="datetime_start" value="StartDateTime"/>
- <elem name="datetime_stop" value="EndDateTime"/>
- <elem name="temporal_resolution" value="TimeCoverageResolution"/>
-
- </datasetMetadata>
-
- <!--
- A set of constant metadata to plumb through into the profile, either in the
- profileAttributes section or the resourceAttributes section. The type parameter
- indicates the section name, and the rest of the attributes are fairly evident from there.
- Note: the value tag can use CAS/OODT based environment variable replacement, by specifying
- values within the '[' and ']' delimiters, e.g., [PROFILE_REG_AUTHORITY].
-
- type: either profAttr, resAttr, or profElem to indicate what section in the profile the information
- should be part of. If profElem is selected, then an EnumeratedProfileElement with the provided
- values will be created and added to the profile.
- name: the name of the profileAttribute or resourceAttribute field.
- value: the value to be set.
-
-
- profAttr can be any of:
- profId
- profVersion
- profType
- profStatusId
- profSecurityType
- profParentId
- profRegAuthority
- profChildId
- profRevisionNote
-
- resAttr can be any of:
- Identifier
- Title
- Description
- Creator
- Subject
- Publisher
- Contributor
- Date
- Type
- Source
- Language
- Relation
- Coverage
- Rights
- resContext
- resAggregation
- resClass
- resLocation
- -->
- <constants>
-
- <!-- profile attributes -->
- <const type="profAttr" name="profType" value="CMDS Ocean Dataset Profile"/>
- <const type="profAttr" name="profStatusId" value="active"/>
- <const type="profAttr" name="profRegAuthority" value="NASA Coastal Marine Data Discovery Service (CMDS)" />
- <const type="profAttr" name="profId" value="[UUID]"/>
- <const type="profAttr" name="profVersion" value="1.0"/>
-
- <!-- resource attributes -->
- <const type="resAttr" name="Identifier" value="[ID]|[Host]" />
- <const type="resAttr" name="Title" value="[FullName]" />
- <const type="resAttr" name="Description" value="[Summary]" />
- <const type="resAttr" name="resLocation" value="[Access]"/>
- <const type="resAttr" name="Rights" value="[Rights]" />
- <const type="resAttr" name="Relation" value="[Xlink]"/>
- <const type="resAttr" name="Publisher" value="[Publisher]" />
- <const type="resAttr" name="Creator" value="[Creator]" />
- <const type="resAttr" name="Type" value="[DataType]"/>
- <const type="resAttr" name="Format" value="[DataFormatType]"/>
- <!-- dynamic keywords harvested from data -->
- <const type="resAttr" name="Subject" value="[Keywords]" />
- <!-- static keywords to supplement keywords harvested from data -->
- <const type="resAttr" name="Subject" value="Coastal Marine Data" />
- <const type="resAttr" name="Subject" value="Oceans" />
- <const type="resAttr" name="Subject" value="Climate Change" />
- <!-- OODT resource parameters -->
- <const type="resAttr" name="resClass" value="data.dataSet" />
- <const type="resAttr" name="resContext" value="Oceanography"/>
- <const type="resAttr" name="resAggregation" value="dataSet"/>
-
- <!-- profile elements from DAS/NC_GLOBAL section -->
- <const type="profElem" name="mission_name" value="[satellite]"/>
- <const type="profElem" name="sensor" value="[sensor]"/>
- <const type="profElem" name="source" value="[source]"/>
- <const type="profElem" name="project" value="[project]"/>
- <const type="profElem" name="processing_level" value="[processing_level]"/>
- <!-- constant values -->
- <const type="profElem" name="spatial_coverage" value="Global"/>
- <const type="profElem" name="institute" value="NOAA CoastWatch"/>
-
- <!-- constants required by ESGF harvesting process -->
- <const type="profElem" name="master_id" value="[ID]|[Host]"/>
- <const type="profElem" name="type" value="Dataset"/>
- <const type="profElem" name="data_node" value="[Host]"/>
- <const type="profElem" name="index_node" value="cmds-esg.jpl.nasa.gov"/>
-
-
- </constants>
-
-</oodt:opendap>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index f5b1c3c..53c24cc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -35,13 +35,6 @@ the License.
<module>cli</module>
<module>pcs/input</module>
<module>metadata</module>
- <module>protocol/api</module>
- <module>protocol/ftp</module>
- <module>protocol/http</module>
- <module>protocol/imaps</module>
- <module>protocol/sftp</module>
- <module>xmlquery</module>
- <module>sso</module>
<module>filemgr</module>
<module>catalog</module>
<module>workflow</module>
@@ -52,18 +45,10 @@ the License.
<module>pge</module>
<module>mvn/plugins/cas-install</module>
<module>mvn/archetypes</module>
- <module>pushpull</module>
- <module>product</module>
- <module>profile</module>
- <module>grid</module>
- <module>xmlps</module>
- <module>opendapps</module>
<module>webapp/components</module>
<module>webapp/fmbrowser</module>
<module>webapp/fmprod</module>
<module>webapp/wmonitor</module>
- <module>app/fmbrowser</module>
- <module>app/weditor</module>
<module>pcs/core</module>
<module>pcs/opsui</module>
<module>pcs/services</module>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/.gitignore
----------------------------------------------------------------------
diff --git a/product/.gitignore b/product/.gitignore
deleted file mode 100644
index b54523f..0000000
--- a/product/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/maven-eclipse.xml
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/pom.xml
----------------------------------------------------------------------
diff --git a/product/pom.xml b/product/pom.xml
deleted file mode 100644
index aa00f92..0000000
--- a/product/pom.xml
+++ /dev/null
@@ -1,138 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.oodt</groupId>
- <artifactId>oodt-core</artifactId>
- <version>1.1-SNAPSHOT</version>
- <relativePath>../core/pom.xml</relativePath>
- </parent>
- <artifactId>oodt-product</artifactId>
- <name>Product Service</name>
- <description>The Product Service provides access to data products. Products can be
- scientific datasets, images, documents, or anything with an electronic
- representation. The Product Service accepts standard query expressions (see
- the Query Expression component) and returns zero or more matching products.
- In addition, the product service can transform products from proprietary
- formats and into Internet standard formats or run other transformations, all
- without impacting local stores or operations.</description>
- <!-- All dependencies should be listed in core/pom.xml and be ordered alphabetically by package and artifact.
- Once the dependency is in the core pom, it can then be used in other modules without the version tags.
- For example, within core/pom.xml:
-
- <dependency>
- <groupId>com.amazonaws</groupId>
- <artifactId>aws-java-sdk</artifactId>
- <version>1.7.4</version>
- </dependency>
-
- Elsewhere in the platform:
- <dependency>
- <groupId>com.amazonaws</groupId>
- <artifactId>aws-java-sdk</artifactId>
- </dependency>
-
- Where possible the same dependency version should be used across the whole platform but if required the version
- can be overridden in a specific pom and should have a comment explaing why the version has been overridden
- -->
- <dependencies>
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <version>1.3</version>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.oodt</groupId>
- <artifactId>oodt-commons</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.oodt</groupId>
- <artifactId>oodt-xmlquery</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.tika</groupId>
- <artifactId>tika-core</artifactId>
- </dependency>
- </dependencies>
- <build>
- <resources>
- <resource>
- <targetPath>org/apache/oodt/product</targetPath>
- <directory>${basedir}/src/main/conf</directory>
- <includes>
- <include>displayableTypes.xml</include>
- </includes>
- </resource>
- </resources>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <configuration>
- <descriptorRefs>
- <descriptorRef>jar-with-dependencies</descriptorRef>
- </descriptorRefs>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <scm>
- <!-- <connection>scm:svn:https://svn.apache.org/repos/asf/oodt/trunk/product</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/oodt/trunk/product</developerConnection>
- <url>http://svn.apache.org/viewvc/oodt/trunk/product</url>-->
- <tag>0.13-SNAPSHOT</tag>
- </scm>
- <profiles>
- <profile>
- <id>audit</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>rat-maven-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>check</goal>
- </goals>
- <phase>verify</phase>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-</project>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/main/conf/displayableTypes.xml
----------------------------------------------------------------------
diff --git a/product/src/main/conf/displayableTypes.xml b/product/src/main/conf/displayableTypes.xml
deleted file mode 100644
index aca9ad0..0000000
--- a/product/src/main/conf/displayableTypes.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<!--
- 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.
--->
-<!DOCTYPE displayableTypes [
- <!ELEMENT displayableTypes (type*)>
- <!ELEMENT type (#PCDATA)>
-]>
-<displayableTypes>
- <type>text/plain</type>
- <type>text/richtext</type>
- <type>text/enriched</type>
- <type>text/tab-separated-values</type>
- <type>text/html</type>
- <type>text/xml</type>
- <type>text/rtf</type>
- <type>message/rfc822</type>
- <type>message/partial</type>
- <type>message/external-body</type>
- <type>message/news</type>
- <type>message/http</type>
- <type>message/delivery-status</type>
- <type>message/disposition-notification</type>
- <type>message/s-http</type>
- <type>application/rtf</type>
- <type>application/pdf</type>
- <type>image/jpeg</type>
- <type>image/gif</type>
- <type>image/tiff</type>
- <type>image/png</type>
- <type>audio/basic</type>
- <type>audio/32kadpcm</type>
- <type>audio/mpeg</type>
- <type>video/mpeg</type>
- <type>video/quicktime</type>
- <type>model/vrml</type>
-</displayableTypes>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/main/conf/ofsn-ps.xml
----------------------------------------------------------------------
diff --git a/product/src/main/conf/ofsn-ps.xml b/product/src/main/conf/ofsn-ps.xml
deleted file mode 100644
index 01939dd..0000000
--- a/product/src/main/conf/ofsn-ps.xml
+++ /dev/null
@@ -1,201 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<!--
- 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.
--->
-<!--
-Configures a new OODT OFSN style product server. This is a product server
-of the form:
-
-http://host/webgrid/prod?OFSN=/some/ofsn+AND+RT=sometype
-
-OFSN is an online file specification name, as defined by the PDS standards.
-RT is a transformation identifier, identifying a remote transformation to be applied
-at the given OFSN path.
-
-More more information on the OFSN style product servers, see the PDS original here:
-
-http://oodt/pds-client/guide/product
-
-Required attributes:
- id: defines a unique URN/id for this product server instance
- name: defines a human readable name for this product server instance
- productRoot: defines the root path in which the OFSN product server should start looking for
- paths based on a given OFSN
-
-FIXME: Change XML namespace URI for oodt prefix?
--->
-<oodt:ofsn xmlns:oodt="http://oodt.jpl.nasa.gov/xml/namespaces/oodt/1.0"
- id="urn:oodt:prod:ofsn"
- name="OODT OFSN Style Product Handler"
- productRoot="/some/path"
- >
-
- <!-- defines a new OFSN handler. There are 2 valid types:
-
- listing: this type generates a list of files given an OFSN. The list will
- be returned and formatted in XML for easy parsing.
-
- get: this type returns the bits of the requested ofsn, after performing some
- type of transformation on them.
-
- Required attributes:
-
- name: gives the handler type a identifiable name. This should be a valid RT name for use in the OODT
- product server query, e.g., if you want the dir list non-recursive listing handler to be called on
- RT=DIRLIST1, then set name to "DIRLIST1", as below.
-
- type: either listing, or get, depending on the desired handler type.
-
- class: defines a class that implements either the org.apache.oodt.product.handlers.ofsn.OFSNListHandler
- interface (for "listing" handlers), or the org.apache.oodt.product.handlers.ofsn.OFSNGetHandler (for
- "get" handlers). Note that this class must be on the classpath in order for it to be referenced in
- this configuration.
-
- -->
-
- <!--
- Optionally, each handler can have its own configuration, specified on the form of
- <property name="some name" value="some value"/>
-
- where some name is the name of the configuration property and some value is the
- value of the configuration property.
-
- Optional properties (for GET handlers):
-
- property name: mimeType
- property value: the desired MIME type (also referred to as content-type) a handler should return
- content as (eg. "text/plain"). More formally, any value of the form
- "type/subtype(; parameter=...)*" as defined in RFC 2045.
- -->
-
-
- <!--
- The DIRLIST1 type is identical to DIRLIST but does not recursively
- descend into subdirectories.
- -->
- <handler name="DIRLIST1" type="listing"
- class="org.apache.oodt.product.handlers.ofsn.DirListNonRecursiveHandler"/>
-
-
- <!--
- The DIRLIST type returns an XML file with directory names (and only
- directory names) and total size of files in each directory starting in
- the requested directory and traversing into the subdirectories.
- -->
- <handler name="DIRLIST" type="listing"
- class="org.apache.oodt.product.handlers.ofsn.DirListRecursiveHandler"/>
-
-
- <!--
- The DIRFILELIST1 is identical to DIRFILELIST except that it does not
- recurse into subdirectories.
- -->
- <handler name="DIRFILELIST1" type="listing"
- class="org.apache.oodt.product.handlers.ofsn.FileListNonRecursiveHandler"/>
-
- <!--
- The DIRFILELIST returns an XML document containing all of the filenames
- (and only the files, not directories) and their sizes, recursing into
- subdirectories.
- -->
- <handler name="DIRFILELIST" type="listing"
- class="org.apache.oodt.product.handlers.ofsn.FileListRecursiveHandler"/>
-
- <!--
- The RAW_SIZE generates an XML document telling the size of the raw file that
- would be returned by the corresponding RAW type.
- -->
- <handler name="RAW_SIZE" type="listing"
- class="org.apache.oodt.product.handlers.ofsn.RawSizeListHandler">
-
- <!--
- Required attributes:
- isSizeCmd: this value should be set to true in this handler to ensure that
- only the size is printed in the OFSN doc.
- -->
- <property name="isSizeCmd" value="true"/>
- </handler>
-
- <!--
- The FILELIST type returns an XML file naming the requested file and also
- giving its size.
- -->
- <handler name="FILE_LIST" type="listing"
- class="org.apache.oodt.product.handlers.ofsn.SingleFileListHandler"/>
-
-
- <!--
- The FILELISTZIP is similar to FILELIST except that it tells what the size
- of the requested file would be if compressed into a ZIP archive.
- -->
- <handler name="FILE_LIST_ZIP" type="listing"
- class="org.apache.oodt.product.handlers.ofsn.SingleZipFileListHandler">
-
- <!--
- Optional attributes:
- cacheDirRoot: defines the cache dir that the product server should use when asked to create temporary
- files, e.g., by a listing or get handler. By default, if not specified, it defaults to /tmp
-
- -->
- <property name="cacheDirRoot" value="/tmp"/>
- </handler>
-
- <!--
- The RAW type merely returns the requested file without any modification
- (MIME type application/octet-stream ).
- -->
- <handler name="RAW" type="get"
- class="org.apache.oodt.product.handlers.ofsn.StdOFSNGetHandler"/>
-
-
- <!--
- The MD5 type returns an MD5 hash of the file bytes generated on the server side.
- -->
-
- <handler name="MD5" type="get"
- class="org.apache.oodt.product.handlers.ofsn.MD5GetHandler">
-
- <property name="mimeType" value="text/plain"/>
-
- </handler>
-
-
- <!--
- The URL type returns a URL listing pointing to files within an OFSN
-
- (Optional) Use the below properties to customize the constructed URL returned:
- 1. prodServerHostname: the product server hostname
- 2. prodServerPort: the product server's port
- 3. prodServerContextRoot: the name of the product server webapp
- 4. productRoot: the root directory of the product server - identical
- to the root directory at the top of this XML file
- 5. returnType: the desired return type. i.e. RAW, MD5, etc.
- -->
- <handler name="URL" type="get"
- class="org.apache.oodt.product.handlers.ofsn.URLGetHandler">
-
- <!-- the below values are the default if nothing specified
- <property name="prodServerHostname" value="localhost"/>
- <property name="prodServerPort" value="8080"/>
- <property name="prodServerContextRoot" value="web-grid"/>
- <property name="productRoot" value="/some/path"/>
- <property name="returnType" value="RAW"/>
- -->
-
- <property name="mimeType" value="text/plain"/>
-
- </handler>
-</oodt:ofsn>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/main/java/org/apache/oodt/product/LargeProductQueryHandler.java
----------------------------------------------------------------------
diff --git a/product/src/main/java/org/apache/oodt/product/LargeProductQueryHandler.java b/product/src/main/java/org/apache/oodt/product/LargeProductQueryHandler.java
deleted file mode 100644
index 029e9ce..0000000
--- a/product/src/main/java/org/apache/oodt/product/LargeProductQueryHandler.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.product;
-
-/**
- * Handle requests for products that are too large to fit in an {@link
- * org.apache.oodt.xmlquery.XMLQuery} object.
- *
- * @author Kelly
- * @version $Revision: 1.1.1.1 $
- */
-public interface LargeProductQueryHandler extends QueryHandler {
- /**
- * Retrieve a chunk of a product.
- *
- * The product is identified by a string ID. The query handler should return a
- * binary chunk of the product using the given offset and length. If the ID isn't
- * recognized, it should return null. It should throw an exception if retrieval
- * fails for some reason.
- *
- * @param id Product ID.
- * @param offset Where in the product to get a chunk of it.
- * @param length How much of the product to get.
- * @return A chunk, or null if the <var>id</var> is unknown.
- * @throws ProductException if an error occurs.
- */
- byte[] retrieveChunk(String id, long offset, int length) throws ProductException;
-
- /**
- * Close off a product.
- *
- * This method indicates that the product is no longer required and its resources
- * can be freed by the query handler. If the ID is unknown, no untoward action is
- * required. It should throw an exception if there is an error during the
- * resource release (such as an {@link java.io.IOException} when closing a file.
- *
- * @param id Product ID.
- * @throws ProductException if an error occurs.
- */
- void close(String id);
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/main/java/org/apache/oodt/product/QueryHandler.java
----------------------------------------------------------------------
diff --git a/product/src/main/java/org/apache/oodt/product/QueryHandler.java b/product/src/main/java/org/apache/oodt/product/QueryHandler.java
deleted file mode 100644
index 6addbce..0000000
--- a/product/src/main/java/org/apache/oodt/product/QueryHandler.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.product;
-
-import org.apache.oodt.xmlquery.XMLQuery;
-
-/**
- * Handler for queries in a product service.
- *
- * @author Kelly
- * @version $Revision: 1.1.1.1 $
- */
-public interface QueryHandler {
- /**
- * Run a query.
- *
- * @param q The query.
- * @return The response.
- * @throws ProductException if an error occurs.
- */
- XMLQuery query(XMLQuery q) throws ProductException;
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/main/java/org/apache/oodt/product/handlers/ofsn/AbstractCrawlLister.java
----------------------------------------------------------------------
diff --git a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/AbstractCrawlLister.java b/product/src/main/java/org/apache/oodt/product/handlers/ofsn/AbstractCrawlLister.java
deleted file mode 100644
index 40b3094..0000000
--- a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/AbstractCrawlLister.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.product.handlers.ofsn;
-
-//JDK imports
-import org.apache.oodt.product.ProductException;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.util.Collections;
-import java.util.List;
-import java.util.Properties;
-import java.util.Stack;
-import java.util.Vector;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-//OODT imports
-
-/**
- *
- * An abstract {@link OFSNListHandler} for generating file lists based on two
- * simple flags: recurse, and crawlForDirs, indicating to crawl for directories
- * rather than files.
- *
- * @author mattmann
- * @version $Revision$
- *
- */
-public abstract class AbstractCrawlLister implements OFSNListHandler {
-
- protected final static Logger LOG = Logger
- .getLogger(AbstractCrawlLister.class.getName());
-
- protected static final FileFilter FILE_FILTER = new FileFilter() {
- public boolean accept(File pathname) {
- return pathname.isFile();
- }
- };
-
- protected static final FileFilter DIR_FILTER = new FileFilter() {
- public boolean accept(File pathname) {
- return pathname.isDirectory();
- }
- };
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.oodt.product.handlers.ofsn.OFSNListHandler#configure(java.
- * util.Properties)
- */
- public abstract void configure(Properties conf);
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.oodt.product.handlers.ofsn.OFSNListHandler#getListing(java
- * .lang.String)
- */
- public abstract File[] getListing(String ofsn) throws ProductException;
-
- protected File[] crawlFiles(File dirRoot, boolean recur,
- boolean crawlForDirs) {
- if (dirRoot == null || ((!dirRoot.exists()))) {
- throw new IllegalArgumentException("dir root: [" + dirRoot
- + "] is null or non existant!");
- }
-
- List<File> fileList = new Vector<File>();
-
- // start crawling
- Stack<File> stack = new Stack<File>();
- stack.push(dirRoot.isDirectory() ? dirRoot : dirRoot.getParentFile());
- while (!stack.isEmpty()) {
- File dir = (File) stack.pop();
- LOG.log(Level.INFO, "OFSN: Crawling " + dir);
-
- File[] productFiles;
- productFiles = crawlForDirs ? dir.listFiles(DIR_FILTER) : dir.listFiles(FILE_FILTER);
-
- if(productFiles!=null) {
- Collections.addAll(fileList, productFiles);
- }
- if (recur) {
- File[] subdirs = dir.listFiles(DIR_FILTER);
- if (subdirs != null) {
- for (File subdir : subdirs) {
- stack.push(subdir);
- }
- }
- }
- }
-
- return fileList.toArray(new File[fileList.size()]);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/main/java/org/apache/oodt/product/handlers/ofsn/DirListNonRecursiveHandler.java
----------------------------------------------------------------------
diff --git a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/DirListNonRecursiveHandler.java b/product/src/main/java/org/apache/oodt/product/handlers/ofsn/DirListNonRecursiveHandler.java
deleted file mode 100644
index afabb4f..0000000
--- a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/DirListNonRecursiveHandler.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.product.handlers.ofsn;
-
-//JDK imports
-import java.io.File;
-import java.util.Properties;
-
-//OODT imports
-import org.apache.oodt.product.ProductException;
-
-/**
- *
- * Generates a directory listing, without recursing into the OFSN path.
- *
- * @author mattmann
- * @version $Revision$
- *
- */
-public class DirListNonRecursiveHandler extends AbstractCrawlLister {
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.oodt.product.handlers.ofsn.OFSNListHandler#getListing(java
- * .lang.String)
- */
- public File[] getListing(String ofsn) throws ProductException {
- return crawlFiles(new File(ofsn), false, true);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.oodt.product.handlers.ofsn.OFSNListHandler#configure(java.
- * util.Properties)
- */
- public void configure(Properties conf) {
- // no properties defined yet
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/main/java/org/apache/oodt/product/handlers/ofsn/DirListRecursiveHandler.java
----------------------------------------------------------------------
diff --git a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/DirListRecursiveHandler.java b/product/src/main/java/org/apache/oodt/product/handlers/ofsn/DirListRecursiveHandler.java
deleted file mode 100644
index 00dd4ec..0000000
--- a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/DirListRecursiveHandler.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.product.handlers.ofsn;
-
-//JDK imports
-import java.io.File;
-import java.util.Properties;
-
-//OODT imports
-import org.apache.oodt.product.ProductException;
-
-/**
- *
- * Generates a directory listing, recursing into the OFSN path.
- *
- * @author mattmann
- * @version $Revision$
- *
- */
-public class DirListRecursiveHandler extends AbstractCrawlLister {
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.oodt.product.handlers.ofsn.AbstractCrawlLister#configure(java
- * .util.Properties)
- */
- @Override
- public void configure(Properties conf) {
- // no properties yet
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.oodt.product.handlers.ofsn.AbstractCrawlLister#getListing(
- * java.lang.String)
- */
- @Override
- public File[] getListing(String ofsn) throws ProductException {
- return crawlFiles(new File(ofsn), true, true);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/main/java/org/apache/oodt/product/handlers/ofsn/FileListNonRecursiveHandler.java
----------------------------------------------------------------------
diff --git a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/FileListNonRecursiveHandler.java b/product/src/main/java/org/apache/oodt/product/handlers/ofsn/FileListNonRecursiveHandler.java
deleted file mode 100644
index 2d8cfea..0000000
--- a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/FileListNonRecursiveHandler.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.product.handlers.ofsn;
-
-//JDK imports
-import java.io.File;
-import java.util.Properties;
-
-//OODT imports
-import org.apache.oodt.product.ProductException;
-
-/**
- *
- * A non recursive file listing from a given OFSN.
- *
- * @author mattmann
- * @version $Revision$
- *
- */
-public class FileListNonRecursiveHandler extends AbstractCrawlLister {
-
- /* (non-Javadoc)
- * @see org.apache.oodt.product.handlers.ofsn.OFSNListHandler#configure(java.util.Properties)
- */
- @Override
- public void configure(Properties conf) {
- // TODO Auto-generated method stub
- // nothing yet
-
- }
-
- /* (non-Javadoc)
- * @see org.apache.oodt.product.handlers.ofsn.OFSNListHandler#getListing(java.lang.String)
- */
- @Override
- public File[] getListing(String ofsn) throws ProductException {
- return crawlFiles(new File(ofsn), false, false);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/main/java/org/apache/oodt/product/handlers/ofsn/FileListRecursiveHandler.java
----------------------------------------------------------------------
diff --git a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/FileListRecursiveHandler.java b/product/src/main/java/org/apache/oodt/product/handlers/ofsn/FileListRecursiveHandler.java
deleted file mode 100644
index 5543494..0000000
--- a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/FileListRecursiveHandler.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.product.handlers.ofsn;
-
-//JDK imports
-import java.io.File;
-import java.util.Properties;
-
-//OODT imports
-import org.apache.oodt.product.ProductException;
-
-/**
- *
- * A recursive file listing from the provided ofsn.
- *
- * @author mattmann
- * @version $Revision$
- *
- */
-public class FileListRecursiveHandler extends AbstractCrawlLister {
-
- /* (non-Javadoc)
- * @see org.apache.oodt.product.handlers.ofsn.AbstractCrawlLister#configure(java.util.Properties)
- */
- @Override
- public void configure(Properties conf) {
- // TODO Auto-generated method stub
- // nothing yet
- }
-
- /* (non-Javadoc)
- * @see org.apache.oodt.product.handlers.ofsn.AbstractCrawlLister#getListing(java.lang.String)
- */
- @Override
- public File[] getListing(String ofsn) throws ProductException {
- return crawlFiles(new File(ofsn), true, false);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/main/java/org/apache/oodt/product/handlers/ofsn/MD5GetHandler.java
----------------------------------------------------------------------
diff --git a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/MD5GetHandler.java b/product/src/main/java/org/apache/oodt/product/handlers/ofsn/MD5GetHandler.java
deleted file mode 100644
index 95ffe20..0000000
--- a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/MD5GetHandler.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.product.handlers.ofsn;
-
-//JDK imports
-
-import org.apache.commons.codec.binary.Hex;
-import org.apache.commons.io.FileUtils;
-import org.apache.oodt.product.ProductException;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.IOException;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.util.Properties;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-//APACHE imports
-//OODT imports
-
-/**
- *
- * A {@link OFSNGetHandler} to perform an MD5 for a file on the server side.
- *
- * @author mattmann
- * @version $Revision$
- *
- */
-public class MD5GetHandler implements OFSNGetHandler {
-
- private MessageDigest md = null;
- private static Logger LOG = Logger.getLogger(MD5GetHandler.class.getName());
- public MD5GetHandler() throws InstantiationException {
- try {
- this.md = MessageDigest.getInstance("MD5");
- } catch (NoSuchAlgorithmException e) {
- LOG.log(Level.SEVERE, e.getMessage());
- throw new InstantiationException(e.getMessage());
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.oodt.product.handlers.ofsn.OFSNListHandler#configure(java.
- * util.Properties)
- */
- public void configure(Properties conf) {
- // TODO Auto-generated method stub
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.oodt.product.handlers.ofsn.OFSNGetHandler#retrieveChunk(java
- * .lang.String, long, int)
- */
- public byte[] retrieveChunk(String filepath, long offset, int length)
- throws ProductException {
- try {
- String hash = this.hashData(FileUtils.readFileToByteArray(new File(
- filepath)));
- byte[] retBytes = new byte[length];
- byte[] hashBytes = hash.getBytes();
- ByteArrayInputStream is = new ByteArrayInputStream(hashBytes);
- is.skip(offset);
- is.read(retBytes, 0, length);
- return retBytes;
- } catch (IOException e) {
- LOG.log(Level.SEVERE, e.getMessage());
- throw new ProductException("Error reading bytes from file: [" + filepath
- + "] MD5: Message: " + e.getMessage());
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.oodt.product.handlers.ofsn.OFSNGetHandler#sizeOf(java.lang
- * .String)
- */
- public long sizeOf(String filepath) {
- try {
- String hash = this.hashData(FileUtils.readFileToByteArray(new File(
- filepath)));
- return hash.getBytes().length;
- } catch (IOException e) {
- LOG.log(Level.SEVERE, e.getMessage());
- return -1;
- }
- }
-
- /**
- * Use this method ot generate a test MD5 of a provide {@link File} specified
- * in args[0].
- *
- * @param args
- * Only need to specify 1 arg, the full path to the {@link File} to
- * MD5.
- * @throws Exception
- * If any error occurs.
- */
- public static void main(String[] args) throws Exception {
- if (args.length != 1) {
- System.err.println("MD5GetHandler <file>");
- System.exit(1);
- }
-
- String filepath = args[0];
- String hashString = new MD5GetHandler().hashData(FileUtils
- .readFileToByteArray(new File(filepath)));
- System.out.println(hashString);
- }
-
- private String hashData(byte[] dataToHash) {
- this.md.update(dataToHash, 0, dataToHash.length);
- byte[] hash = this.md.digest();
- return new String(Hex.encodeHex(hash));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/main/java/org/apache/oodt/product/handlers/ofsn/OFSNFileHandler.java
----------------------------------------------------------------------
diff --git a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/OFSNFileHandler.java b/product/src/main/java/org/apache/oodt/product/handlers/ofsn/OFSNFileHandler.java
deleted file mode 100644
index 016d714..0000000
--- a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/OFSNFileHandler.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.product.handlers.ofsn;
-
-import org.apache.oodt.commons.xml.XMLUtils;
-import org.apache.oodt.product.LargeProductQueryHandler;
-import org.apache.oodt.product.ProductException;
-import org.apache.oodt.product.handlers.ofsn.metadata.OFSNMetKeys;
-import org.apache.oodt.product.handlers.ofsn.metadata.OFSNXMLConfigMetKeys;
-import org.apache.oodt.product.handlers.ofsn.metadata.OFSNXMLMetKeys;
-import org.apache.oodt.product.handlers.ofsn.metadata.XMLQueryMetKeys;
-import org.apache.oodt.product.handlers.ofsn.util.OFSNObjectFactory;
-import org.apache.oodt.product.handlers.ofsn.util.OFSNUtils;
-import org.apache.oodt.xmlquery.LargeResult;
-import org.apache.oodt.xmlquery.Result;
-import org.apache.oodt.xmlquery.XMLQuery;
-import org.apache.tika.mime.MediaType;
-import org.apache.tika.mime.MimeTypesFactory;
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.OutputStream;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-
-/**
- *
- * An extensible implementation of the PDS-inspired Online File Specification
- * Name (OFSN) style product server. See the ofsn-ps.xml file for a detailed
- * specification of the configuration and motivation behind this product
- * handler.
- *
- * @author mattmann
- * @version $Revision$
- */
-public class OFSNFileHandler implements LargeProductQueryHandler,
- XMLQueryMetKeys, OFSNXMLMetKeys, OFSNMetKeys, OFSNXMLConfigMetKeys {
-
- private static final Logger LOG = Logger.getLogger(OFSNFileHandler.class
- .getName());
-
- private static final String CMD_SEPARATOR = ";";
-
- // by default return dir size on listing commands
- private boolean computeDirSize = true;
-
- // by default return file size on listing commands
- private boolean computeFileSize = true;
-
- private OFSNFileHandlerConfiguration conf;
-
- private Map<String, Object> HANDLER_CACHE;
-
- public OFSNFileHandler() throws InstantiationException {
- // init conf here
- String xmlConfigFilePath = System.getProperty(OFSN_XML_CONF_FILE_KEY);
- this.computeDirSize = Boolean.getBoolean(OFSN_COMPUTE_DIR_SIZE);
- this.computeFileSize = Boolean.getBoolean(OFSN_COMPUTE_FILE_SIZE);
-
-
- if (xmlConfigFilePath == null) {
- throw new InstantiationException(
- "Must define xml configuration file path via property : ["
- + OFSN_XML_CONF_FILE_KEY + "]");
- }
-
- try {
- this.conf = OFSNFileHandlerConfigurationReader
- .getConfig(xmlConfigFilePath);
- } catch (FileNotFoundException e) {
- throw new InstantiationException("xml configuration file: ["
- + xmlConfigFilePath + "] not found!");
- }
-
- if (this.conf.getProductRoot() == null) {
- throw new InstantiationException(
- "Must define: [productRoot] attribute in XML configuration!");
- }
-
- // used to cache handlers -- map of RT type to Get/List handler instance
- HANDLER_CACHE = new ConcurrentHashMap<String, Object>();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.oodt.product.QueryHandler#query(org.apache.oodt.xmlquery.XMLQuery)
- */
- public XMLQuery query(XMLQuery xmlQuery) throws ProductException {
- String ofsn = OFSNUtils.extractFieldFromQuery(xmlQuery, OFSN);
- String cmd = OFSNUtils.extractFieldFromQuery(xmlQuery, RETURN_TYPE);
- validate(ofsn, cmd);
- String cmdId = ofsn + CMD_SEPARATOR + cmd;
- OFSNHandlerConfig cfg = this.conf.getHandlerConfig(cmd);
- validateHandlerConfig(cfg, cmd);
-
- String realPath = this.conf.getProductRoot() + ofsn;
-
- if (isListingCmd(cmd)) {
- ByteArrayOutputStream outStream = new ByteArrayOutputStream();
- OFSNListHandler handler = getListHandler(cmd, cfg.getClassName());
- File[] fileList = handler.getListing(realPath);
- generateOFSNXml(fileList, cfg, outStream);
- xmlQuery.getResults().add(
- new Result(cmdId, XML_MIME_TYPE, null, cmdId, Collections.EMPTY_LIST,
- outStream.toString()));
- } else if (isGetCmd(cmd)) {
- OFSNGetHandler handler = getGetHandler(cmd, cfg.getClassName());
- String rtAndPath = cmd + CMD_SEPARATOR + realPath;
- String mimeType;
-
- // check for and use mimetype conf property if available
- if (cfg.getHandlerConf().containsKey(PROPERTY_MIMETYPE_ATTR)) {
- MediaType mediaType = MediaType.parse(cfg.getHandlerConf()
- .getProperty(PROPERTY_MIMETYPE_ATTR));
- if (mediaType == null) {
- LOG.log(Level.WARNING, "MIME type ["
- +cfg.getHandlerConf().getProperty(PROPERTY_MIMETYPE_ATTR)+"] specified "
- +"for handler ["+cfg.getClassName()+"] invalid. Defaulting to MIME type ["
- +MediaType.OCTET_STREAM.toString()+"]");
- mediaType = MediaType.OCTET_STREAM;
- }
- mimeType = mediaType.toString();
- } else { // use default mimetype of product on disk
- try {
- mimeType = MimeTypesFactory.create().getMimeType(new File(realPath)).getName();
- } catch (Exception e) {
- mimeType = null;
- }
- }
-
- xmlQuery.getResults().add(
- new LargeResult(/* id */rtAndPath,/* mimeType */ mimeType, /* profileID */null,
- /* resourceID */new File(realPath).getName(), Collections.EMPTY_LIST,
- handler.sizeOf(realPath)));
- } else {
- throw new ProductException("return type: [" + cmd + "] is unsupported!");
- }
-
- return xmlQuery;
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.oodt.product.LargeProductQueryHandler#close(java.lang.String)
- */
- public void close(String id) {
- // nothing to do
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.oodt.product.LargeProductQueryHandler#retrieveChunk(java.lang.String,
- * long, int)
- */
- public byte[] retrieveChunk(String id, long offset, int length)
- throws ProductException {
- // unmarshall the return type and path
- String[] rtTypeAndPathArr = id.split(CMD_SEPARATOR);
- String rtType = rtTypeAndPathArr[0];
- String filepath = rtTypeAndPathArr[1];
-
- OFSNGetHandler handler = getGetHandler(rtType, this.conf
- .getHandlerClass(rtType));
-
- return handler.retrieveChunk(filepath, offset, length);
- }
-
- private void generateOFSNXml(File[] mlsFileList, OFSNHandlerConfig cfg,
- OutputStream outStream) {
- XMLUtils.writeXmlToStream(OFSNUtils.getOFSNDoc(Arrays.asList(mlsFileList),
- cfg, this.conf.getProductRoot(), this.computeDirSize, this.computeFileSize),
- outStream);
- }
-
- private void validate(String ofsn, String cmd) throws ProductException {
- if (ofsn == null || cmd == null || (ofsn.equals("")) || (cmd.equals(""))) {
- throw new ProductException("must specify OFSN and RT parameters!");
- } else if (!OFSNUtils.validateOFSN(ofsn)) {
- throw new ProductException("OFSN is invalid");
- }
- }
-
- private void validateHandlerConfig(OFSNHandlerConfig cfg, String cmd)
- throws ProductException {
- if (cfg == null) {
- throw new ProductException("Unrecognized command: [" + cmd + "]!");
- }
- }
-
- private OFSNListHandler getListHandler(String rtType, String className) {
- if (HANDLER_CACHE.containsKey(rtType)) {
- return (OFSNListHandler) HANDLER_CACHE.get(rtType);
- } else {
- OFSNListHandler handler = OFSNObjectFactory.getListHandler(className);
- LOG.log(Level.INFO, "Getting handler config for RT: ["+rtType+"]");
- handler.configure(this.conf.getHandlerConfig(rtType).getHandlerConf());
- HANDLER_CACHE.put(rtType, handler);
- return handler;
- }
- }
-
- private OFSNGetHandler getGetHandler(String rtType, String className) {
- if (HANDLER_CACHE.containsKey(rtType)) {
- return (OFSNGetHandler) HANDLER_CACHE.get(rtType);
- } else {
- OFSNGetHandler handler = OFSNObjectFactory.getGetHandler(className);
- handler.configure(this.conf.getHandlerConfig(rtType).getHandlerConf());
- HANDLER_CACHE.put(rtType, handler);
- return handler;
- }
- }
-
- private boolean isListingCmd(String cmd) throws ProductException {
- OFSNHandlerConfig cfg = this.conf.getHandlerConfig(cmd);
- if (cfg == null) {
- throw new ProductException("Unrecognized command: [" + cmd + "]!");
- }
-
- return cfg.getType().equals(LISTING_CMD);
- }
-
- private boolean isGetCmd(String cmd) {
- OFSNHandlerConfig cfg = this.conf.getHandlerConfig(cmd);
-
- return cfg.getType().equals(GET_CMD);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/main/java/org/apache/oodt/product/handlers/ofsn/OFSNFileHandlerConfiguration.java
----------------------------------------------------------------------
diff --git a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/OFSNFileHandlerConfiguration.java b/product/src/main/java/org/apache/oodt/product/handlers/ofsn/OFSNFileHandlerConfiguration.java
deleted file mode 100644
index 46d97c9..0000000
--- a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/OFSNFileHandlerConfiguration.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.product.handlers.ofsn;
-
-//JDK imports
-import java.util.Arrays;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- *
- * The OFSN product handler's configuration object.
- *
- * @author mattmann
- * @version $Revision$
- *
- */
-public class OFSNFileHandlerConfiguration {
-
- protected Map<String, OFSNHandlerConfig> handlerTable;
-
- private String productRoot;
-
- private String id;
-
- private String name;
-
- public OFSNFileHandlerConfiguration(String productRoot, String id, String name) {
- this.handlerTable = new ConcurrentHashMap<String, OFSNHandlerConfig>();
- this.productRoot = productRoot;
- this.id = id;
- this.name = name;
- cleanse(this.productRoot);
- }
-
- public OFSNFileHandlerConfiguration() {
- this(null, null, null);
- }
-
- public String getHandlerType(String handlerName) {
- if (this.handlerTable.containsKey(handlerName)) {
- return this.handlerTable.get(handlerName).getType();
- } else {
- return null;
- }
- }
-
- public String getHandlerClass(String handlerName) {
- if (this.handlerTable.containsKey(handlerName)) {
- return this.handlerTable.get(handlerName).getClassName();
- } else {
- return null;
- }
- }
-
- public List<OFSNHandlerConfig> getHandlerConfigs() {
- return Arrays.asList(this.handlerTable.values().toArray(
- new OFSNHandlerConfig[this.handlerTable.size()]));
- }
-
- public OFSNHandlerConfig getHandlerConfig(String handlerName) {
- return this.handlerTable.get(handlerName);
- }
-
- /**
- * @return the productRoot
- */
- public String getProductRoot() {
- return productRoot;
- }
-
- /**
- * @param productRoot
- * the productRoot to set
- */
- public void setProductRoot(String productRoot) {
- this.productRoot = productRoot;
- cleanse(this.productRoot);
- }
-
- /**
- * @return the id
- */
- public String getId() {
- return id;
- }
-
- /**
- * @param id
- * the id to set
- */
- public void setId(String id) {
- this.id = id;
- }
-
- /**
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param name
- * the name to set
- */
- public void setName(String name) {
- this.name = name;
- }
-
- private void cleanse(String path) {
-
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/main/java/org/apache/oodt/product/handlers/ofsn/OFSNFileHandlerConfigurationReader.java
----------------------------------------------------------------------
diff --git a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/OFSNFileHandlerConfigurationReader.java b/product/src/main/java/org/apache/oodt/product/handlers/ofsn/OFSNFileHandlerConfigurationReader.java
deleted file mode 100644
index feeb738..0000000
--- a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/OFSNFileHandlerConfigurationReader.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.product.handlers.ofsn;
-
-//JDK imports
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.util.Properties;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-
-//OODT imports
-import org.apache.oodt.commons.xml.XMLUtils;
-import org.apache.oodt.product.handlers.ofsn.metadata.OFSNXMLConfigMetKeys;
-
-/**
- *
- * Reads an XML file representation of the {@link OFSNFileHandlerConfiguration}.
- *
- * @author mattmann
- * @version $Revision$
- *
- */
-public final class OFSNFileHandlerConfigurationReader implements
- OFSNXMLConfigMetKeys {
-
- public static OFSNFileHandlerConfiguration getConfig(String filePath)
- throws FileNotFoundException {
- OFSNFileHandlerConfiguration config = new OFSNFileHandlerConfiguration();
-
- Document configDoc = XMLUtils.getDocumentRoot(new FileInputStream(new File(
- filePath)));
- Element configElem = configDoc.getDocumentElement();
- config.setId(configElem.getAttribute(OFSN_CFG_ID_ATTR));
- config.setName(configElem.getAttribute(OFSN_CFG_NAME_ATTR));
- config.setProductRoot(configElem.getAttribute(OFSN_PRODUCT_ROOT_ATTR));
- addHandlers(configElem, config);
- return config;
- }
-
- private static void addHandlers(Element configRootElem,
- OFSNFileHandlerConfiguration config) {
- NodeList handlerNodes = configRootElem.getElementsByTagName(HANDLER_TAG);
- for (int i = 0; i < handlerNodes.getLength(); i++) {
- OFSNHandlerConfig cfg = getHandlerConfig((Element) handlerNodes.item(i));
- config.handlerTable.put(cfg.getName(), cfg);
- }
- }
-
- private static OFSNHandlerConfig getHandlerConfig(Element handlerNodeElem) {
- OFSNHandlerConfig cfg = new OFSNHandlerConfig();
- cfg.setClassName(handlerNodeElem.getAttribute(HANDLER_CLASSNAME_ATTR));
- cfg.setName(handlerNodeElem.getAttribute(HANDLER_NAME_ATTR));
- cfg.setType(handlerNodeElem.getAttribute(HANDLER_TYPE_ATTR));
- cfg.setHandlerConf(readConfig(handlerNodeElem));
- return cfg;
- }
-
- private static Properties readConfig(Element handlerNodeElem) {
- Properties config = new Properties();
- NodeList propertyNodes = handlerNodeElem.getElementsByTagName(PROPERTY_TAG);
-
- if (propertyNodes != null && propertyNodes.getLength() > 0) {
- for (int j = 0; j < propertyNodes.getLength(); j++) {
- Element propertyElem = (Element) propertyNodes.item(j);
- String propertyName = propertyElem.getAttribute(PROPERTY_NAME_ATTR);
- String propertyValue = propertyElem.getAttribute(PROPERTY_VALUE_ATTR);
-
- config.setProperty(propertyName, propertyValue);
- }
- }
-
- return config;
- }
-}
[50/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/MainWindow.java
----------------------------------------------------------------------
diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/MainWindow.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/MainWindow.java
deleted file mode 100644
index 65fd483..0000000
--- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/MainWindow.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.filemgr.browser.view;
-
-import org.apache.oodt.cas.filemgr.browser.controller.WindowListener;
-import org.apache.oodt.cas.filemgr.browser.view.menus.MenuBar;
-import org.apache.oodt.cas.filemgr.browser.view.panels.BottomPane;
-import org.apache.oodt.cas.filemgr.browser.view.panels.HeaderRow;
-import org.apache.oodt.cas.filemgr.browser.view.panels.MiddlePane;
-import org.apache.oodt.cas.filemgr.browser.view.panels.QueryPane;
-
-import java.awt.*;
-
-import javax.swing.*;
-
-public class MainWindow extends JFrame {
-
- public QueryPane qPane;
- public MiddlePane mPane;
- public BottomPane bPane;
- public MenuBar bar;
-
- private WindowListener wListener;
-
- public MainWindow() {
- wListener = new WindowListener(this);
- setName("CAS File Manager Browser");
- setDefaultCloseOperation(EXIT_ON_CLOSE);
- qPane = new QueryPane(wListener);
- mPane = new MiddlePane();
- bPane = new BottomPane();
- Dimension d = new Dimension(GuiParams.WINDOW_WIDTH, GuiParams.WINDOW_HEIGHT);
- Container p = this.getContentPane();
- p.setPreferredSize(d);
- p.setMinimumSize(d);
- p.setMaximumSize(d);
- p.setBackground(Color.WHITE);
- p.setLayout(new BorderLayout());
- p.add(qPane, BorderLayout.NORTH);
- p.add(mPane, BorderLayout.CENTER);
- p.add(bPane, BorderLayout.SOUTH);
-
- bar = new MenuBar(wListener, mPane.getListener());
- this.setJMenuBar(bar);
- }
-
- public String[] getColHeaders() {
- HeaderRow h = mPane.tPane.getHeader();
- String[] heading = new String[h.getNumCols()];
- for (int i = 0; i < h.getNumCols(); i++) {
- heading[i] = h.getText(i);
- }
- return heading;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/menus/MenuBar.java
----------------------------------------------------------------------
diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/menus/MenuBar.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/menus/MenuBar.java
deleted file mode 100644
index 897d331..0000000
--- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/menus/MenuBar.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.filemgr.browser.view.menus;
-
-import java.awt.event.ActionListener;
-import java.awt.event.KeyEvent;
-
-import javax.swing.*;
-
-public class MenuBar extends JMenuBar {
-
- private JMenu fileMenu;
- private JMenu queryMenu;
- private JMenu helpMenu;
-
- private JMenuItem queryItem;
- private JMenuItem aboutItem;
- private JMenuItem clearItem;
- private JMenuItem unhideItem;
- private JMenuItem exportItem;
- private JMenuItem exitItem;
- private JMenuItem sortItem;
- private JMenuItem advancedItem;
- private JMenuItem connectItem;
-
- public MenuBar(ActionListener windowListener, ActionListener tableListener) {
- fileMenu = new JMenu("File");
- fileMenu.setMnemonic(KeyEvent.VK_F);
- queryMenu = new JMenu("Query");
- queryMenu.setMnemonic(KeyEvent.VK_Q);
- helpMenu = new JMenu("Help");
-
- // build help menu
- queryItem = new JMenuItem("Query Language");
- queryItem.addActionListener(windowListener);
- aboutItem = new JMenuItem("About");
- aboutItem.addActionListener(windowListener);
- helpMenu.add(queryItem);
- helpMenu.addSeparator();
- helpMenu.add(aboutItem);
-
- // build query menu
- clearItem = new JMenuItem("Clear Query");
- clearItem.addActionListener(windowListener);
- advancedItem = new JMenuItem("Query Builder");
- advancedItem.addActionListener(windowListener);
- sortItem = new JMenuItem("Sort");
- sortItem.addActionListener(windowListener);
- unhideItem = new JMenuItem("Unhide Columns");
- unhideItem.addActionListener(tableListener);
- queryMenu.add(unhideItem);
- queryMenu.add(advancedItem);
- queryMenu.add(sortItem);
- queryMenu.addSeparator();
- queryMenu.add(clearItem);
-
- // build file menu
- connectItem = new JMenuItem("Connect...");
- connectItem.addActionListener(windowListener);
- exportItem = new JMenuItem("Export Table");
- exportItem.addActionListener(tableListener);
- exitItem = new JMenuItem("Exit");
- exitItem.addActionListener(windowListener);
- fileMenu.add(connectItem);
- fileMenu.add(exportItem);
- fileMenu.addSeparator();
- fileMenu.add(exitItem);
-
- add(fileMenu);
- add(queryMenu);
- add(helpMenu);
- }
-
- public void changeConnectStatus() {
- if (connectItem.getActionCommand().equals("Connect...")) {
- connectItem.setActionCommand("Disconnect");
- connectItem.setText("Disconnect");
- } else {
- connectItem.setActionCommand("Connect...");
- connectItem.setText("Connect...");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/menus/RightClickMenu.java
----------------------------------------------------------------------
diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/menus/RightClickMenu.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/menus/RightClickMenu.java
deleted file mode 100644
index 0c0f64c..0000000
--- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/menus/RightClickMenu.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.filemgr.browser.view.menus;
-
-import java.awt.event.ActionListener;
-
-import javax.swing.JMenuItem;
-import javax.swing.JPopupMenu;
-
-public class RightClickMenu extends JPopupMenu {
-
- private JMenuItem hideItem;
- private JMenuItem unhideItem;
-
- public RightClickMenu(ActionListener listener) {
-
- hideItem = new JMenuItem("Hide");
- hideItem.addActionListener(listener);
- unhideItem = new JMenuItem("Unhide");
- unhideItem.addActionListener(listener);
-
- this.add(hideItem);
- this.add(unhideItem);
- }
-
- public void setUnhideMode() {
- hideItem.setEnabled(false);
- unhideItem.setEnabled(true);
- }
-
- public void setHideMode() {
- hideItem.setEnabled(true);
- unhideItem.setEnabled(false);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/BottomPane.java
----------------------------------------------------------------------
diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/BottomPane.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/BottomPane.java
deleted file mode 100644
index 85f1419..0000000
--- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/BottomPane.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.filemgr.browser.view.panels;
-
-import java.awt.Color;
-import java.awt.Font;
-
-import javax.swing.BoxLayout;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.border.CompoundBorder;
-import javax.swing.border.EmptyBorder;
-import javax.swing.border.LineBorder;
-
-public class BottomPane extends JPanel {
-
- public JLabel statusMessage;
-
- public BottomPane() {
-
- // set background and panel size
- setBackground(Color.WHITE);
- EmptyBorder line1 = new EmptyBorder(4, 10, 4, 2);
- LineBorder line2 = new LineBorder(Color.BLACK, 1);
- EmptyBorder line3 = new EmptyBorder(4, 10, 4, 10);
- CompoundBorder cb1 = new CompoundBorder(line1, line2);
- CompoundBorder cb2 = new CompoundBorder(cb1, line3);
- setBorder(cb2);
-
- JLabel statusLabel = new JLabel(" Status: ");
- statusLabel.setFont(new Font("san-serif", Font.PLAIN, 10));
-
- statusMessage = new JLabel(" Disconnected");
- statusMessage.setFont(new Font("san-serif", Font.PLAIN, 10));
- statusMessage.setForeground(Color.RED);
- statusMessage.setBackground(Color.WHITE);
-
- // set layout
- setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
- add(statusLabel);
- add(statusMessage);
- }
-
- public void changeStatus(String status) {
- statusMessage.setText(status);
- this.repaint();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/Cell.java
----------------------------------------------------------------------
diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/Cell.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/Cell.java
deleted file mode 100644
index e5a29ea..0000000
--- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/Cell.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.filemgr.browser.view.panels;
-
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Font;
-
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.border.LineBorder;
-
-import org.apache.oodt.cas.filemgr.browser.view.GuiParams;
-
-public class Cell extends JPanel {
-
- protected JLabel text;
-
- public Cell() {
- setLayout(new BorderLayout());
- setBackground(Color.WHITE);
- setForeground(Color.BLACK);
- Dimension size = new Dimension(GuiParams.DEFAULT_CELL_WIDTH,
- GuiParams.DEFAULT_CELL_HEIGHT);
- setMinimumSize(size);
- setMaximumSize(size);
- setPreferredSize(size);
- setBorder(new LineBorder(Color.LIGHT_GRAY, 1));
-
- text = new JLabel("");
- Font f = new Font("san-sarif", Font.PLAIN, 10);
- text.setFont(f);
- this.add(text, BorderLayout.CENTER);
- }
-
- public void setText(String newText) {
- text.setText(newText);
- }
-
- public String getText() {
- return text.getText();
- }
-
- public void setWidth(int newWidth) {
- Dimension size = this.getSize();
- size.width = newWidth;
- this.setSize(size);
- text.setSize(size);
- }
-
- public void setHeight(int newHeight) {
- Dimension size = this.getSize();
- size.height = newHeight;
- this.setSize(size);
- text.setSize(size);
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/HeaderCell.java
----------------------------------------------------------------------
diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/HeaderCell.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/HeaderCell.java
deleted file mode 100644
index 50c8453..0000000
--- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/HeaderCell.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.filemgr.browser.view.panels;
-
-import org.apache.oodt.cas.filemgr.browser.view.GuiParams;
-
-import java.awt.*;
-import java.awt.event.MouseListener;
-
-public class HeaderCell extends Cell {
-
- private int colNum;
-
- public HeaderCell(MouseListener listener, int colNum) {
- super();
- this.setBackground(Color.LIGHT_GRAY);
- this.setBorder(null);
- Dimension size = new Dimension(GuiParams.DEFAULT_CELL_WIDTH - 2,
- GuiParams.DEFAULT_CELL_HEIGHT);
- setMinimumSize(size);
- setMaximumSize(size);
- setPreferredSize(size);
- Font f = new Font("san-serif", Font.BOLD, 11);
- text.setFont(f);
-
- this.colNum = colNum;
- this.addMouseListener(listener);
- }
-
- public int getColNum() {
- return colNum;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/HeaderRow.java
----------------------------------------------------------------------
diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/HeaderRow.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/HeaderRow.java
deleted file mode 100644
index 6980edf..0000000
--- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/HeaderRow.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.filemgr.browser.view.panels;
-
-import java.awt.Color;
-import java.awt.event.MouseListener;
-
-import javax.swing.BoxLayout;
-import javax.swing.JPanel;
-
-public class HeaderRow extends JPanel {
-
- private HeaderCell cells[];
- private int numCells;
-
- public HeaderRow(MouseListener listener, int numCells) {
- // create cells
- this.numCells = numCells;
- cells = new HeaderCell[numCells];
- for (int i = 0; i < numCells; i++) {
- cells[i] = new HeaderCell(listener, i);
- }
-
- // set background, etc.
- this.setBackground(Color.WHITE);
- this.setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
-
- for (int i = 0; i < numCells; i++) {
- this.add(cells[i]);
- this.add(new HeaderSpacer(listener, i));
- }
- }
-
- public int getNumCols() {
- return numCells;
- }
-
- public void hideCol(int colNum) {
- int trueNum = colNum * 2;
- HeaderCell c = (HeaderCell) this.getComponent(trueNum);
- c.setVisible(false);
- HeaderSpacer sp = (HeaderSpacer) this.getComponent(trueNum + 1);
- sp.setVisible(false);
- }
-
- public void unhideCol(int colNum) {
- int trueNum = colNum * 2;
- HeaderCell c = (HeaderCell) this.getComponent(trueNum);
- c.setVisible(true);
- HeaderSpacer sp = (HeaderSpacer) this.getComponent(trueNum + 1);
- sp.setVisible(true);
- }
-
- public void setText(int colNum, String text) {
- int trueNum = colNum * 2;
- HeaderCell c = (HeaderCell) this.getComponent(trueNum);
- c.setText(text);
- c.repaint();
- }
-
- public String getText(int colNum) {
- int trueNum = colNum * 2;
- HeaderCell c = (HeaderCell) this.getComponent(trueNum);
- return c.getText();
- }
-
- public int getWidth(int colNum) {
- int trueNum = colNum * 2;
- HeaderCell c = (HeaderCell) this.getComponent(trueNum);
- return c.getWidth();
- }
-
- public void changeWidth(int colNum, int newWidth) {
- int trueNum = colNum * 2;
- HeaderCell c = (HeaderCell) this.getComponent(trueNum);
- int change = c.getWidth() - newWidth;
- c.setWidth(newWidth);
- for (int i = trueNum + 1; i < this.getComponentCount(); i++) {
- this.getComponent(i).setLocation(this.getComponent(i).getX() - change,
- this.getComponent(i).getY());
- }
- this.repaint();
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/HeaderSpacer.java
----------------------------------------------------------------------
diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/HeaderSpacer.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/HeaderSpacer.java
deleted file mode 100644
index e8f8f19..0000000
--- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/HeaderSpacer.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.filemgr.browser.view.panels;
-
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.event.MouseListener;
-
-import javax.swing.JPanel;
-
-import org.apache.oodt.cas.filemgr.browser.view.GuiParams;
-
-public class HeaderSpacer extends JPanel {
-
- private int col;
-
- public HeaderSpacer(MouseListener listener, int pos) {
- // set background, size
- this.setBackground(Color.WHITE);
- Dimension d = new Dimension(2, GuiParams.DEFAULT_CELL_HEIGHT);
- this.setMinimumSize(d);
- this.setMaximumSize(d);
- this.setPreferredSize(d);
-
- col = pos;
- this.addMouseListener(listener);
- }
-
- public int getColNum() {
- return col;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/MiddlePane.java
----------------------------------------------------------------------
diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/MiddlePane.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/MiddlePane.java
deleted file mode 100644
index 35f4ed2..0000000
--- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/MiddlePane.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.filemgr.browser.view.panels;
-
-import java.awt.BorderLayout;
-import java.awt.Color;
-
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-
-import org.apache.oodt.cas.filemgr.browser.controller.TableListener;
-
-public class MiddlePane extends JPanel {
-
- public TablePane tPane;
-
- public MiddlePane() {
- this.setBackground(Color.WHITE);
- this.setLayout(new BorderLayout());
-
- tPane = new TablePane();
-
- JPanel inset = new JPanel();
- inset.setBackground(Color.WHITE);
- inset.setLayout(new BorderLayout());
- inset.add(tPane, BorderLayout.WEST);
-
- JScrollPane scrollPane = new JScrollPane(inset);
-
- this.add(scrollPane, BorderLayout.CENTER);
- }
-
- public TableListener getListener() {
- return tPane.getListener();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/QueryField.java
----------------------------------------------------------------------
diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/QueryField.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/QueryField.java
deleted file mode 100644
index a707ec7..0000000
--- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/QueryField.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.filemgr.browser.view.panels;
-
-import java.awt.*;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.*;
-
-public class QueryField extends JPanel implements ActionListener {
-
- private JTextField text;
- private JButton button;
- private JComboBox types;
-
- public QueryField(ActionListener listener) {
-
- // setbackground an size for panel
- setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
- setBackground(Color.WHITE);
- setMinimumSize(new Dimension(500, 50));
- setPreferredSize(new Dimension(500, 50));
-
- text = new JTextField(30);
- button = new JButton("Search");
- String[] blankType = { "" };
- types = new JComboBox(blankType);
-
- // set background and size for textbox and combo
- text.setForeground(Color.BLACK);
- text.setBackground(Color.WHITE);
- text.setMinimumSize(new Dimension(100, 25));
- text.setPreferredSize(new Dimension(100, 25));
- text.setMaximumSize(new Dimension(100, 25));
- text.addActionListener(this);
- Dimension typeDim = new Dimension(100, 25);
- types.setMaximumSize(typeDim);
- types.setMinimumSize(typeDim);
- types.setPreferredSize(typeDim);
- types.setBackground(Color.WHITE);
-
- // set button
- button.setBackground(Color.WHITE);
- button.addActionListener(listener);
- button.setName("Query");
-
- add(new JLabel("ProductType: "));
- add(types);
- add(new JLabel(" Query: "));
- add(text);
- add(button);
- }
-
- public String getQueryString() {
- return text.getText();
- }
-
- public void clearQuery() {
- text.setText("");
- }
-
- public String getProductType() {
- return types.getSelectedItem().toString();
- }
-
- public void updateTypes(String[] typeNames) {
- this.remove(types);
- types = new JComboBox(typeNames);
- types.setBackground(Color.WHITE);
- Dimension typeDim = new Dimension(100, 25);
- types.setMaximumSize(typeDim);
- types.setMinimumSize(typeDim);
- types.setPreferredSize(typeDim);
- add(types, 1);
- this.repaint();
- }
-
- public void actionPerformed(ActionEvent arg0) {
- button.doClick();
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/QueryPane.java
----------------------------------------------------------------------
diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/QueryPane.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/QueryPane.java
deleted file mode 100644
index eb8821a..0000000
--- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/QueryPane.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.filemgr.browser.view.panels;
-
-import org.apache.oodt.cas.filemgr.browser.view.GuiParams;
-
-import java.awt.*;
-import java.awt.event.ActionListener;
-
-import javax.swing.*;
-import javax.swing.border.CompoundBorder;
-import javax.swing.border.EmptyBorder;
-import javax.swing.border.LineBorder;
-
-public class QueryPane extends JPanel {
-
- private QueryField field;
-
- public QueryPane(ActionListener listener) {
- super(new BorderLayout());
-
- // set background and panel size
- setBackground(Color.WHITE);
- Dimension paneSize = new Dimension();
- paneSize.width = GuiParams.WINDOW_WIDTH;
- paneSize.height = (int) (GuiParams.WINDOW_HEIGHT * (0.1));
-
- // set border
- EmptyBorder line1 = new EmptyBorder(2, 10, 2, 2);
- LineBorder line2 = new LineBorder(Color.BLACK, 1);
- CompoundBorder cp = new CompoundBorder(line1, line2);
- this.setBorder(cp);
-
- // add query field to pane
- field = new QueryField(listener);
- add(field, BorderLayout.EAST);
- }
-
- public String getQuery() {
- return field.getQueryString();
- }
-
- public void clearQuery() {
- field.clearQuery();
- }
-
- public String getType() {
- return field.getProductType();
- }
-
- public void updateTypes(String[] types) {
- field.updateTypes(types);
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/Row.java
----------------------------------------------------------------------
diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/Row.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/Row.java
deleted file mode 100644
index d127180..0000000
--- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/Row.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.filemgr.browser.view.panels;
-
-import java.awt.Color;
-
-import javax.swing.BoxLayout;
-import javax.swing.JPanel;
-
-public class Row extends JPanel {
-
- private Cell cells[];
-
- public Row(int numCells) {
- // create cells
- cells = new Cell[numCells];
- for (int i = 0; i < numCells; i++) {
- cells[i] = new Cell();
- cells[i].setText("");
- }
-
- // set background, etc.
- this.setBackground(Color.WHITE);
- this.setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
-
- for (int i = 0; i < numCells; i++) {
- this.add(cells[i]);
- }
- }
-
- public void hideCol(int colNum) {
- Cell c = (Cell) this.getComponent(colNum);
- c.setVisible(false);
- }
-
- public void unhideCol(int colNum) {
- Cell c = (Cell) this.getComponent(colNum);
- c.setVisible(true);
- }
-
- public void setText(int colNum, String text) {
- Cell c = (Cell) this.getComponent(colNum);
- c.setText(text);
- c.repaint();
- }
-
- public String getText(int colNum) {
- Cell c = (Cell) this.getComponent(colNum);
- return c.getText();
- }
-
- public int getWidth(int colNum) {
- Cell c = (Cell) this.getComponent(colNum);
- return c.getWidth();
- }
-
- public void changeWidth(int colNum, int newWidth) {
- Cell c = (Cell) this.getComponent(colNum);
- int change = c.getWidth() - newWidth;
- c.setWidth(newWidth);
- for (int i = colNum + 1; i < this.getComponentCount(); i++) {
- this.getComponent(i).setLocation(this.getComponent(i).getX() - change,
- this.getComponent(i).getY());
- }
- this.repaint();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/TablePane.java
----------------------------------------------------------------------
diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/TablePane.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/TablePane.java
deleted file mode 100644
index 3c06a60..0000000
--- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/panels/TablePane.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.filemgr.browser.view.panels;
-
-import org.apache.oodt.cas.filemgr.browser.controller.TableListener;
-
-import java.awt.*;
-import java.util.Vector;
-
-import javax.swing.*;
-import javax.swing.border.LineBorder;
-
-public class TablePane extends JPanel{
-
- public Vector<Integer> hiddenCols;
- public HeaderRow header;
-
- private TableListener listener;
-
- public TablePane(){
- listener = new TableListener(this);
-
- hiddenCols = new Vector<Integer>();
- setBackground(Color.WHITE);
- LineBorder line1 = new LineBorder(Color.WHITE,10);
- setBorder(line1);
-
- setLayout(new BoxLayout(this,BoxLayout.PAGE_AXIS));
-
- this.setBlank();
- }
-
- public TableListener getListener(){
- return listener;
- }
-
- public void setBlank(){
- this.removeAll();
- int numColumns = 10;
- int numRows = 20;
- header = new HeaderRow(listener,numColumns);
- add(header);
-
- for(int i=0;i<numRows;i++){
- Row r = new Row(numColumns);
- add(r);
- }
-
- this.validate();
- this.repaint();
- }
-
- public void newTable(String[][] data){
- this.removeAll();
- if(data.length>1){
- header = new HeaderRow(listener,data[0].length);
- for(int j=0;j<data[0].length;j++){
- header.setText(j, data[0][j]);
- }
- this.add(header);
-
- for(int j=1;j<data.length;j++){
- Row r = new Row(data[0].length);
- for(int k=0;k<data[0].length;k++){
- r.setText(k, data[j][k]);
- }
- this.add(r);
- }
- }
- this.validate();
- this.repaint();
- }
-
- public HeaderRow getHeader(){
- return header;
- }
-
- public void sortRows(int col, String sortType){
- int length = this.getComponentCount();
- int i,j;
-
- for (i=length; --i >=1;) {
- for (j=1; j<i;j++) {
- Row jThRow = (Row)this.getComponent(j);
- Row iThRow = (Row)this.getComponent(i);
- if(sortType.equals("Accending")){
- if(jThRow.getText(col).compareTo(iThRow.getText(col))>0){
- swapRows(j,j+1);
- }
- } else {
- if(jThRow.getText(col).compareTo(iThRow.getText(col))<0){
- swapRows(j,j+1);
- }
- }
- }
- }
- this.validate();
- this.repaint();
-
- }
-
- public void swapRows(int index1, int index2){
- Component c1 = this.getComponent(index1);
- Component c2 = this.getComponent(index2);
- this.add(c1, index2);
- this.add(c2, index1);
- }
-
- public Row getRow(int num){
- Row r = null;
- if(num<this.getComponentCount()-1){
- r = (Row)this.getComponent(num+1);
- }
- return r;
- }
-
- public void hideColumn(int colNum){
- header.hideCol(colNum);
- for(int i=1;i<this.getComponentCount();i++){
- ((Row)this.getComponent(i)).hideCol(colNum);
- }
- hiddenCols.add(colNum);
- }
-
- public void unhideColumn(int colNum){
- header.unhideCol(colNum);
- for(int i=1;i<this.getComponentCount();i++){
- ((Row)this.getComponent(i)).unhideCol(colNum);
- }
- hiddenCols.remove(Integer.valueOf(colNum));
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/prompts/ConnectPrompt.java
----------------------------------------------------------------------
diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/prompts/ConnectPrompt.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/prompts/ConnectPrompt.java
deleted file mode 100644
index e95c50a..0000000
--- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/prompts/ConnectPrompt.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.filemgr.browser.view.prompts;
-
-import java.awt.*;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.*;
-import javax.swing.border.EmptyBorder;
-
-public class ConnectPrompt extends JFrame implements ActionListener {
-
- private CASField topPanel;
- private ConnectButton bottomPanel;
-
- public ConnectPrompt(ActionListener listener) {
- this.setName("New Connection");
- this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
- Dimension d = new Dimension(400, 100);
- this.setMinimumSize(d);
- this.setMaximumSize(d);
- this.setPreferredSize(d);
-
- this.getContentPane().setLayout(
- new BoxLayout(this.getContentPane(), BoxLayout.Y_AXIS));
- this.getContentPane().setBackground(Color.WHITE);
-
- topPanel = new CASField(this);
- bottomPanel = new ConnectButton(listener);
- this.add(topPanel);
- this.add(bottomPanel);
- }
-
- public String getCASUrl() {
- return topPanel.casRef.getText();
- }
-
- private class CASField extends JPanel {
-
- protected JTextField casRef;
-
- protected CASField(ActionListener listener) {
- this.setBackground(Color.WHITE);
- this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
- Dimension d = new Dimension(400, 30);
- this.setMaximumSize(d);
- this.setMinimumSize(d);
- this.setPreferredSize(d);
-
- EmptyBorder line1 = new EmptyBorder(5, 10, 5, 5);
- this.setBorder(line1);
-
- this.add(new JLabel("CAS File Manager URL: "));
- casRef = new JTextField();
- casRef.addActionListener(listener);
- this.add(casRef);
- }
- }
-
- private class ConnectButton extends JPanel {
-
- protected JButton connect;
- protected JButton cancel;
-
- protected ConnectButton(ActionListener listener) {
- this.setBackground(Color.WHITE);
- this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
-
- EmptyBorder line1 = new EmptyBorder(5, 20, 5, 5);
- this.setBorder(line1);
-
- this.add(new JLabel(" "));
- connect = new JButton("Connect");
- connect.setBackground(Color.WHITE);
- connect.addActionListener(listener);
- cancel = new JButton("Cancel");
- cancel.setBackground(Color.WHITE);
- cancel.addActionListener(listener);
- cancel.setName("ConnectCancel");
- this.add(cancel);
- this.add(connect);
- }
- }
-
- public void actionPerformed(ActionEvent arg0) {
- bottomPanel.connect.doClick();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/prompts/QueryBuilderPrompt.java
----------------------------------------------------------------------
diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/prompts/QueryBuilderPrompt.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/prompts/QueryBuilderPrompt.java
deleted file mode 100644
index 49ab623..0000000
--- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/prompts/QueryBuilderPrompt.java
+++ /dev/null
@@ -1,444 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.filemgr.browser.view.prompts;
-
-import org.apache.oodt.cas.filemgr.browser.controller.WindowListener;
-import org.apache.oodt.cas.filemgr.browser.model.CasDB;
-import org.apache.oodt.cas.filemgr.structs.RangeQueryCriteria;
-import org.apache.oodt.cas.filemgr.structs.TermQueryCriteria;
-
-import java.awt.*;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.FocusEvent;
-import java.awt.event.FocusListener;
-
-import javax.swing.*;
-import javax.swing.border.CompoundBorder;
-import javax.swing.border.EmptyBorder;
-import javax.swing.border.LineBorder;
-
-public class QueryBuilderPrompt extends JFrame {
-
- protected CasDB database;
- protected WindowListener listener;
-
- protected TypePanel tPanel;
- protected QuerySelectionPanel qPanel;
- protected JScrollPane scrollPane;
- protected BuiltQueryPane builtPanel;
- protected SearchPanel sPanel;
-
- public QueryBuilderPrompt(CasDB db, WindowListener l) {
-
- database = db;
- listener = l;
-
- this.setName("Query Builder");
- this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
- Dimension d = new Dimension(500, 400);
- this.setMinimumSize(d);
- this.setMaximumSize(d);
- this.setPreferredSize(d);
-
- this.getContentPane().setLayout(
- new BoxLayout(this.getContentPane(), BoxLayout.Y_AXIS));
- this.getContentPane().setBackground(Color.WHITE);
-
- tPanel = new TypePanel(this);
- qPanel = new QuerySelectionPanel(this);
- sPanel = new SearchPanel(this);
- builtPanel = new BuiltQueryPane(this);
-
- scrollPane = new JScrollPane(qPanel);
- Dimension scrollDim = new Dimension(500, 220);
- scrollPane.setMaximumSize(scrollDim);
- scrollPane.setMinimumSize(scrollDim);
- scrollPane.setPreferredSize(scrollDim);
-
- this.getContentPane().add(tPanel);
- this.getContentPane().add(scrollPane);
- this.getContentPane().add(builtPanel);
- this.getContentPane().add(sPanel);
- }
-
- public org.apache.oodt.cas.filemgr.structs.Query getQuery() {
- return qPanel.getCasQuery();
- }
-
- public String getQueryString() {
- return qPanel.getQuery();
- }
-
- public String getProductType() {
- return tPanel.getType();
- }
-
- private class QueryPanel extends JPanel {
-
- private JComboBox elements;
- private JComboBox ops;
- private JPanel placeholder;
- private boolean showOp;
-
- public QueryPanel(QueryBuilderPrompt prompt) {
- Dimension d = new Dimension(460, 35);
- this.setMaximumSize(d);
- this.setMinimumSize(d);
- this.setPreferredSize(d);
- this.setBackground(Color.WHITE);
- this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
-
- showOp = false;
- ops = new JComboBox(new String[] { "AND", "OR", "NOT" });
- Dimension opsDim = new Dimension(75, 25);
- ops.setMaximumSize(opsDim);
- ops.setMinimumSize(opsDim);
- ops.setPreferredSize(opsDim);
- ops.setBackground(Color.WHITE);
- ops.setVisible(false);
-
- placeholder = new JPanel();
- placeholder.setBackground(Color.WHITE);
- placeholder.setMaximumSize(opsDim);
- placeholder.setMinimumSize(opsDim);
- placeholder.setPreferredSize(opsDim);
-
- elements = new JComboBox(prompt.database
- .getAvailableElements(prompt.tPanel.getType()));
- elements.setBackground(Color.WHITE);
- Dimension dElem = new Dimension(150, 25);
- elements.setMaximumSize(dElem);
- elements.setMinimumSize(dElem);
- elements.setPreferredSize(dElem);
-
- this.add(ops);
- this.add(placeholder);
- this.add(elements);
- }
-
- public void addOp() {
- showOp = true;
- ops.setVisible(true);
- placeholder.setVisible(false);
- }
-
- public String getElement() {
- return elements.getSelectedItem().toString();
- }
-
- public String getOp() {
- String op = "";
- if (showOp) {
- op = ops.getSelectedItem().toString();
- }
- return op;
- }
- }
-
- private class TermQueryPanel extends QueryPanel {
-
- private JTextField text;
-
- public TermQueryPanel(QueryBuilderPrompt prompt) {
- super(prompt);
-
- text = new JTextField();
- Dimension dText = new Dimension(150, 25);
- text.setPreferredSize(dText);
- text.setMaximumSize(dText);
- text.setMinimumSize(dText);
- text.setBackground(Color.WHITE);
- text.addFocusListener(prompt.builtPanel);
- text.addActionListener(prompt.builtPanel);
-
- this.add(new JLabel(" Matches "));
- this.add(text);
- }
-
- public String getText() {
- return text.getText();
- }
-
- }
-
- private class RangeQueryPanel extends QueryPanel {
-
- private JTextField start;
- private JTextField stop;
-
- public RangeQueryPanel(QueryBuilderPrompt prompt) {
- super(prompt);
-
- start = new JTextField();
- stop = new JTextField();
-
- Dimension dText = new Dimension(60, 25);
- start.setMaximumSize(dText);
- start.setMinimumSize(dText);
- start.setPreferredSize(dText);
- start.addFocusListener(prompt.builtPanel);
- start.addActionListener(prompt.builtPanel);
-
- stop.setMaximumSize(dText);
- stop.setMinimumSize(dText);
- stop.setPreferredSize(dText);
- stop.addFocusListener(prompt.builtPanel);
- stop.addActionListener(prompt.builtPanel);
-
- this.add(new JLabel(" Between "));
- this.add(start);
- this.add(new JLabel(" And "));
- this.add(stop);
- }
-
- public String getStart() {
- return start.getText();
- }
-
- public String getStop() {
- return stop.getText();
- }
-
- }
-
- private class QuerySelectionPanel extends JPanel implements ActionListener {
-
- private JButton addTerm;
- private JButton addRange;
- private QueryBuilderPrompt prompt;
-
- public QuerySelectionPanel(QueryBuilderPrompt prompt) {
- this.prompt = prompt;
- this.setBackground(Color.WHITE);
-
- EmptyBorder line1 = new EmptyBorder(2, 2, 2, 2);
- LineBorder line2 = new LineBorder(Color.BLACK, 1);
- CompoundBorder cp = new CompoundBorder(line1, line2);
- this.setBorder(cp);
- this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
-
- JPanel buttonPanel = new JPanel();
- Dimension buttonDim = new Dimension(460, 30);
- buttonPanel.setMaximumSize(buttonDim);
- buttonPanel.setMinimumSize(buttonDim);
- buttonPanel.setPreferredSize(buttonDim);
- buttonPanel.setBackground(Color.WHITE);
- buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
-
- addTerm = new JButton("Add Term Criteria");
- addTerm.setBackground(Color.WHITE);
- addTerm.addActionListener(this);
-
- addRange = new JButton("Add Range Criteria");
- addRange.setBackground(Color.WHITE);
- addRange.addActionListener(this);
-
- buttonPanel.add(addTerm);
- buttonPanel.add(addRange);
- this.add(buttonPanel);
- }
-
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getActionCommand().equals("Add Term Criteria")) {
- TermQueryPanel tq = new TermQueryPanel(prompt);
- if (this.getComponentCount() > 1) {
- tq.addOp();
- }
- int insertOrder = this.getComponentCount() - 1;
- if (insertOrder < 0) {
- insertOrder = 0;
- }
- this.add(tq, insertOrder);
- this.validate();
- prompt.scrollPane.validate();
- } else if (arg0.getActionCommand().equals("Add Range Criteria")) {
- RangeQueryPanel rq = new RangeQueryPanel(prompt);
- if (this.getComponentCount() > 1) {
- rq.addOp();
- }
- int insertOrder = this.getComponentCount() - 1;
- if (insertOrder < 0) {
- insertOrder = 0;
- }
- this.add(rq, insertOrder);
- this.validate();
- prompt.scrollPane.validate();
- }
- }
-
- public String getQuery() {
- StringBuilder q = new StringBuilder();
- for (int i = 0; i < this.getComponentCount(); i++) {
- Component c = this.getComponent(i);
- if (c instanceof TermQueryPanel) {
- q.append(((TermQueryPanel) c).getOp()).append(" ");
- q.append(((TermQueryPanel) c).getElement()).append(":");
- q.append(((TermQueryPanel) c).getText()).append(" ");
- } else if (c instanceof RangeQueryPanel) {
- q.append(((RangeQueryPanel) c).getOp()).append(" ");
- q.append(((RangeQueryPanel) c).getElement()).append(":[");
- q.append(((RangeQueryPanel) c).getStart()).append(" TO ");
- q.append(((RangeQueryPanel) c).getStop()).append("] ");
- }
- }
-
- return q.toString();
- }
-
- public org.apache.oodt.cas.filemgr.structs.Query getCasQuery() {
- org.apache.oodt.cas.filemgr.structs.Query q = new org.apache.oodt.cas.filemgr.structs.Query();
- for (int i = 0; i < this.getComponentCount(); i++) {
- Component c = this.getComponent(i);
- String element;
- if (c instanceof TermQueryPanel) {
- element = database.getElementID(((TermQueryPanel) c).getElement());
- String criteria = ((TermQueryPanel) c).getText();
- if (!element.equals("") && !criteria.equals("")) {
- TermQueryCriteria tc = new TermQueryCriteria();
- tc.setElementName(element);
- tc.setValue(criteria);
- q.addCriterion(tc);
- }
- } else if (c instanceof RangeQueryPanel) {
- element = database.getElementID(((RangeQueryPanel) c).getElement());
- String startCriteria = ((RangeQueryPanel) c).getStart();
- String stopCriteria = ((RangeQueryPanel) c).getStop();
- if (!element.equals("") && !startCriteria.equals("")
- && !stopCriteria.equals("")) {
- RangeQueryCriteria rt = new RangeQueryCriteria();
- rt.setElementName(element);
- rt.setStartValue(startCriteria);
- rt.setEndValue(stopCriteria);
- q.addCriterion(rt);
- }
- }
- }
-
- return q;
- }
-
- }
-
- private class SearchPanel extends JPanel {
- private JButton search;
-
- public SearchPanel(QueryBuilderPrompt prompt) {
- Dimension d = new Dimension(500, 40);
- this.setMaximumSize(d);
- this.setMinimumSize(d);
- this.setPreferredSize(d);
- EmptyBorder line1 = new EmptyBorder(2, 2, 2, 2);
- LineBorder line2 = new LineBorder(Color.BLACK, 1);
- CompoundBorder cp = new CompoundBorder(line1, line2);
- this.setBorder(cp);
- this.setLayout(new BorderLayout());
- this.setBackground(Color.WHITE);
-
- search = new JButton("Search");
- search.setName("AdvancedQuery");
- search.addActionListener(prompt.listener);
- search.setBackground(Color.WHITE);
-
- JPanel buttonPanel = new JPanel();
- buttonPanel.setBackground(Color.WHITE);
- buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
- buttonPanel.add(search);
- this.add(buttonPanel, BorderLayout.EAST);
- }
-
- }
-
- private class TypePanel extends JPanel {
-
- private JComboBox types;
-
- public TypePanel(QueryBuilderPrompt prompt) {
-
- Dimension d = new Dimension(500, 40);
- this.setMaximumSize(d);
- this.setMinimumSize(d);
- this.setPreferredSize(d);
- EmptyBorder line1 = new EmptyBorder(2, 2, 2, 2);
- LineBorder line2 = new LineBorder(Color.BLACK, 1);
- CompoundBorder cp = new CompoundBorder(line1, line2);
- this.setBorder(cp);
-
- types = new JComboBox(database.getAvailableTypes());
- types.setBackground(Color.WHITE);
- Dimension tDim = new Dimension(200, 30);
- types.setMaximumSize(tDim);
- types.setMinimumSize(tDim);
- types.setPreferredSize(tDim);
-
- this.setBackground(Color.WHITE);
- this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
-
- JLabel label = new JLabel(" Product Type: ");
-
- this.add(label);
- this.add(types);
- }
-
- public String getType() {
- return types.getSelectedItem().toString();
- }
- }
-
- private class BuiltQueryPane extends JPanel implements FocusListener,
- ActionListener {
-
- private QueryBuilderPrompt p;
- private JTextArea field;
-
- public BuiltQueryPane(QueryBuilderPrompt prompt) {
-
- Dimension d = new Dimension(500, 75);
- this.setMaximumSize(d);
- this.setMinimumSize(d);
- this.setPreferredSize(d);
-
- EmptyBorder line1 = new EmptyBorder(2, 2, 2, 2);
- LineBorder line2 = new LineBorder(Color.BLACK, 1);
- CompoundBorder cp = new CompoundBorder(line1, line2);
- this.setBorder(cp);
- this.setLayout(new BorderLayout());
-
- field = new JTextArea();
- Font font = new Font("san-serif", Font.PLAIN, 10);
- field.setFont(font);
- field.setBackground(Color.WHITE);
- field.setLineWrap(true);
- field.setWrapStyleWord(true);
-
- this.add(field, BorderLayout.CENTER);
- }
-
- public void focusGained(FocusEvent arg0) {
- }
-
- public void focusLost(FocusEvent arg0) {
- field.setText(qPanel.getQuery());
- }
-
- public void actionPerformed(ActionEvent arg0) {
- field.setText(qPanel.getQuery());
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/prompts/SortPrompt.java
----------------------------------------------------------------------
diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/prompts/SortPrompt.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/prompts/SortPrompt.java
deleted file mode 100644
index 5da550b..0000000
--- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/prompts/SortPrompt.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.filemgr.browser.view.prompts;
-
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.event.ActionListener;
-
-import javax.swing.BoxLayout;
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.border.EmptyBorder;
-
-import org.apache.oodt.cas.filemgr.browser.view.MainWindow;
-
-public class SortPrompt extends JFrame {
-
- private ColumnPanel cPanel;
- private ConnectButton cButtons;
-
- public SortPrompt(MainWindow window, ActionListener listener) {
- this.setName("Sort");
- this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
- Dimension d = new Dimension(350, 150);
- this.setMinimumSize(d);
- this.setMaximumSize(d);
- this.setPreferredSize(d);
-
- this.getContentPane().setLayout(
- new BoxLayout(this.getContentPane(), BoxLayout.Y_AXIS));
- this.getContentPane().setBackground(Color.WHITE);
-
- cPanel = new ColumnPanel(window);
- cButtons = new ConnectButton(listener);
- this.add(cPanel);
- this.add(cButtons);
- }
-
- public int getSortIndex() {
- return cPanel.getSortIndex();
- }
-
- public String getSortType() {
- return cPanel.getSortType();
- }
-
- protected class ColumnPanel extends JPanel {
-
- protected JComboBox ColChoices;
- protected JComboBox SortChoices;
- protected JButton cancel;
- protected JButton ok;
-
- public ColumnPanel(MainWindow window) {
- ColChoices = new JComboBox(window.getColHeaders());
- ColChoices.setSelectedIndex(0);
- ColChoices.setBackground(Color.WHITE);
- String[] sortPatterns = { "Accending", "Descending" };
- SortChoices = new JComboBox(sortPatterns);
- SortChoices.setSelectedIndex(0);
- SortChoices.setBackground(Color.WHITE);
-
- Dimension choicesDim = new Dimension(200, 20);
- ColChoices.setMinimumSize(choicesDim);
- ColChoices.setMaximumSize(choicesDim);
- ColChoices.setPreferredSize(choicesDim);
- SortChoices.setMinimumSize(choicesDim);
- SortChoices.setMaximumSize(choicesDim);
- SortChoices.setPreferredSize(choicesDim);
-
- this.setBackground(Color.WHITE);
- this.setLayout(new GridBagLayout());
- GridBagConstraints c = new GridBagConstraints();
-
- EmptyBorder line1 = new EmptyBorder(5, 10, 5, 5);
- this.setBorder(line1);
-
- c.gridx = 0;
- c.gridy = 0;
- c.ipadx = 10;
- c.ipady = 10;
- this.add(new JLabel("Sort By: "), c);
-
- c.gridx = 1;
- c.gridy = 0;
- this.add(ColChoices, c);
-
- c.gridx = 0;
- c.gridy = 1;
- this.add(new JLabel("In Order: "), c);
-
- c.gridx = 1;
- c.gridy = 1;
- this.add(SortChoices, c);
-
- }
-
- public int getSortIndex() {
- return ColChoices.getSelectedIndex();
- }
-
- public String getSortType() {
- return SortChoices.getSelectedItem().toString();
- }
-
- }
-
- private class ConnectButton extends JPanel {
-
- protected JButton connect;
- protected JButton cancel;
-
- protected ConnectButton(ActionListener listener) {
- this.setBackground(Color.WHITE);
- this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
-
- EmptyBorder line1 = new EmptyBorder(5, 20, 5, 5);
- this.setBorder(line1);
-
- this.add(new JLabel(" "));
- connect = new JButton("OK");
- connect.setBackground(Color.WHITE);
- connect.addActionListener(listener);
- cancel = new JButton("Cancel");
- cancel.setBackground(Color.WHITE);
- cancel.addActionListener(listener);
- cancel.setName("SortCancel");
- this.add(cancel);
- this.add(connect);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/.gitignore
----------------------------------------------------------------------
diff --git a/app/weditor/.gitignore b/app/weditor/.gitignore
deleted file mode 100644
index b54523f..0000000
--- a/app/weditor/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/maven-eclipse.xml
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/pom.xml
----------------------------------------------------------------------
diff --git a/app/weditor/pom.xml b/app/weditor/pom.xml
deleted file mode 100644
index 107e4a4..0000000
--- a/app/weditor/pom.xml
+++ /dev/null
@@ -1,110 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more contributor
-license agreements. See the NOTICE.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>
- <parent>
- <groupId>org.apache.oodt</groupId>
- <artifactId>oodt-core</artifactId>
- <version>1.1-SNAPSHOT</version>
- <relativePath>../../core/pom.xml</relativePath>
- </parent>
- <artifactId>weditor</artifactId>
- <name>Catalog and Archive Workflow Management GUI Editor</name>
- <description>Apache OODT Workflow Editor GUI</description>
- <!-- All dependencies should be listed in core/pom.xml and be ordered alphabetically by package and artifact.
- Once the dependency is in the core pom, it can then be used in other modules without the version tags.
- For example, within core/pom.xml:
-
- <dependency>
- <groupId>com.amazonaws</groupId>
- <artifactId>aws-java-sdk</artifactId>
- <version>1.7.4</version>
- </dependency>
-
- Elsewhere in the platform:
- <dependency>
- <groupId>com.amazonaws</groupId>
- <artifactId>aws-java-sdk</artifactId>
- </dependency>
-
- Where possible the same dependency version should be used across the whole platform but if required the version
- can be overridden in a specific pom and should have a comment explaing why the version has been overridden
- -->
- <dependencies>
- <dependency>
- <groupId>jgraph</groupId>
- <artifactId>jgraph</artifactId>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>net.sf.jung</groupId>
- <artifactId>jung-algorithms</artifactId>
- </dependency>
- <dependency>
- <groupId>net.sf.jung</groupId>
- <artifactId>jung-api</artifactId>
- </dependency>
- <dependency>
- <groupId>net.sf.jung</groupId>
- <artifactId>jung-graph-impl</artifactId>
- </dependency>
- <dependency>
- <groupId>net.sf.jung</groupId>
- <artifactId>jung-visualization</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.oodt</groupId>
- <artifactId>cas-workflow</artifactId>
- </dependency>
- </dependencies>
- <build>
- <resources>
- <resource>
- <targetPath>org/apache/oodt/cas/workflow/gui/util</targetPath>
- <directory>${basedir}/src/main/resources/icons</directory>
- <includes>
- <include>**</include>
- </includes>
- </resource>
- </resources>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>2.2-beta-2</version>
- <configuration>
- <descriptors>
- <descriptor>src/main/assembly/assembly.xml</descriptor>
- </descriptors>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>single</goal>
- </goals>
- <phase>package</phase>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/assembly/assembly.xml
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/assembly/assembly.xml b/app/weditor/src/main/assembly/assembly.xml
deleted file mode 100644
index f64863d..0000000
--- a/app/weditor/src/main/assembly/assembly.xml
+++ /dev/null
@@ -1,72 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<assembly>
- <id>dist</id>
- <formats>
- <format>tar.gz</format>
- <format>zip</format>
- </formats>
- <includeBaseDirectory>true</includeBaseDirectory>
- <baseDirectory>${project.artifactId}-${project.version}</baseDirectory>
- <includeSiteDirectory>false</includeSiteDirectory>
- <fileSets>
- <fileSet>
- <directory>${basedir}</directory>
- <outputDirectory>.</outputDirectory>
- <includes>
- <include>LICENSE.txt</include>
- <include>CHANGES.txt</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>${basedir}/src/main/bin</directory>
- <outputDirectory>bin</outputDirectory>
- <includes/>
- <fileMode>755</fileMode>
- </fileSet>
- <fileSet>
- <directory>${basedir}/src/main/resources</directory>
- <outputDirectory>etc</outputDirectory>
- <includes>
- <include>**.properties</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>${basedir}/src/main/resources</directory>
- <outputDirectory>logs</outputDirectory>
- <includes>
- <include>REMOVE.log</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>${basedir}/src/main/resources/examples</directory>
- <outputDirectory>workspace</outputDirectory>
- <includes>
- <include>**</include>
- </includes>
- </fileSet>
- </fileSets>
- <dependencySets>
- <dependencySet>
- <outputDirectory>lib</outputDirectory>
- <unpack>false</unpack>
- <useProjectArtifact>true</useProjectArtifact>
- <useTransitiveDependencies>true</useTransitiveDependencies>
- <unpackOptions/>
- </dependencySet>
- </dependencySets>
-</assembly>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/bin/weditor
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/bin/weditor b/app/weditor/src/main/bin/weditor
deleted file mode 100644
index c17df0e..0000000
--- a/app/weditor/src/main/bin/weditor
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/csh
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-${JAVA_HOME}/bin/java \
- -Djava.ext.dirs=../lib \
- -Djava.util.logging.config.file=../etc/logging.properties \
- org.apache.oodt.cas.workflow.gui.WorkflowGUI
-
-
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/WorkflowGUI.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/WorkflowGUI.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/WorkflowGUI.java
deleted file mode 100644
index 1676a26..0000000
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/WorkflowGUI.java
+++ /dev/null
@@ -1,325 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.workflow.gui;
-
-//Commons import
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.oodt.cas.workflow.gui.menu.EditMenu;
-import org.apache.oodt.cas.workflow.gui.menu.FileMenu;
-import org.apache.oodt.cas.workflow.gui.model.ModelGraph;
-import org.apache.oodt.cas.workflow.gui.model.repo.XmlWorkflowModelRepository;
-import org.apache.oodt.cas.workflow.gui.model.repo.XmlWorkflowModelRepositoryFactory;
-import org.apache.oodt.cas.workflow.gui.perspective.MultiStatePerspective;
-import org.apache.oodt.cas.workflow.gui.perspective.build.BuildPerspective;
-import org.apache.oodt.cas.workflow.gui.perspective.view.View;
-import org.apache.oodt.cas.workflow.gui.perspective.view.ViewState;
-import org.apache.oodt.cas.workflow.gui.toolbox.Tool;
-import org.apache.oodt.cas.workflow.gui.toolbox.ToolBox;
-import org.apache.oodt.cas.workflow.gui.util.IconLoader;
-
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.WindowEvent;
-import java.awt.event.WindowFocusListener;
-import java.io.File;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Vector;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.swing.JFileChooser;
-import javax.swing.JFrame;
-import javax.swing.JMenuBar;
-import javax.swing.SwingUtilities;
-import javax.swing.UIManager;
-
-//OODT imports
-//JDK imports
-
-/**
- *
- *
- * Main driver shell and JFrame for the Workflow Editor GUI.
- *
- * @author bfoster
- * @author mattmann
- *
- */
-public class WorkflowGUI extends JFrame {
- private static Logger LOG = Logger.getLogger(WorkflowGUI.class.getName());
- private static final long serialVersionUID = -8217540440195126377L;
-
- private ToolBox toolbox;
-
- private MultiStatePerspective perspective;
-
- private static AtomicInteger untitledIter = new AtomicInteger(0);
-
- private JMenuBar menu;
-
- private File workspace;
-
- private XmlWorkflowModelRepository repo;
-
- public WorkflowGUI() throws IOException, IllegalAccessException, InstantiationException {
-
- this.addWindowFocusListener(new WindowFocusListener() {
-
- public void windowGainedFocus(WindowEvent e) {
- if (menu != null) {
- menu.revalidate();
- }
- if (toolbox != null) {
- toolbox.revalidate();
- }
- if (perspective != null) {
- perspective.refresh();
- }
- }
-
- public void windowLostFocus(WindowEvent e) {
- }
-
- });
-
- this.setLayout(new BorderLayout());
- this.setPreferredSize(new Dimension(1000, 800));
-
- Vector<Tool> tools = new Vector<Tool>();
- Tool editTool = new Tool(IconLoader.getIcon(IconLoader.EDIT),
- IconLoader.getIcon(IconLoader.EDIT_SELECTED)) {
- private static final long serialVersionUID = 1682845263796161282L;
-
- @Override
- public void onClick() {
- WorkflowGUI.this.perspective.setMode(View.Mode.EDIT);
- }
- };
- tools.add(editTool);
- Tool deleteTool = new Tool(IconLoader.getIcon(IconLoader.DELETE),
- IconLoader.getIcon(IconLoader.DELETE_SELECTED)) {
- private static final long serialVersionUID = 5050127713254634783L;
-
- @Override
- public void onClick() {
- WorkflowGUI.this.perspective.setMode(View.Mode.DELETE);
- }
- };
- tools.add(deleteTool);
- Tool moveTool = new Tool(IconLoader.getIcon(IconLoader.MOVE),
- IconLoader.getIcon(IconLoader.MOVE_SELECTED)) {
- private static final long serialVersionUID = 1682845263796161282L;
-
- @Override
- public void onClick() {
- WorkflowGUI.this.perspective.setMode(View.Mode.MOVE);
- }
- };
- tools.add(moveTool);
- Tool zoomInTool = new Tool(IconLoader.getIcon(IconLoader.ZOOM_IN),
- IconLoader.getIcon(IconLoader.ZOOM_IN_SELECTED)) {
- private static final long serialVersionUID = 1682845263796161282L;
-
- @Override
- public void onClick() {
- WorkflowGUI.this.perspective.setMode(View.Mode.ZOOM_IN);
- }
- };
- tools.add(zoomInTool);
- Tool zoomOutTool = new Tool(IconLoader.getIcon(IconLoader.ZOOM_OUT),
- IconLoader.getIcon(IconLoader.ZOOM_OUT_SELECTED)) {
- private static final long serialVersionUID = 1682845263796161282L;
-
- @Override
- public void onClick() {
- WorkflowGUI.this.perspective.setMode(View.Mode.ZOOM_OUT);
- }
- };
- tools.add(zoomOutTool);
- toolbox = new ToolBox(tools);
- toolbox.setSelected(editTool);
- this.add(toolbox, BorderLayout.NORTH);
-
- this.setJMenuBar(menu = this.generateMenuBar());
- perspective = new BuildPerspective();
- perspective.refresh();
- this.add(perspective, BorderLayout.CENTER);
- }
-
- private void updateWorkspaceText() {
- if (this.workspace == null) {
- this.setTitle(null);
- } else {
- this.setTitle(StringUtils.leftPad("Workspace: " + this.workspace, 100));
- }
- }
-
- private void loadProjects() {
- try {
- XmlWorkflowModelRepositoryFactory factory = new XmlWorkflowModelRepositoryFactory();
- factory.setWorkspace(this.workspace.getAbsolutePath());
- repo = factory.createModelRepository();
- repo.loadGraphs(new HashSet<String>(Arrays.asList("sequential",
- "parallel", "task", "condition")));
- for (File file : repo.getFiles()) {
- List<ModelGraph> graphs = new Vector<ModelGraph>();
- for (ModelGraph graph : repo.getGraphs()) {
- if (graph.getModel().getFile().equals(file)) {
- graphs.add(graph);
- }
- }
- System.out.println(graphs);
- perspective.addState(new ViewState(file, null, graphs, repo
- .getGlobalConfigGroups()));
- }
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- }
- }
-
- public JMenuBar generateMenuBar() {
- JMenuBar bar = new JMenuBar();
- FileMenu fileMenu = new FileMenu();
- bar.add(fileMenu);
- fileMenu.getExit().addActionListener(new ActionListener() {
-
- @Override
- public void actionPerformed(ActionEvent event) {
- System.exit(1);
- }
- });
-
- fileMenu.getOpenWorkspace().addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent event) {
- try {
- JFileChooser chooser = new JFileChooser(new File(".")) {
- boolean acceptFile(File f) {
- return f.isDirectory();
- }
- };
- chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
- int value = chooser.showOpenDialog(WorkflowGUI.this);
- if (value == JFileChooser.APPROVE_OPTION) {
- workspace = chooser.getSelectedFile();
- updateWorkspaceText();
- perspective.reset();
- loadProjects();
- }
- } catch (Exception e1) {
- e1.printStackTrace();
- }
- }
- });
- fileMenu.getImport().addActionListener(new ActionListener() {
-
- public void actionPerformed(ActionEvent event) {
- try {
- if (workspace == null) {
- return;
- }
- JFileChooser chooser = new JFileChooser(new File("."));
- int value = chooser.showOpenDialog(WorkflowGUI.this);
- if (value == JFileChooser.APPROVE_OPTION) {
- File file = chooser.getSelectedFile();
- XmlWorkflowModelRepositoryFactory factory = new XmlWorkflowModelRepositoryFactory();
- factory.setWorkspace(workspace.getAbsolutePath());
- View activeView = perspective.getActiveView();
-
- if (activeView != null) {
- // TODO: add code for import
- }
- }
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- }
- }
-
- });
- fileMenu.getNewWorkspace().addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent event) {
- JFileChooser chooser = new JFileChooser(new File(".")) {
- boolean acceptFile(File f) {
- return f.isDirectory();
- }
- };
- chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
- int value = chooser.showOpenDialog(WorkflowGUI.this);
- if (value == JFileChooser.APPROVE_OPTION) {
- workspace = chooser.getSelectedFile();
- updateWorkspaceText();
- perspective.reset();
- loadProjects();
- perspective.refresh();
- }
- }
- });
-
- fileMenu.getNewProject().addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent event) {
- // TODO: add new project code
- }
- });
- fileMenu.getSave().addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent event) {
- try {
- repo.save();
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- }
- }
- });
- EditMenu editMenu = new EditMenu();
- bar.add(editMenu);
- editMenu.getUndo().addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent event) {
- try {
- perspective.undo();
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- }
- }
- });
- bar.revalidate();
- return bar;
- }
-
- public static void main(String[] args) {
- UIManager.put("TabbedPane.selected", new Color(238, 238, 238));
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- WorkflowGUI gui;
- try {
- gui = new WorkflowGUI();
- gui.pack();
- gui.setVisible(true);
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- }
- }
- });
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/menu/EditMenu.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/menu/EditMenu.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/menu/EditMenu.java
deleted file mode 100644
index db10dba..0000000
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/menu/EditMenu.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.workflow.gui.menu;
-
-//JDK imports
-import javax.swing.JMenu;
-import javax.swing.JMenuItem;
-
-/**
- *
- *
- * Edit menu driver for the Workflow Editor GUI.
- *
- * @author bfoster
- * @author mattmann
- *
- */
-public class EditMenu extends JMenu {
-
- private static final long serialVersionUID = -8368744697132421274L;
-
- private JMenuItem undoItem;
-
- public EditMenu() {
- super("Edit");
- this.add(this.undoItem = new JMenuItem("Undo"));
- }
-
- public JMenuItem getUndo() {
- return this.undoItem;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/menu/FileMenu.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/menu/FileMenu.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/menu/FileMenu.java
deleted file mode 100644
index 599a331..0000000
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/menu/FileMenu.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.workflow.gui.menu;
-
-//JDK imports
-import javax.swing.JMenu;
-import javax.swing.JMenuItem;
-
-/**
- *
- *
- * File menu driver for the Workflow Editor GUI.
- *
- * @author bfoster
- * @author mattmann
- *
- */
-public class FileMenu extends JMenu {
-
- private static final long serialVersionUID = -5702987396916441718L;
-
- private JMenuItem newWorkspace;
- private JMenuItem newProject;
- private JMenuItem openWorkspace;
- private JMenuItem importItem;
- private JMenuItem saveItem;
- private JMenuItem exitItem;
- private JMenu newMenu, openMenu, importMenu;
-
- public FileMenu() {
- super("File");
- this.add(newMenu = new JMenu("New"));
- newMenu.add(this.newWorkspace = new JMenuItem("Workspace"));
- newMenu.add(this.newProject = new JMenuItem("Project"));
- this.add(openMenu = new JMenu("Open"));
- openMenu.add(this.openWorkspace = new JMenuItem("Workspace"));
- this.add(importMenu = new JMenu("Import"));
- importMenu.add(this.importItem = new JMenuItem("Project"));
- this.add(this.saveItem = new JMenuItem("Save Project"));
- this.add(this.exitItem = new JMenuItem("Exit"));
- }
-
- public JMenuItem getOpenWorkspace() {
- return this.openWorkspace;
- }
-
- public JMenuItem getImport() {
- return this.importItem;
- }
-
- public JMenuItem getNewWorkspace() {
- return this.newWorkspace;
- }
-
- public JMenuItem getNewProject() {
- return this.newProject;
- }
-
- public JMenuItem getSave() {
- return this.saveItem;
- }
-
- public JMenuItem getExit(){
- return this.exitItem;
- }
-
-}
[15/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/site/xdoc/info/index.xml
----------------------------------------------------------------------
diff --git a/profile/src/site/xdoc/info/index.xml b/profile/src/site/xdoc/info/index.xml
deleted file mode 100755
index fe44c1f..0000000
--- a/profile/src/site/xdoc/info/index.xml
+++ /dev/null
@@ -1,848 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more contributor
-license agreements. See the NOTICE.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.
--->
-<document>
- <properties>
- <title>Information Captured in a Profile</title>
- <author email="Sean.Kelly@jpl.nasa.gov">Sean Kelly</author>
- </properties>
- <!-- Infected Mushroom - Deeply Disturbed -->
- <body>
- <section name="Information Captured in a Profile">
-
- <p>A profile serves as a generic template for describing the
- characteristics of a resource. The question posed to a profile
- generally takes the form of, "Can you answer <var>X</var>?" or
- "Do you know the location of <var>X</var>?" where <var>X</var>
- is some resource being sought. The more fully a profile describes
- a particular resource, the better the profile can be used to
- determine if the resource has the information in <var>X</var>.
- </p>
-
- </section>
-
- <section name="Information and Organization">
- <p>Profile servers capture three kinds of information:</p>
-
- <ul>
- <li><b>Resource Attributes</b> <p>Resource attributes are
- metadata about the resource's <em>inception</em>. These
- attributes include the creator of the resource, in what
- language it exists, when it was created, and so forth.
- These attributes are based on the work of the <a
- href="http://www.dmci.org/">Dublin Core Metadata Initiative</a>.
- </p>
- </li>
-
- <li><b>Profile Elements</b> <p>Profile elements are metadata
- about the resource's <em>composition</em>. These tell you
- about the morphology of the resource, such as data types
- captured within in, minimum and maximum values, synonymous
- elements, and so forth. These attributes are based on <a
- href="http://metadata-standards.org/11179/">ISO/IEC 11179
- standards</a>.
- </p>
- </li>
-
- <li><b>Profile Attributes</b> <p>Profile attributes are
- metadata about the <em>profile itself</em>, such as who
- made it, whether it's classified, revision notes, and so
- forth. It also has a unique identifying <a
- href="http://www.alvestrand.no/objectid/index.html">Object
- Identifier (OID)</a>.
- </p>
- </li>
- </ul>
-
- <p>The following class diagram shows the relationship between
- the different parts of a profile:
- </p>
-
- <img src="../images/class.png" alt="Class diagram"/>
-
- <p>While this diagram shows the Java field names and Java
- classes, the relationship applies to profiles whether they
- exist as Java objects, as RDF documents, or as XML documents
- in the profile vocabulary.
- </p>
- </section>
-
- <section name="Inception Metadata">
- <p>Profiles, whether expressed in RDF or in their own XML
- vocabulary, have a section for capturing information about the
- resource's inception. This includes information about when the
- resource was created, who created it, in what language it
- exists, and so forth. Profiles use the element set recommended
- by the Dublin Core Metadata Initiative (DCMI) set in order to
- describe the inception of a resource, with some extensions.
- </p>
-
- <p>Collectively, these metadata are called the <i>resource
- attributes</i> or <code>resAttributes</code> of the profile.
- Every profile has one and only one set of
- <code>resAttributes</code>. The metadata elements within the
- <code>resAttributes</code> are defined in this section.
- </p>
-
- <subsection name="Identifier">
- <p>As defined by the DCMI, the <code>Identifier</code> of a
- resource is some unambiguous way to identify the resource.
- In the profile implementation, one and only one
- <code>Identifier</code> is <span
- class="emphasis"><em>required</em></span>.
- </p>
-
- <p>It's highly recommended that <code>Identifier</code>s and
- <code>resLocation</code>s (see below) be URIs, but there's
- no software enforcment for this <em>unless you convert a
- Java profile to RDF</em> with the <code>toRDF</code> method.
- Identifiers should be more like URNs, while resLocations
- should be more like URLs.
- </p>
- </subsection>
- <subsection name="Title">
- <p>The <code>Title</code> names the resource, and is the name by
- which the resource is formally known. The <code>Title</code> is
- optional; if present, it may occur only once in a profile.
- </p>
- </subsection>
- <subsection name="Format">
- <p>The <code>Format</code> indicates the manifestation of the
- resource. You can specify any number of <code>Format</code>s in
- a profile.
- </p>
- </subsection>
- <subsection name="Description">
- <p>The <code>Description</code> element contains a free text
- account of the content of the resource. It's optional in a
- profile; if present, it may occur only once.
- </p>
- </subsection>
- <subsection name="Creator">
- <p>Zero or more <code>Creator</code>s may be specified in a
- profile. <code>Creator</code>s contain the name of people or
- organizations that created the resource.
- </p>
- </subsection>
- <subsection name="Subject">
- <p>You can list zero or more <code>Subject</code>s in a profile.
- The purpose of the <code>Subject</code> elements is to contain a
- keywords that describe the resource, usually selected from a
- controlled vocabulary.
- </p>
- </subsection>
- <subsection name="Publisher">
- <p>Any number of <code>Publisher</code> elements may appear in a
- profile. They contain the organization responsible for
- making the resource available.
- </p>
- </subsection>
- <subsection name="Contributor">
- <p>A <code>Contributor</code> is a person or organization
- providing auxilliary work towards the resource's creation.
- Any number of <code>Contributor</code>s may be listed in a
- profile.
- </p>
- </subsection>
- <subsection name="Date">
- <p><code>Date</code> elements indicate the times in history when
- the resource was created. You can include any number of
- <code>Date</code>s in a profile, although typically you'll
- specify just one if you speciy any at all.
- </p>
- </subsection>
- <subsection name="Type">
- <p>The <code>Type</code> element indicates the nature of the
- content of the resource, such as "fiction" for a work of
- fiction or "image" for a dataset rendered graphically. You
- can include any number of <code>Type</code>s in a profile.
- </p>
- </subsection>
- <subsection name="Source">
- <p>When a resource is derived others, the <code>Source</code>
- element should indicate the <code>Identifier</code>s of the
- referenced resources. You can specify any number of
- <code>Source</code>s in a profile.
- </p>
- </subsection>
- <subsection name="Language">
- <p>For resources that contain natural language content, the
- <code>Language</code> element indicates the languages in use.
- You can specify this element any number of times in a
- profile.
- </p>
- </subsection>
- <subsection name="Relation">
- <p>When a resource is related to others, you can specify the
- <code>Identifier</code>s of the related resources using zero or
- more <code>Relation</code> elements.
- </p>
- </subsection>
- <subsection name="Coverage">
- <p>For resources that cover a space or time or jurisdiction,
- use the <code>Coverage</code> element to indicate such coverage.
- This element may be listed any number of times in a profile,
- and its content should come from a controlled vocabulary.
- For resources with specific coordinate systems, it's better
- to use profile elements, described below.
- </p>
- </subsection>
- <subsection name="Rights">
- <p>Copyright, ownership, redistribution, use, and other legal
- issues may exist for a resource. When that happens, use the
- <code>Rights</code> element to list the rights management
- information. You can list zero or more <code>Rights</code>
- elements in a profile.
- </p>
- <p><em>Note:</em> The official name of element for is plural
- <code>Rights</code>; this is inconsistent with the other
- metadata elements, but is consistent with the DCMI.
- </p>
- </subsection>
- <subsection name="resContext">
- <p>The <code>resContext</code> element identifies the application
- environment or discipline within which the resource
- originates and is derived from a taxonomy of scientific
- disciplines. This element is required in a profile and may
- occur multiple times.
- </p>
-
- <p>As an example, a <code>resContext</code> of
- <code>NASA.PDS.Geoscience</code> tells that the resource is
- associated with the Geoscience node of the Planetary Data
- System.
- </p>
- </subsection>
- <subsection name="resAggregation">
- <p>The <code>resAggregation</code> element indicates the
- aggregative structure of the resource. It tells you what
- you'll get if you retrieve the resource: a granule, a
- dataset, or a collection of datasets. The legal values of
- this optional elements are:
- </p>
-
- <ul>
- <li><code>granule</code>, meaning the resource is a single
- product
- </li>
- <li><code>dataSet</code>, meaning the resource is a set of
- products
- </li>
-
- <li><code>dataSetCollection</code>, meaning the resource is
- collection of datasets
- </li>
- </ul>
-
- <p>The <code>resAggregation</code> element is optional; however,
- if specified, it may appear in a profile only once.
- </p>
- </subsection>
- <subsection name="resClass">
- <p>The <code>resClass</code> element identifies the kind of the
- resource within a taxonomy of resource types. It's a
- <em>required</em> element that is used by the OODT Framework
- to determine how to treat the profile as well as the
- resource named by the profile.
- </p>
-
- <p>For example, a <code>resClass</code> of
- <code>system.productServer</code> indicates that the resource is
- an OODT product server. A query that matches this profile
- means that if the same query were given to the identified
- product server, it would yield a result. A
- <code>resClass</code> of <code>system.profileServer</code> means the
- resource is a profile server. That means that while the
- current profile server may or may not provide a matching
- profile, another profile server might, forming an implicit
- digraph of profile servers. Other valid <code>resClass</code>
- values include <code>data.granule</code>, <code>data.dataSet</code>,
- and <code>application.interface</code>.
- </p>
- </subsection>
-
- <subsection name="resLocation">
- <p>Zero or more <code>resLocation</code> elements may appear in
- a profile. They tell where the resource is located, easily
- the most important part of the profile. Because this
- element may appear several times, all locations should be
- considered valid; the application may pick the one that's
- most convenient. The <code>resLocation</code> may also appear zero
- times. This means that the profile indicates solely that
- the resource existswhere is unknown.
- </p>
-
- <p>The interpretation of the resLocation is as a URI. For
- example, a <code>resClass</code> of
- <code>system.productServer</code> or
- <code>system.profileServer</code> means that the
- <code>resLocation</code> indicates an URN to a software object
- name. Querying that object will yield either the desired
- result (for product servers) or more matching profiles (for
- profile servers). For a resClass of <code>data.granule</code>
- or <code>data.dataSet</code>, the <code>resLocation</code> is an URL
- to the granule or dataset.
- </p>
- </subsection>
- </section>
-
- <section name="Composition Metadata">
- <p>The most interesting part of a profile is in the metadata
- that describes the composition of the resource that the
- profile profiles. The composition metadata is what enables a
- profile server to tell if a particular resource can answer a
- query.
- </p>
-
- <p>The composition metadata is based on the data element
- description standards in ISO/IEC standard 11179. They are the
- <i>profile elements</i> or <code>profElement</code>s of a profile.
- Every profile may have zero or more <code>profElement</code>s, the
- components of which are discussed in this section.
- </p>
-
- <subsection name="elemId">
- <p>The <code>elemId</code> is an optional universally unique
- identifier applied to the element.
- </p>
- </subsection>
- <subsection name="elemName">
- <p>The <code>elemName</code> is the <em>required</em> name of the
- profile element. It serves as the title role of one of the
- components of the resource.
- </p>
- </subsection>
- <subsection name="elemDesc">
- <p>The <code>elemDesc</code> is the description of the profile
- element. Although the title may often be enough to identify
- the purpose of the profile element, the description should
- be used to provide any further, free-text information that
- may be of importance to analysts and profile administrators.
- The description is optional.
- </p>
- </subsection>
- <subsection name="elemType">
- <p>The <code>elemType</code> indicates the type of data
- represented in the profile element, synonymous to the
- ISO/IEC 11179 <code>Datatype</code> attribute. The permissible
- values are:
- </p>
-
- <ul>
- <li><code>boolean</code></li>
- <li><code>character</code></li>
- <li><code>date_time</code></li>
- <li><code>enumerated</code></li>
- <li><code>integer</code></li>
- <li><code>ordinal</code></li>
- <li><code>rational</code></li>
- <li><code>scaled</code></li>
- <li><code>real</code></li>
- <li><code>complex</code></li>
- <li><code>state</code></li>
- <li><code>void</code></li>
- </ul>
-
- <p>This element is optional within a profile element. When
- it's not present, the profile element merely indicates that
- the resource's content possesses the attribute, but more is
- not known.
- </p>
- </subsection>
-
- <subsection name="elemUnit">
- <p>The <code>elemUnit</code> indicates the units associated with
- the values of the data element. This element is synonymous
- to the ISO/IEC 11179 attribute <code>unit.of.quantity</code>.
- Values for this optional element should be selected from
- standardized tables of units.
- </p>
- </subsection>
-
- <subsection name="elemEnumFlag, elemValue, elemMinValue, and elemMaxValue">
- <p>The <code>elemEnumFlag</code> tells how possible values of the
- profile element are specified. It works with the
- <code>elemValue</code>, <code>elemMinValue</code>, and
- <code>elemMaxValue</code> elements:
- </p>
-
- <ul>
- <li>If the <code>elemEnumFlag</code>'s value is <code>T</code> and
- one or more <code>elemValue</code>s appear, then the values
- listed are the valid values of the element.
- </li>
- <li>If the value is <code>F</code>, then a closed range of
- values bounded by the profile's <code>elemMinValue</code> and
- <code>elemMaxValue</code> elements indicates the valid values.
- </li>
- <li>If the value is <code>T</code> but no <code>elemValue</code>s
- appear, then it means that any value is a valid
- value for the resource.
- </li>
- </ul>
-
- </subsection>
-
- <subsection name="elemSynonym">
- <p>Often, a characteristic of a resource will go by several
- names, especially between scientific disciplines. What one
- person may call <i>latitude</i>, another may call <i>x
- coordinate</i>, for example. By specifiyng synonyms for a
- profile element, you can assist in automatic correlation of
- results and cross-disciplinary discovery.
- </p>
-
- <p>The <code>elemSynonym</code> provides a way to do just that.
- Zero or more <code>elemSynonym</code>s may appear in a profile
- element. The values of this element are names from data
- dictionaries other than the discipline data dictionary
- hosting the profile.
- </p>
- </subsection>
- <subsection name="elemObligation">
- <p>The <code>elemObligation</code> tells whether the data element
- is required to always or sometimes be present. This element
- is synonymous to the ISO/IEC 11179 attribute
- <code>Obligation</code>, and is optional within a profile
- element.
- </p>
-
- <p>The legal values for this element are <code>Required</code> and
- <code>Optional</code>, with the obvious meanings.
- </p>
- </subsection>
- <subsection name="elemComment">
- <p>The <code>elemComment</code> field provides a remark concerning
- the application of the data element. This element is
- synonymous to the ISO/IEC 11179 attribute <code>Comment</code>,
- and is optional within a profile element.
- </p>
- </subsection>
- </section>
-
- <section name="Metadata about the Profile">
- <p>For a profile server to manage a set of profiles, it's
- necessary to have metadata contained within the profile that
- describes the profile itself. This metadata, collectively
- called the profile attributes, or <code>profAttributes</code>,
- serves that purpose.
- </p>
-
- <p>Most of the elements within the <code>profAttributes</code> are
- optional. This sections describes each of them.
- </p>
-
- <subsection name="profId">
- <p>The <code>profId</code> serves to give a unique identifier to
- the profile. It should be expressed as a URI, and often as
- an URN.
- </p>
- </subsection>
- <subsection name="profVersion">
- <p>The <code>profVersion</code> identifies the version number of
- the profile.
- </p>
- </subsection>
- <subsection name="profType">
- <p>The <code>profType</code> identifies the type of the profile.
- The type that typically appears here is <code>profile</code>,
- meaning the profile is a profile (obviously).
- </p>
-
- <p>Another type that can be here is <code>dataDict</code>, which
- indicates that the profile doesn't describe a resource, but
- instead is a data dictionary for other profiles. Such a
- profile's composition elements name the expected profile
- elements and ranges of valid valuese that will appear in
- other profiles. The <code>profDataDictId</code> element
- identifies the profile serving as its data dictionary.
- </p>
- </subsection>
- <subsection name="profStatusId">
- <p>The <code>profStatusId</code> identifies the state of the
- profile. Profiles may be either <code>active</code> or
- <code>inactive</code>. An inactive profile is likely maintained
- for historical or exemplary reasons but is otherwise not
- currently used for searches or resource descriptions.
- </p>
- </subsection>
- <subsection name="profSecurityType">
- <p>The <code>profSecurityType</code> identifies whether the
- information contained in the profile may be of a sensitive
- nature. Any string is valid here as the current OODT
- software does not use this field.
- </p>
- </subsection>
- <subsection name="profParentId">
- <p>The <code>profParentId</code> optionally identifies the URI of
- the parent of this profile. Profiles may be arranged
- hierarchically in a singly rooted tree in a forest.
- </p>
- </subsection>
- <subsection name="profChildId">
- <p>The <code>profChildId</code>
- identifies zero or more children (by duplicating the element) of
- this profile.
- </p>
- </subsection>
- <subsection name="profRegAuthority">
- <p>The <code>profRegAuthority</code>
- names the registration authority responsible for authoring and
- maintaining the profile.
- </p>
- </subsection>
- <subsection name="profRevisionNote">
- <p>The <code>profRevisionNote</code> appears zero or more times in
- the profile to describe changes made to it over time. The
- notes are free form text, and each element is ordered from
- newest to oldest note.
- </p>
- </subsection>
- <subsection name="profDataDictId">
- <p>The <code>profDataDictId</code>
- identifies the profile providing a data dictionary to the
- current profile.
- </p>
- </subsection>
- </section>
-
- <section name="Describing Resources">
- <p>Let's take a look at how profiles would describe resources by
- looking at an example set of scientific data. Suppose you
- archive high temperature data for your weather service; this
- data comes in the form of tables of latitude/longitude
- locations and the high temperature recorded at each point.
- Since you're archiving daily high temperatures, there's one
- table per day, so each day's table is a discrete resource.
- Let's say you've got just three days of data so far, though,
- and it looks like this (to keep things simple).
- </p>
-
- <table>
- <thead>
- <tr>
- <th>Day Number</th>
- <th>Lat</th>
- <th>Lon</th>
- <th>High Temp</th>
- </tr>
- </thead>
- <tbody>
- <tr><td rowspan="3">1</td><td>104.1</td><td>39.2</td><td>26.5</td></tr>
- <tr><td>110.3</td><td>42.4</td><td>29.9</td></tr>
- <tr><td>121.5</td><td>45.6</td><td>23.3</td></tr>
-
- <tr><td rowspan="3">2</td><td>104.1</td><td>39.2</td><td>31.5</td></tr>
- <tr><td>110.3</td><td>42.4</td><td>30.9</td></tr>
- <tr><td>121.5</td><td>45.6</td><td>27.5</td></tr>
-
- <tr><td rowspan="3">2</td><td>104.1</td><td>39.2</td><td>20.8</td></tr>
- <tr><td>110.3</td><td>42.4</td><td>19.5</td></tr>
- </tbody>
- </table>
-
- <p>(On day #3, vandals destroyed the weather sensor station at
- (121.5, 45.6), so there are only two measurements that day.)
- </p>
-
- <p>To make profiles for each day's of data, let's gather some
- data that will be common to all of them. First, say the
- weather service's OID is 2.6.1.9, and for all collected data
- the weather service has reserved an OID 2.6.1.9.2, high
- temperature measurements 2.6.1.9.2.1. They choose to make a
- URI for each dataset,
- <code>urn:weather:data:highs:<var>day-number</var></code>
- where <var>day-number</var> is the day number of the data.
- The official creator for all this data will be "Weather
- Service", under subject keywords "weather", "temperatures",
- and "measurements". They'll also make the data tables
- accessible as web documents in MIME format
- <code>text/tab-separated-values</code> at the address
- <code>http://weather.gov/data/highs/<var>day-number</var>.txt</code>.
- </p>
-
- <p>Here, then, is the profile for the day 1:</p>
-
- <source><![CDATA[<profile>
- <profAttributes>
- <profId>2.6.1.9.2.1.1</profId>
- <profType>profile</profType>
- <profStatusId>active</profStatusId>
- </profAttributes>
- <resAttributes>
- <Identifier>urn:weather:data:highs:1</Identifier>
- <Title>High Temperatures - Day 1</Title>
- <Format>text/tab-separated-values</Format>
- <Creator>Weather Service</Creator>
- <Subject>weather</Subject>
- <Subject>temperatures</Subject>
- <Subject>measurements</Subject>
- <resContext>NOAA.NWS.Data</resContext>
- <resClass>data.granule</resClass>
- <resLocation>http://weather.gov/data/highs/1.txt</resLocation>
- </resAttributes>
- <profElement>
- <elemName>latitude</elemName>
- <elemType>real</elemType>
- <elemUnit>degree</elemUnit>
- <elemEnumFlag>F</elemEnumFlag>
- <elemMinValue>104.1</elemMinValue>
- <elemMaxValue>121.5</elemMaxValue>
- </profElement>
- <profElement>
- <elemName>longitude</elemName>
- <elemType>real</elemType>
- <elemUnit>degree</elemUnit>
- <elemEnumFlag>F</elemEnumFlag>
- <elemMinValue>39.2</elemMinValue>
- <elemMaxValue>45.6</elemMaxValue>
- </profElement>
- <profElement>
- <elemName>temperature</elemName>
- <elemType>real</elemType>
- <elemUnit>celsius</elemUnit>
- <elemEnumFlag>F</elemEnumFlag>
- <elemMinValue>23.3</elemMinValue>
- <elemMaxValue>29.9</elemMaxValue>
- </profElement>
-</profile>]]></source>
-
- <p>Someone searching for a high temperature that exceeded 25
- degrees, for example, would find this as a matching
- resource, as the <code>elemMinValue</code> for
- <code>temperature</code> is 23.3, and 25 is over that.
- </p>
-
- <p>Here are all three profiles in one document:</p>
-
- <source><![CDATA[<profiles>
- <profile>
- <profAttributes>
- <profId>2.6.1.9.2.1.1</profId>
- <profType>profile</profType>
- <profStatusId>active</profStatusId>
- </profAttributes>
- <resAttributes>
- <Identifier>urn:weather:data:highs:1</Identifier>
- <Title>High Temperatures - Day 1</Title>
- <Format>text/tab-separated-values</Format>
- <Creator>Weather Service</Creator>
- <Subject>weather</Subject>
- <Subject>temperatures</Subject>
- <Subject>measurements</Subject>
- <resContext>NOAA.NWS.Data</resContext>
- <resClass>data.granule</resClass>
- <resLocation>http://weather.gov/data/highs/1.txt</resLocation>
- </resAttributes>
- <profElement>
- <elemName>latitude</elemName>
- <elemType>real</elemType>
- <elemUnit>degree</elemUnit>
- <elemEnumFlag>F</elemEnumFlag>
- <elemMinValue>104.1</elemMinValue>
- <elemMaxValue>121.5</elemMaxValue>
- </profElement>
- <profElement>
- <elemName>longitude</elemName>
- <elemType>real</elemType>
- <elemUnit>degree</elemUnit>
- <elemEnumFlag>F</elemEnumFlag>
- <elemMinValue>39.2</elemMinValue>
- <elemMaxValue>45.6</elemMaxValue>
- </profElement>
- <profElement>
- <elemName>temperature</elemName>
- <elemType>real</elemType>
- <elemUnit>celsius</elemUnit>
- <elemEnumFlag>F</elemEnumFlag>
- <elemMinValue>23.3</elemMinValue>
- <elemMaxValue>29.9</elemMaxValue>
- </profElement>
- </profile>
- <profile>
- <profAttributes>
- <profId>2.6.1.9.2.1.2</profId>
- <profType>profile</profType>
- <profStatusId>active</profStatusId>
- </profAttributes>
- <resAttributes>
- <Identifier>urn:weather:data:highs:2</Identifier>
- <Title>High Temperatures - Day 2</Title>
- <Format>text/tab-separated-values</Format>
- <Creator>Weather Service</Creator>
- <Subject>weather</Subject>
- <Subject>temperatures</Subject>
- <Subject>measurements</Subject>
- <resContext>NOAA.NWS.Data</resContext>
- <resClass>data.granule</resClass>
- <resLocation>http://weather.gov/data/highs/2.txt</resLocation>
- </resAttributes>
- <profElement>
- <elemName>latitude</elemName>
- <elemType>real</elemType>
- <elemUnit>degree</elemUnit>
- <elemEnumFlag>F</elemEnumFlag>
- <elemMinValue>104.1</elemMinValue>
- <elemMaxValue>121.5</elemMaxValue>
- </profElement>
- <profElement>
- <elemName>longitude</elemName>
- <elemType>real</elemType>
- <elemUnit>degree</elemUnit>
- <elemEnumFlag>F</elemEnumFlag>
- <elemMinValue>39.2</elemMinValue>
- <elemMaxValue>45.6</elemMaxValue>
- </profElement>
- <profElement>
- <elemName>temperature</elemName>
- <elemType>real</elemType>
- <elemUnit>celsius</elemUnit>
- <elemEnumFlag>F</elemEnumFlag>
- <elemMinValue>27.5</elemMinValue>
- <elemMaxValue>31.5</elemMaxValue>
- </profElement>
- </profile>
- <profile>
- <profAttributes>
- <profId>2.6.1.9.2.1.3</profId>
- <profType>profile</profType>
- <profStatusId>active</profStatusId>
- </profAttributes>
- <resAttributes>
- <Identifier>urn:weather:data:highs:3</Identifier>
- <Title>High Temperatures - Day 3</Title>
- <Format>text/tab-separated-values</Format>
- <Creator>Weather Service</Creator>
- <Subject>weather</Subject>
- <Subject>temperatures</Subject>
- <Subject>measurements</Subject>
- <resContext>NOAA.NWS.Data</resContext>
- <resClass>data.granule</resClass>
- <resLocation>http://weather.gov/data/highs/3.txt</resLocation>
- </resAttributes>
- <profElement>
- <elemName>latitude</elemName>
- <elemType>real</elemType>
- <elemUnit>degree</elemUnit>
- <elemEnumFlag>F</elemEnumFlag>
- <elemMinValue>104.1</elemMinValue>
- <elemMaxValue>110.3</elemMaxValue>
- </profElement>
- <profElement>
- <elemName>longitude</elemName>
- <elemType>real</elemType>
- <elemUnit>degree</elemUnit>
- <elemEnumFlag>F</elemEnumFlag>
- <elemMinValue>39.2</elemMinValue>
- <elemMaxValue>42.4</elemMaxValue>
- </profElement>
- <profElement>
- <elemName>temperature</elemName>
- <elemType>real</elemType>
- <elemUnit>celsius</elemUnit>
- <elemEnumFlag>F</elemEnumFlag>
- <elemMinValue>19.5</elemMinValue>
- <elemMaxValue>20.8</elemMaxValue>
- </profElement>
- </profile>
-</profiles>]]></source>
-
- <p>Given this set of profiles, a profile search for resources
- with <code>latitude > 120.0</code> would match profiles
- for day 1 and 2, but not day 3. Actual profile searches are
- possible by taking the above document and loading it into
- the <code>LightweightProfileHandler</code>, yet that becomes
- impractical for many many profiles, as it holds all of the
- profile objects in memory and "searches" them in place.
- More likely, data such as these would be stored in a
- relational database, and the matching profiles would be
- generated on demand.
- </p>
-
- <p>Let's make one more profile, a profile that describes
- <em>the entire collection</em>:
- </p>
-
- <source><![CDATA[
- <profile>
- <profAttributes>
- <profId>2.6.1.9.2.1</profId>
- <profType>profile</profType>
- <profStatusId>active</profStatusId>
- </profAttributes>
- <resAttributes>
- <Identifier>urn:weather:data:highs:index</Identifier>
- <Title>High Temperatures</Title>
- <Format>text/tab-separated-values</Format>
- <Creator>Weather Service</Creator>
- <Subject>weather</Subject>
- <Subject>temperatures</Subject>
- <Subject>measurements</Subject>
- <resContext>NOAA.NWS.Data</resContext>
- <resClass>system.profileServer</resClass>
- <resLocation>urn:weather:data:highs:ProfileServer</resLocation>
- </resAttributes>
- <profElement>
- <elemName>latitude</elemName>
- <elemType>real</elemType>
- <elemUnit>degree</elemUnit>
- <elemEnumFlag>F</elemEnumFlag>
- <elemMinValue>104.1</elemMinValue>
- <elemMaxValue>121.5</elemMaxValue>
- </profElement>
- <profElement>
- <elemName>longitude</elemName>
- <elemType>real</elemType>
- <elemUnit>degree</elemUnit>
- <elemEnumFlag>F</elemEnumFlag>
- <elemMinValue>19.5</elemMinValue>
- <elemMaxValue>31.5</elemMaxValue>
- </profElement>
- <profElement>
- <elemName>temperature</elemName>
- <elemType>real</elemType>
- <elemUnit>celsius</elemUnit>
- <elemEnumFlag>F</elemEnumFlag>
- <elemMinValue>19.5</elemMinValue>
- <elemMaxValue>31.5</elemMaxValue>
- </profElement>
- </profile>]]></source>
-
- <p>Note that in addition to several changes in the resource
- attributes, we've also changed the profile elements to
- cover the entire range of latitude, longitude, and
- temperature in the entire data set. So, for temperature,
- the lowest high temperature for all three days was 19.5,
- and the highest was 31.5. Now, a profile search can for
- temperatures greater than 30 will match the profile for
- the whole collection, as well as the profile for day #2.
- </p>
-
- <p>In fact, the OODT framework supports automatic drill-down of
- this kind. The <a href="/grid-query/">Query Service</a>, upon
- encountering a matching profile, checks to see if the
- <code>resClass</code> is <code>system.profileServer</code>,
- and if so, will pass the query to the profile server at the
- <code>resLocation</code> in the matched profile. It will
- gather up all matching profiles and return them to the user.
- In this way, it can follow a directed graph of linked profile
- servers (automatically avoiding cycles), and gathering more
- and more results.
- </p>
- </section>
- </body>
-</document>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/site/xdoc/querying/index.xml
----------------------------------------------------------------------
diff --git a/profile/src/site/xdoc/querying/index.xml b/profile/src/site/xdoc/querying/index.xml
deleted file mode 100755
index 855774a..0000000
--- a/profile/src/site/xdoc/querying/index.xml
+++ /dev/null
@@ -1,203 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more contributor
-license agreements. See the NOTICE.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.
--->
-<document>
- <properties>
- <title>Querying Profile Elements</title>
- <author email="Sean.Kelly@jpl.nasa.gov">Sean Kelly</author>
- </properties>
- <!-- Four Carry Nuts - Hexagon -->
- <body>
- <section name="Querying Profile Elements">
-
- <p>As desribed in <a href="../info/">Information Captured in a
- Profile</a>, profile elements describe the composition of a
- resource using metadata descriptions taken from the <a
- href="http://metadata-standards.org/11179/">ISO/IEC 11179
- standards</a>. The profile elements catalog lists of valid
- values, minimum and maximum values, data types, and so forth.
- </p>
-
- <p>As you develop a profile handler to perform queries and
- generate profiles, you'll encounter three cases when querying
- profile elements or the data sources they describe:
- </p>
-
- <ul>
- <li>Querying ranges of values</li>
- <li>Querying enumerated values</li>
- <li>Querying unspecified profile lements</li>
- </ul>
- </section>
-
- <section name="Queries Against Ranges">
- <p>Ranged profile elements are those that describe an attribute
- of a resource's composition in terms of a continuous space of
- valid values. In the Java implementation, there's a subclass
- of <code>ProfileElement</code> to represent such ranges:
- <code>RangedProfileElement</code>. In the XML representation,
- the <code><elemEnumFlag></code> is <code>F</code> and
- there are values listed for <code><elemMinValue></code>
- and <code><elemMaxValue></code>.
- </p>
-
- <p>An example of a ranged profile element might be:</p>
- <table>
- <tbody>
- <tr><td>Name:</td><td>temperature</td></tr>
- <tr><td>Description:</td><td>Temperatures measured using
- oral, medical-use, alcohol-based thermometer.</td></tr>
- <tr><td>Type:</td><td>real</td></tr>
- <tr><td>Unit:</td><td>kelvin</td></tr>
- <tr><td>Enumeration flag:</td><td>false</td></tr>
- <tr><td>Min value:</td><td>282.31</td></tr>
- <tr><td>Max value:</td><td>301.45</td></tr>
- </tbody>
- </table>
-
- <p>When you're generating a profile (or querying a similar
- metadata model) with a ranged element, queries should match if
- the sought value occurs within the given, inclusive range. If
- it's a negative query, then it should match if the sought
- value <em>doesn't</em> occur within the range.
- </p>
-
- <p>Here's an example. Suppose you have a ranged profile element
- called <code>lumens</code> and its minimum value is 10 and its
- maximum value is 20. Here's a table that shows queries and
- whether they match:
- </p>
-
- <table>
- <thead>
- <tr><th>Query</th><th>Match?</th></tr>
- </thead>
- <tbody>
- <tr><td>lumens = 12</td><td>Yes, since 12 is between 10 and 20</td></tr>
- <tr><td>lumens = 45</td><td>No, since 45 is above 20</td></tr>
- <tr><td>lumens != 12</td><td>Yes, since there are <em>other values</em> in the range 10..20 that match, such as 13, 14, 12.1, etc.</td></tr>
- <tr><td>lumens != 45</td><td>Yes, since are an infinite number of values in the range 10..22 that are not 45</td></tr>
- <tr><td>lumens != 10</td><td>Yes</td></tr>
- <tr><td>lumens < 45</td><td>Yes</td></tr>
- <tr><td>lumens > 15</td><td>Yes</td></tr>
- <tr><td>lumens > 35</td><td>No; the highest lumen value is 20</td></tr>
- <tr><td>lumens LIKE 12</td><td>Maybe</td></tr>
- </tbody>
- </table>
-
- <p>The "LIKE" relational operator defined by the XMLQuery query
- langauge was meant for string comparisons, yet there's nothing
- in the software that prevents it from being presented for
- ranged queries. The choice of whether to match it is up to you.
- </p>
- </section>
-
- <section name="Queries Against Enumerated Values">
- <p>Enumerated profile elements are those that describe an
- attribute of a resource's composition in terms of a discrete
- list of valid values. In the Java implementation, there's a
- subclass of <code>ProfileElement</code> to represent such
- ranges: <code>EnumeratedProfileElement</code>. In the XML
- representation, the <code><elemEnumFlag></code> is
- <code>T</code> and there are one or more
- <code><elemValue></code> elements.
- </p>
-
- <p>An example of an enumerated profile element might be:</p>
- <table>
- <tbody>
- <tr><td>Name:</td><td>zone</td></tr>
- <tr><td>Description:</td><td>City Planning Commission zoning code for permitted land use.</td></tr>
- <tr><td>Type:</td><td>string</td></tr>
- <tr><td>Unit:</td><td>code</td></tr>
- <tr><td>Enumeration flag:</td><td>true</td></tr>
- <tr><td>Value:</td><td>A</td></tr>
- <tr><td>Value:</td><td>B1</td></tr>
- <tr><td>Value:</td><td>B2</td></tr>
- <tr><td>Value:</td><td>B4</td></tr>
- <tr><td>Value:</td><td>C</td></tr>
- <tr><td>Value:</td><td>H</td></tr>
- <tr><td>Value:</td><td>PDD</td></tr>
- <tr><td>Value:</td><td>R2</td></tr>
- <tr><td>Value:</td><td>R3</td></tr>
- <tr><td>Value:</td><td>R4</td></tr>
- <tr><td>Value:</td><td>R5</td></tr>
- </tbody>
- </table>
-
- <p>When you're generating a profile (or querying a similar
- metadata model) with an enumerated element, queries should
- match if the sought value appears as one of the listed
- elements.
- </p>
-
- <p>Here's an example. Suppose you have an profile element
- called <code>planet</code> that has as valid values
- <code>Mercury</code>, <code>Venus</code>, <code>Earth</code>,
- and <code>Mars</code>. Here's a table that shows queries and
- whether they match:
- </p>
-
- <table>
- <thead>
- <tr><th>Query</th><th>Match?</th></tr>
- </thead>
- <tbody>
- <tr><td>planet = Mercury</td><td>Yes</td></tr>
- <tr><td>planet = Jupiter</td><td>No</td></tr>
- <tr><td>planet != Mercury</td><td>Yes since Earth, Venus, and Mars are all not Mercury</td></tr>
- <tr><td>planet != Jupiter</td><td>Yes since there are 4 planets which are all not Jupiter</td></tr>
- <tr><td>planet < Earth</td><td>Maybe</td></tr>
- <tr><td>planet LIKE %E%</td><td>Yes, since all four planets have an E in them (without regard to case)</td></tr>
- <tr><td>planet NOTLIKE %E%</td><td>No, since all four planets have an E in them</td></tr>
- </tbody>
- </table>
-
- <p>Relational ordering is not specified by the profile model, so whether
- a query like <code>planet < Earth</code> matches is up to you.
- </p>
- </section>
-
- <section name="Querying Against Unspecified Values">
- <p>An unspecific profile element indicates only the
- <em>presence</em> of an attribute in the composition of a
- resource, and nothing else. In the Java implementation,
- there's a subclass of <code>ProfileElement</code> to represent
- this, <code>UnspecifiedProfileElement</code>. In the XML
- representation, the <code><elemEnumFlag></code> is
- <code>T</code> and there are zero
- <code><elemValue></code> elements.
- </p>
-
- <p>Unspecified profile elements can be useful where you have
- profiles not describing single resources, but entire
- collections of resources. For example, you may have ranged
- profile elements called <code>temperature</code> for each
- temperature resource. But if there are a billion resources,
- then determining the minimum and maximum temperature for the
- profile of the entire collection might be painful, in which
- case you can say that the collection has a
- <code>temperature</code> attribute by using an unspecified
- profile for the element for the collection.
- </p>
-
- <p>Queries against unspecified elements always match, regardless
- what the query is.
- </p>
- </section>
- </body>
-</document>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/site/xdoc/rep/index.xml
----------------------------------------------------------------------
diff --git a/profile/src/site/xdoc/rep/index.xml b/profile/src/site/xdoc/rep/index.xml
deleted file mode 100755
index 11c5d3e..0000000
--- a/profile/src/site/xdoc/rep/index.xml
+++ /dev/null
@@ -1,334 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more contributor
-license agreements. See the NOTICE.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.
--->
-<document>
- <properties>
- <title>Representation of Profiles</title>
- <author email="Sean.Kelly@jpl.nasa.gov">Sean Kelly</author>
- </properties>
-
- <body>
- <section name="Representation of Profiles">
- <p>Within the OODT Framework, profiles are represented as RDF
- documents, XML documents, or Java objects. The Java Profile
- class can yield itself as an RDF or XML document, and you can
- construct a Java Profile from an XML document that describes a
- profile.
- </p>
- </section>
-
- <section name="Introduction">
- <p>No matter what their origin or whether they're to be short
- lived, profiles have a physical representation at one time
- within the OODT framework. Typically, you'll use the Java class
- <code>Profile</code> when working with Java, or the
- RDF or XML document version when working in other environments.
- The RDF representation uses the RDF XML structure and RDF schema
- to describe profiles. The XML document version uses an
- OODT-specific XML vocabulary and DTD.
- </p>
-
- <p><em>For C/C++ Users:</em> There is not yet a C/C++ representation of a profile.
- Use the RDF or XML representation.
- </p>
-
- <p><em>Note:</em>The RDF representation is currently a work-in-progress.
- </p>
-
- <p>If you're developing a new kind of profile server, you
- should become familiar with the Java
- <code>Profile</code> class. If you're searching for
- profiles, you can just use the RDF or XML representations.
- </p>
- </section>
-
- <section name="XML Profiles">
- <p>Profiles can be represented as XML documents that conform to
- the OODT Profile Document Type Definition (DTD). The Formal
- Public Identifier of the OODT Profile DTD is <code>-//JPL//DTD
- Profile 1.0//EN</code>. The normative System Identifier is
- <a>http://oodt.jpl.nasa.gov/grid-profile/dtd/prof.dtd</a>.
- </p>
-
- <p>Although you should refer to the normative System
- Identifier for the latest reference version, see the following:
- </p>
-
- <source><![CDATA[<!ELEMENT profiles
- (profile*)>
-
-<!ELEMENT profile
- (profAttributes,
- resAttributes,
- profElement*)>
-
- <!ELEMENT profAttributes
- (profId, profVersion?, profType,
- profStatusId, profSecurityType?, profParentId?, profChildId*,
- profRegAuthority?, profRevisionNote*)>
-
- <!ELEMENT resAttributes
- (Identifier, Title?, Format*, Description?, Creator*, Subject*,
- Publisher*, Contributor*, Date*, Type*, Source*,
- Language*, Relation*, Coverage*, Rights*,
- resContext+, resAggregation?, resClass, resLocation*)>
-
- <!ELEMENT profElement
- (elemId?, elemName, elemDesc?, elemType?, elemUnit?,
- elemEnumFlag, (elemValue* | (elemMinValue, elemMaxValue)),
- elemSynonym*,
- elemObligation?, elemMaxOccurrence?, elemComment?)>
-
- <!ELEMENT profId (#PCDATA)>
- <!ELEMENT profVersion (#PCDATA)>
- <!ELEMENT profType (#PCDATA)>
- <!ELEMENT profParentId (#PCDATA)>
- <!ELEMENT profChildId (#PCDATA)>
- <!ELEMENT profStatusId (#PCDATA)>
- <!ELEMENT profSecurityType (#PCDATA)>
- <!ELEMENT profRegAuthority (#PCDATA)>
- <!ELEMENT profRevisionNote (#PCDATA)>
-
- <!ELEMENT Identifier (#PCDATA)>
- <!ELEMENT Title (#PCDATA)>
- <!ELEMENT Format (#PCDATA)>
- <!ELEMENT Description (#PCDATA)>
- <!ELEMENT Creator (#PCDATA)>
- <!ELEMENT Subject (#PCDATA)>
- <!ELEMENT Publisher (#PCDATA)>
- <!ELEMENT Contributor (#PCDATA)>
- <!ELEMENT Date (#PCDATA)>
- <!ELEMENT Type (#PCDATA)>
- <!ELEMENT Source (#PCDATA)>
- <!ELEMENT Language (#PCDATA)>
- <!ELEMENT Relation (#PCDATA)>
- <!ELEMENT Coverage (#PCDATA)>
- <!ELEMENT Rights (#PCDATA)>
- <!ELEMENT resContext (#PCDATA)>
- <!ELEMENT resAggregation (#PCDATA)>
- <!ELEMENT resClass (#PCDATA)>
- <!ELEMENT resLocation (#PCDATA)>
-
- <!ELEMENT elemId (#PCDATA)>
- <!ELEMENT elemName (#PCDATA)>
- <!ELEMENT elemType (#PCDATA)>
- <!ELEMENT elemEnumFlag (#PCDATA)>
- <!ELEMENT elemDesc (#PCDATA)>
- <!ELEMENT elemSynonym (#PCDATA)>
- <!ELEMENT elemUnit (#PCDATA)>
- <!ELEMENT elemValue (#PCDATA)>
- <!ELEMENT elemMinValue (#PCDATA)>
- <!ELEMENT elemMaxValue (#PCDATA)>
- <!ELEMENT elemObligation (#PCDATA)>
- <!ELEMENT elemMaxOccurrence (#PCDATA)>
- <!ELEMENT elemComment (#PCDATA)>]]></source>
-
-
- <subsection name="Collections of Profiles">
- <p>As you can see from the above,an
- XML element, <code>profiles</code> is a
- container element to hold zero or more profiles. Use this
- element where it's necessary to manipulate a collection of
- profiles without regard to order.
- </p>
- </subsection>
- </section>
-
- <section name="Java Representation of Profiles">
- <p>The OODT source code includes a class
- <code>jpl.eda.profile.Profile</code> for object
- represenation of a profile. You can construct a
- <code>Profile</code> object from an RDF or XML
- document or create a blank one to populate with metadata
- later.
- </p>
- <p>To construct a new, blank profile, use the no-arguments
- constructor. To construct a profile from an RDF or XML
- document, use the constructor accepting a Resource or a DOM
- <code>Node</code>, respectively. The DOM node
- should be a <code>Element</code> representing the
- <code>profile</code> element.
- Alternatively, if your XML document exists as a string, call
- the constructor taking a single string.
- </p>
-
- <subsection name="Accessing Profile Metadata">
- <p>To access the metadata of a profile, call the methods to
- retrieve the profile attributes, the resource attributes, or
- the profile elements.
- </p>
-
- <subsection name="Accessing the Profile Attributes">
- <p>You retrieve the profile attributes by calling
- <code>getProfileAttributes</code> on a
- <code>Profile</code>. This returns an
- <code>ProfileAttributes</code> object which provides
- methods to get and set the various attributes. Setting a
- value sets it for the <code>Profile</code> to which
- the <code>ProfileAttributes</code> belongs.
- </p>
-
- <p>A value of <code>null</code> for an optional
- attribute means the value isn't set.
- </p>
- </subsection>
-
- <subsection name="Accessing the Resource Attributes">
- <p>You retrieve the resource attributes similarly as for
- profile attributes, calling
- <code>getResourceAttributes</code> to yield a
- <code>ResourceAttributes</code> object.
- </p>
- <p>The <code>ResourceAttributes</code> has
- methods to get and set various attributes. Note that many
- of the attributes are multi-valued. For example, the
- resource profiled will likely cover several subjects. In
- this case, the "get" method,
- <code>getSubjects</code>, returns a
- <code>java.util.List</code> of
- <code>String</code>s. There is no set method.
- Instead, you just manipulate the list to add and remove
- subjects.
- </p>
-
- <p><em>Note:</em> All of the "get" functions that return
- <code>List</code>s return lists of
- <code>String</code>s, except for
- <code>getDates</code>, which returns a list of
- <code>java.util.Date</code>s.
- </p>
-
- <p>For other attributes which are singly valued, there is
- both a set and get method. For optional values, a value of
- <code>null</code> means the attribute isn't set.
- </p>
- </subsection>
-
- <subsection name="Accessing the Profile Elements">
- <p>The profile stores its profile elements in a
- <code>java.util.Map</code>, mapping the name of
- the profile element (as a <code>String</code>) to
- an object of class <code>ProfileElement</code>.
- To access this map, call the method
- <code>getProfileElements</code> on a
- <code>Profile</code>. Because this method returns
- a reference to the <code>Profile</code>'s map, any
- updates to the map affect the profile immediately.
- </p>
-
- <p><em>Caution:</em> Never store anything but
- <code>String</code>s as keys and
- <code>ProfileElement</code>s (or objects of its
- subclasses) as values in a profile element map. The
- software will not operate correctly if any other kind of
- object is stored.
- </p>
-
- <subsection name="Common Attributes of Profile Elements">
- <p>The class
- <code>jpl.eda.profile.ProfileElement</code>
- contains the common parts of every profile element, such
- as its required name, its optional description, and so
- forth. Use the value <code>null</code> for any
- optional attribute that's unset.
- </p>
- <p>The <code>ProfileElement</code> stores its
- synonyms as a <code>java.util.List</code> of
- <code>String</code>s. Manipulate the list
- directly to add or remove synonyms.
- </p>
- <p>The <code>ProfileElement</code> class is
- abstract. To create new profile elements for a profile,
- you need to create objects of one of the concrete
- <code>ProfileElement</code> subclasses:
- </p>
-
- <ul>
- <li><code>EnumeratedProfileElement</code></li>
- <li><code>RangedProfileElement</code></li>
- <li><code>UnspecifiedProfileElement</code></li>
- </ul>
-
- <p>The following sections detail each kind of profile
- element.
- </p>
- </subsection>
-
- <subsection name="Elements with Enumerated Values">
- <p>For profile elements that maintain a specified list of
- valid values, use the
- <code>EnumeratedProfileElement</code> class.
- Objects of this class maintian a
- <code>java.util.List</code> of values. You can
- pass in a list of values when constrcuting the object, or
- can call the <code>getValues</code> method and
- manipulate the list directly.
- </p>
- <p>Queries that arrive for an enumerated profile
- element must match one of the listed elements exactly
- unless it's a negative (not-equal-to) query. For
- example, suppose we had an enumerated profile element
- <code>filter</code> with values
- <code>infrared</code>, <code>visible</code>,
- and <code>ultraviolet</code>. A query asking for
- a filter equal to infrared should match, as well as a
- query asking for a filter greater than or equal to
- infrared. A query asking for a filter not equal to
- infrared shouldn't match, while a query asking for a
- filter not equal to x-ray should match.
- </p>
- </subsection>
-
- <subsection name="Elements with a Range of Values">
- <p>You can represent profile elements that have a range
- of valid values with the
- <code>RangedProfileElement</code> class.
- Construct this class with the minimum and maximum values,
- which must be numeric.
- </p>
- <p>Use the <code>getMinValue</code> to get the
- minimum value and <code>getMaxValue</code> to
- get the maximum value.
- </p>
- <p>Querying a profile that uses a range of values
- considers the range as inclusive. For example, suppose
- the ranged profile element
- <code>temperature</code> has a minimum value of 32
- and a maximum value of 212. A query that requests
- temperatures less than 32 shouldn't match, but less than or
- equal to 32 should match.
- </p>
- </subsection>
-
- <subsection name="Elements with no Specified Values">
- <p>For profile elements that you always want to match a
- query without explicitly listing each valid value or a
- range of legal numeric values you can use the class
- <code>UnspecifiedProfileElement</code>. This
- class identifies an element with no range or list of
- valid values.
- </p>
- <p>Queries that arrive at such an element will
- <span class="emphasis"><em>always</em></span> match, even if they're
- negative (not-equal-to) queries.
- </p>
- </subsection>
- </subsection>
- </subsection>
- </section>
- </body>
-</document>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/test/java/org/apache/oodt/profile/EnumeratedProfileElementTest.java
----------------------------------------------------------------------
diff --git a/profile/src/test/java/org/apache/oodt/profile/EnumeratedProfileElementTest.java b/profile/src/test/java/org/apache/oodt/profile/EnumeratedProfileElementTest.java
deleted file mode 100644
index d8defac..0000000
--- a/profile/src/test/java/org/apache/oodt/profile/EnumeratedProfileElementTest.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import org.xml.sax.SAXException;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import org.apache.oodt.commons.io.NullOutputStream;
-import org.apache.oodt.commons.util.XML;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
-/**
- * Unit test the {@link EnumeratedProfileElement} class.
- *
- * @author Kelly
- */
-public class EnumeratedProfileElementTest extends ProfileElementTestCase {
- /**
- * Construct the test case for the {@link EnumeratedProfileElement} class.
- */
- public EnumeratedProfileElementTest(String name) {
- super(name);
- }
-
- protected ProfileElement createProfileElement() {
- return new EnumeratedProfileElement(ProfileTest.TEST_PROFILE, "name", "id", "desc", "type", "unit",
- /*synonyms*/ new ArrayList(), /*obligation*/false, /*maxOccurrence*/1, "comment", VALUES);
- }
-
- public void testIt() {
- ProfileElement element = createProfileElement();
- List values = element.getValues();
- assertEquals(3, values.size());
- assertEquals("1", values.get(0));
- assertEquals("2", values.get(1));
- assertEquals("3", values.get(2));
- }
-
- public void testNulls() {
- try {
- EnumeratedProfileElement element = new EnumeratedProfileElement(createProfileElement().getProfile(),
- "test", "test", "test", "test", "test", Collections.EMPTY_LIST, /*obligation*/true, /*maxOccur*/1,
- "comment", Collections.singletonList(null));
- fail("Null values must not be allowed as values in enumerated elements.");
- } catch (IllegalArgumentException ignored) {}
- }
-
- protected void checkEnumFlag(String text) {
- assertEquals("T", text);
- }
-
- protected void checkValue(String text) {
- assertTrue(VALUES.contains(text));
- }
-
- protected void checkMaxValue(String text) {
- fail("Enumerated profile element shouldn't have a maximum value");
- }
-
- protected void checkMinValue(String text) {
- fail("Enumerated profile element shouldn't have a minimum value");
- }
-
- /**
- * Test to see if spaces are preserved in XML generation and parsing.
- *
- * @throws SAXException if an error occurs.
- */
- public void testSpacePreserving() throws SAXException {
- Profile p = new Profile();
- ProfileAttributes pa = new ProfileAttributes("1", "1", "profile", "active", "1", "1",
- /*children*/Collections.EMPTY_LIST, "1", /*revNotes*/Collections.EMPTY_LIST);
- p.setProfileAttributes(pa);
- ResourceAttributes ra = new ResourceAttributes(p, "id", "title", /*formats*/Collections.EMPTY_LIST, "description",
- /*creators*/Collections.EMPTY_LIST, /*subjects*/Collections.EMPTY_LIST, /*publishers*/Collections.EMPTY_LIST,
- /*contributors*/Collections.EMPTY_LIST, /*dates*/Collections.EMPTY_LIST, /*types*/Collections.EMPTY_LIST,
- /*sources*/Collections.EMPTY_LIST, /*languages*/Collections.EMPTY_LIST, /*relations*/Collections.EMPTY_LIST,
- /*coverages*/Collections.EMPTY_LIST, /*rights*/Collections.EMPTY_LIST, Collections.singletonList("context"),
- "granule", "grainy", Collections.singletonList("file:/dev/null"));
- p.setResourceAttributes(ra);
- EnumeratedProfileElement e = new EnumeratedProfileElement(p, "mode", "mode", "Mode", "string", "mode",
- /*synonyms*/Collections.EMPTY_LIST, /*obligation*/false, /*maxOccurrence*/1, "No comment",
- Collections.singletonList("The current\n mode setting\n is set to indent\n\n a\n\n"
- + " number of increasing\n times."));
- p.getProfileElements().put("mode", e);
-
- Profile q = new Profile(p.toString());
- e = (EnumeratedProfileElement) q.getProfileElements().values().iterator().next();
- assertEquals("The current\n mode setting\n is set to indent\n\n a\n\n"
- + " number of increasing\n times.", e.getValues().get(0));
- }
-
- public void testXMLSerialization() throws Exception {
- Profile p = new Profile();
- EnumeratedProfileElement e = new EnumeratedProfileElement(p);
- Document doc = XML.createDocument();
- Node root = e.toXML(doc);
- TransformerFactory tf = TransformerFactory.newInstance();
- Transformer t = tf.newTransformer();
- DOMSource s = new DOMSource(root);
- StreamResult r = new StreamResult(new NullOutputStream());
- t.transform(s, r);
- }
-
- /** Enumerated values for the test element. */
- private static final List VALUES = Arrays.asList(new String[]{"1", "2", "3"});
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/test/java/org/apache/oodt/profile/ProfileAttributesTest.java
----------------------------------------------------------------------
diff --git a/profile/src/test/java/org/apache/oodt/profile/ProfileAttributesTest.java b/profile/src/test/java/org/apache/oodt/profile/ProfileAttributesTest.java
deleted file mode 100644
index 04792f0..0000000
--- a/profile/src/test/java/org/apache/oodt/profile/ProfileAttributesTest.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import org.apache.oodt.commons.io.NullOutputStream;
-import org.apache.oodt.commons.util.XML;
-import junit.framework.TestCase;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * Unit test the {@link ProfileAttributes} class.
- *
- * @author Kelly
- */
-public class ProfileAttributesTest extends TestCase {
- /** Construct the test case for the {@link ProfileAttributes} class. */
- public ProfileAttributesTest(String name) {
- super(name);
- }
-
- public void testNoArgsCtor() {
- ProfileAttributes blank = new ProfileAttributes();
- assertEquals("UNKNOWN", blank.getID());
- assertEquals(0, blank.getChildren().size());
- }
-
- public void testCtor() {
- assertEquals("id", TEST_PROFILE_ATTRIBUTES.getID());
- assertEquals("version", TEST_PROFILE_ATTRIBUTES.getVersion());
- assertEquals("type", TEST_PROFILE_ATTRIBUTES.getType());
- assertEquals("statusID", TEST_PROFILE_ATTRIBUTES.getStatusID());
- assertEquals("securityType", TEST_PROFILE_ATTRIBUTES.getSecurityType());
- assertEquals("parent", TEST_PROFILE_ATTRIBUTES.getParent());
- assertEquals(2, TEST_PROFILE_ATTRIBUTES.getChildren().size());
- assertEquals("child1", TEST_PROFILE_ATTRIBUTES.getChildren().get(0));
- assertEquals("child2", TEST_PROFILE_ATTRIBUTES.getChildren().get(1));
- assertEquals("regAuthority", TEST_PROFILE_ATTRIBUTES.getRegAuthority());
- assertEquals(2, TEST_PROFILE_ATTRIBUTES.getRevisionNotes().size());
- assertEquals("note1", TEST_PROFILE_ATTRIBUTES.getRevisionNotes().get(0));
- assertEquals("note2", TEST_PROFILE_ATTRIBUTES.getRevisionNotes().get(1));
- }
-
- public void testObjectMethods() {
- ProfileAttributes q1 = new ProfileAttributes("1", "2", "3", "4", "5", "6", Collections.EMPTY_LIST, "7",
- Collections.EMPTY_LIST);
- ProfileAttributes q2 = new ProfileAttributes("1", "2", "3", "4", "5", "6", Collections.EMPTY_LIST, "7",
- Collections.EMPTY_LIST);
- ProfileAttributes q3 = new ProfileAttributes("2", "3", "4", "5", "6", "7", Collections.EMPTY_LIST, "8",
- Collections.EMPTY_LIST);
- assertEquals(q1, q1);
- assertEquals(q1, q2);
- assertTrue(!q1.equals(q3));
- ProfileAttributes q4 = (ProfileAttributes) q3.clone();
- assertEquals(q3, q4);
- assertTrue(q3 != q4);
- }
-
- public void testSetters() {
- ProfileAttributes q = (ProfileAttributes) TEST_PROFILE_ATTRIBUTES.clone();
-
- assertEquals("id", q.getID());
- q.setID("newId");
- assertEquals("newId", q.getID());
-
- assertEquals("version", q.getVersion());
- q.setVersion("newVersion");
- assertEquals("newVersion", q.getVersion());
-
- assertEquals("type", q.getType());
- q.setType("newType");
- assertEquals("newType", q.getType());
-
- assertEquals("statusID", q.getStatusID());
- q.setStatusID("newStatusid");
- assertEquals("newStatusid", q.getStatusID());
-
- assertEquals("securityType", q.getSecurityType());
- q.setSecurityType("newSecuritytype");
- assertEquals("newSecuritytype", q.getSecurityType());
-
- assertEquals("regAuthority", q.getRegAuthority());
- q.setRegAuthority("newRegAuthority");
- assertEquals("newRegAuthority", q.getRegAuthority());
- }
-
- public void testXML() throws Exception {
- Document doc = XML.createDocument();
- Node root = TEST_PROFILE_ATTRIBUTES.toXML(doc);
- assertEquals("profAttributes", root.getNodeName());
- NodeList children = root.getChildNodes();
- for (int i = 0; i < children.getLength(); ++i) {
- Node child = children.item(i);
- String name = child.getNodeName();
- if ("profId".equals(name)) {
- assertEquals("id", XML.text(child));
- } else if ("profVersion".equals(name)) {
- assertEquals("version", XML.text(child));
- } else if ("profType".equals(name)) {
- assertEquals("type", XML.text(child));
- } else if ("profStatusId".equals(name)) {
- assertEquals("statusID", XML.text(child));
- } else if ("profSecurityType".equals(name)) {
- assertEquals("securityType", XML.text(child));
- } else if ("profParentId".equals(name)) {
- assertEquals("parent", XML.text(child));
- } else if ("profChildId".equals(name)) {
- // ignore, list serialization tested in XMLTest
- } else if ("profRegAuthority".equals(name)) {
- assertEquals("regAuthority", XML.text(child));
- } else if ("profRevisionNote".equals(name)) {
- // ignore, list serialization tested in XMLTest
- } else fail("Unknown node \"" + name + "\" in XML result");
- }
- ProfileAttributes p = new ProfileAttributes(root);
- assertEquals(TEST_PROFILE_ATTRIBUTES, p);
- }
-
- public void testXMLSerialization() throws Exception {
- ProfileAttributes p = new ProfileAttributes();
- Document doc = XML.createDocument();
- Node root = p.toXML(doc);
- TransformerFactory tf = TransformerFactory.newInstance();
- Transformer t = tf.newTransformer();
- DOMSource s = new DOMSource(root);
- StreamResult r = new StreamResult(new NullOutputStream());
- t.transform(s, r);
- }
-
- static final ProfileAttributes TEST_PROFILE_ATTRIBUTES;
-
- static {
- List parents = Collections.singletonList("parent");
- List children = new ArrayList();
- children.add("child1");
- children.add("child2");
- List revisionNotes = new ArrayList();
- revisionNotes.add("note1");
- revisionNotes.add("note2");
- TEST_PROFILE_ATTRIBUTES = new ProfileAttributes("id", "version", "type", "statusID",
- "securityType", "parent", children, "regAuthority", revisionNotes);
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/test/java/org/apache/oodt/profile/ProfileElementTestCase.java
----------------------------------------------------------------------
diff --git a/profile/src/test/java/org/apache/oodt/profile/ProfileElementTestCase.java b/profile/src/test/java/org/apache/oodt/profile/ProfileElementTestCase.java
deleted file mode 100644
index 6a54635..0000000
--- a/profile/src/test/java/org/apache/oodt/profile/ProfileElementTestCase.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile;
-
-import junit.framework.TestCase;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.apache.oodt.commons.util.XML;
-
-/**
- * Test case for profile elements.
- *
- * @author Kelly
- */
-public abstract class ProfileElementTestCase extends TestCase {
- /** Construct the test case for the {@link ProfileElement} superclass. */
- public ProfileElementTestCase(String name) {
- super(name);
- }
-
- /**
- * Create a profile element object to test.
- *
- * The element returned must have as its owning profile the
- * <code>ProfileTest.TEST_PROFILE</code>, be named "name", have "id" as its ID,
- * have "desc" as its description, must be of type "type", have "unit" units, have
- * no synonyms, not be obligatory, may occur once, and have "comment" as its
- * comment.
- *
- * @return A profile element.
- */
- protected abstract ProfileElement createProfileElement();
-
- /**
- * Check if the given enumeration flag is valid.
- *
- * This method merely asserts that it's valid for the profile element in question.
- *
- * @param text Text to check.
- */
- protected abstract void checkEnumFlag(String text);
-
- /**
- * Check that the given value is valid.
- *
- * This method merely asserts that it's valid for the profile element in question.
- *
- * @param text Text to check.
- */
- protected abstract void checkValue(String text);
-
- /**
- * Check that the given maximum value is valid.
- *
- * This method merely asserts that it's valid for the profile element in question.
- *
- * @param text Text to check.
- */
- protected abstract void checkMaxValue(String text);
-
- /**
- * Check that the given minimum value is valid.
- *
- * This method merely asserts that it's valid for the profile element in question.
- *
- * @param text Text to check.
- */
- protected abstract void checkMinValue(String text);
-
- public void testCharacteristics() {
- ProfileElement element = createProfileElement();
- assertEquals(ProfileTest.TEST_PROFILE, element.getProfile());
-
- assertEquals("name", element.getName());
- element.setName("newName");
- assertEquals("newName", element.getName());
-
- assertEquals("id", element.getID());
- element.setID("newID");
- assertEquals("newID", element.getID());
-
- assertEquals("desc", element.getDescription());
- element.setDescription("newDesc");
- assertEquals("newDesc", element.getDescription());
-
- assertEquals("type", element.getType());
- element.setType("newType");
- assertEquals("newType", element.getType());
-
- assertEquals("unit", element.getUnit());
- element.setUnit("newUnit");
- assertEquals("newUnit", element.getUnit());
-
- assertEquals(0, element.getSynonyms().size());
- element.getSynonyms().add("synonym");
- assertEquals(1, element.getSynonyms().size());
- assertEquals("synonym", element.getSynonyms().get(0));
-
- assertTrue(!element.isObligatory());
- element.setObligation(true);
- assertTrue(element.isObligatory());
-
- assertEquals(1, element.getMaxOccurrence());
- element.setMaxOccurrence(2);
- assertEquals(2, element.getMaxOccurrence());
-
- assertEquals("comment", element.getComments());
- element.setComments("newComment");
- assertEquals("newComment", element.getComments());
- }
-
- public void testObjectMethods() {
- ProfileElement elem1 = createProfileElement();
- ProfileElement elem2 = createProfileElement();
- ProfileElement elem3 = createProfileElement();
- elem3.setName("newName");
- assertEquals(elem1, elem1);
- assertEquals(elem1, elem2);
- assertTrue(!elem1.equals(elem3));
- ProfileElement elem4 = (ProfileElement) elem3.clone();
- assertEquals(elem3, elem4);
- assertTrue(elem3 != elem4);
- }
-
- public void testXML() {
- ProfileElement element = createProfileElement();
- Document doc = XML.createDocument();
- Node root = element.toXML(doc);
- assertEquals("profElement", root.getNodeName());
- NodeList children = root.getChildNodes();
- boolean foundName = false;
- boolean foundEnumFlag = false;
- for (int i = 0; i < children.getLength(); ++i) {
- Node child = children.item(i);
- String name = child.getNodeName();
- String text = ProfileElement.text(child);
- if ("elemId".equals(name)) {
- assertEquals("id", text);
- } else if ("elemName".equals(name)) {
- assertEquals("name", text);
- foundName = true;
- } else if ("elemDesc".equals(name)) {
- assertEquals("desc", text);
- } else if ("elemType".equals(name)) {
- assertEquals("type", text);
- } else if ("elemUnit".equals(name)) {
- assertEquals("unit", text);
- } else if ("elemEnumFlag".equals(name)) {
- checkEnumFlag(text);
- foundEnumFlag = true;
- } else if ("elemValue".equals(name)) {
- checkValue(text);
- } else if ("elemMinValue".equals(name)) {
- checkMinValue(text);
- } else if ("elemMaxValue".equals(name)) {
- checkMaxValue(text);
- } else if ("elemSynonym".equals(name)) {
- // ignore
- } else if ("elemObligation".equals(name)) {
- assertEquals("Optional", text);
- } else if ("elemMaxOccurrence".equals(name)) {
- assertEquals("1", text);
- } else if ("elemComment".equals(name)) {
- assertEquals("comment", text);
- } else fail("Unknown node <" + name + "> under <profElement>");
- }
- assertTrue("Required <elemName> missing", foundName);
- assertTrue("Required <elemEnumFlag> missing", foundEnumFlag);
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/test/java/org/apache/oodt/profile/ProfileTest.java
----------------------------------------------------------------------
diff --git a/profile/src/test/java/org/apache/oodt/profile/ProfileTest.java b/profile/src/test/java/org/apache/oodt/profile/ProfileTest.java
deleted file mode 100644
index c6061b5..0000000
--- a/profile/src/test/java/org/apache/oodt/profile/ProfileTest.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile;
-
-import org.apache.oodt.commons.util.XML;
-import org.w3c.dom.Document;
-
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.util.Map;
-
-import junit.framework.TestCase;
-
-/**
- * Unit test the Profile class.
- *
- * @author Kelly
- */
-public class ProfileTest extends TestCase {
- /** Construct the test case for the Profile class. */
- public ProfileTest(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- oldProfNS = System.getProperty("jpl.rdf.ns");
- System.setProperty("jpl.rdf.ns", "http://enterprise.jpl.nasa.gov/rdfs/prof.rdf#");
-
- StringBuilder buffer = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
- buffer.append("<!DOCTYPE profile PUBLIC \"").append(Profile.PROFILES_DTD_FPI).append("\" \"")
- .append(Profile.PROFILES_DTD_URL).append("\">\n");
- BufferedReader reader = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("test.xml")));
- String line;
- while ((line = reader.readLine()) != null) {
- buffer.append(line);
- buffer.append('\n');
- }
- reader.close();
- Document doc = XML.parse(buffer.toString());
- profile1 = new Profile(buffer.toString());
- profile2 = new Profile(doc.getDocumentElement());
- }
-
- protected void tearDown() throws Exception {
- if (oldProfNS != null)
- System.setProperty("jpl.rdf.ns", oldProfNS);
- else
- System.getProperties().remove("jpl.rdf.ns");
- }
-
- public void testQueries() {
- // We test both profile1 (built from a string) and profile2 (from an XML
- // document node); they should yield the same results because they
- // represent the same document.
-
- // Test the getResourceAttribute method.
- assertEquals("PDS_PROFILE_SERVER", profile1.getResourceAttributes().getIdentifier());
- assertEquals("PDS_PROFILE_SERVER", profile2.getResourceAttributes().getIdentifier());
- assertEquals("text/html", profile1.getResourceAttributes().getFormats().get(0));
- assertEquals("text/html", profile2.getResourceAttributes().getFormats().get(0));
-
- // Test the getProfileID method.
- assertEquals("OODT_PDS_PROFILE_SERVER", profile1.getProfileAttributes().getID());
- assertEquals("OODT_PDS_PROFILE_SERVER", profile2.getProfileAttributes().getID());
-
- // Test the getProfileAttribute method
- assertEquals("profile", profile1.getProfileAttributes().getType());
- assertEquals("profile", profile2.getProfileAttributes().getType());
- assertEquals("NULL", profile1.getProfileAttributes().getSecurityType());
- assertEquals("NULL", profile2.getProfileAttributes().getSecurityType());
-
- // Test the getProfileElementItem method.
- Map elements1 = profile1.getProfileElements();
- Map elements2 = profile2.getProfileElements();
- assertEquals(3, elements1.size());
- assertEquals(3, elements2.size());
- assertTrue(elements1.containsKey("TEST"));
- assertTrue(elements2.containsKey("TEST"));
- assertTrue(!elements1.containsKey("does-not-exist"));
- assertTrue(!elements2.containsKey("does-not-exist"));
- ProfileElement element1 = (ProfileElement) elements1.get("TEST2");
- ProfileElement element2 = (ProfileElement) elements2.get("TEST2");
- assertEquals("Testing", element1.getType());
- assertEquals("Testing", element2.getType());
-
- // Test the toString and getProfileString methods ... NB: this test should
- // actually check value, not just see if they're equal.
- assertEquals(profile1.toString(), profile2.toString());
-
- // Test some miscellaneous query methods
- assertEquals("Planetary Data System (PDS) - Profile Server V1.0", profile1.getResourceAttributes().getTitle());
- assertEquals("iiop://oodt.jpl.nasa.gov:10000/JPL.PDS.PROFILE", profile1.getResourceAttributes().getResLocations()
- .get(0));
- assertEquals("system.profileServer", profile1.getResourceAttributes().getResClass());
- assertEquals("Planetary Data System (PDS) - Profile Server V1.0", profile2.getResourceAttributes().getTitle());
- assertEquals("iiop://oodt.jpl.nasa.gov:10000/JPL.PDS.PROFILE", profile2.getResourceAttributes().getResLocations()
- .get(0));
- assertEquals("system.profileServer", profile2.getResourceAttributes().getResClass());
- }
-
- /** A test profile, built from a string. */
- private Profile profile1;
-
- /** Another test profile, built from an XML document node. */
- private Profile profile2;
-
- /** Previous value of the JPL RDF namespace in the system properties. */
- private String oldProfNS;
-
- /** Another (static) test profile, for use by other test cases. */
- static Profile TEST_PROFILE = new Profile(org.apache.oodt.profile.ProfileAttributesTest.TEST_PROFILE_ATTRIBUTES,
- org.apache.oodt.profile.ResourceAttributesTest.TEST_RESOURCE_ATTRIBUTES);
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/test/java/org/apache/oodt/profile/RangedProfileElementTest.java
----------------------------------------------------------------------
diff --git a/profile/src/test/java/org/apache/oodt/profile/RangedProfileElementTest.java b/profile/src/test/java/org/apache/oodt/profile/RangedProfileElementTest.java
deleted file mode 100644
index 7fe75cf..0000000
--- a/profile/src/test/java/org/apache/oodt/profile/RangedProfileElementTest.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile;
-
-import java.util.ArrayList;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import org.apache.oodt.commons.io.NullOutputStream;
-import org.apache.oodt.commons.util.XML;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
-/**
- * Unit test the {@link RangedProfileElement} class.
- *
- * @author Kelly
- */
-public class RangedProfileElementTest extends ProfileElementTestCase {
- /** Construct the test case for the {@link RangedProfileElement} class. */
- public RangedProfileElementTest(String name) {
- super(name);
- }
-
- protected ProfileElement createProfileElement() {
- return new RangedProfileElement(ProfileTest.TEST_PROFILE, "name", "id", "desc", "type", "unit",
- /*synonyms*/ new ArrayList(), /*obligation*/false, /*maxOccurrence*/1, "comment", /*min*/"-100.0",
- /*max*/"100.0");
- }
-
- public void testIt() {
- ProfileElement element = createProfileElement();
- assertEquals("100.0", element.getMaxValue());
- assertEquals("-100.0", element.getMinValue());
- assertEquals(0, element.getValues().size());
- }
-
- public void testXMLSerialization() throws Exception {
- Profile p = new Profile();
- RangedProfileElement e = new RangedProfileElement(p);
- Document doc = XML.createDocument();
- Node root = e.toXML(doc);
- TransformerFactory tf = TransformerFactory.newInstance();
- Transformer t = tf.newTransformer();
- DOMSource s = new DOMSource(root);
- StreamResult r = new StreamResult(new NullOutputStream());
- t.transform(s, r);
- }
-
- protected void checkEnumFlag(String text) {
- assertEquals("F", text);
- }
-
- protected void checkValue(String text) {
- fail("Ranged profile element shouldn't have an enumerated value");
- }
-
- protected void checkMaxValue(String text) {
- assertEquals("100.0", text);
- }
-
- protected void checkMinValue(String text) {
- assertEquals("-100.0", text);
- }
-}
[09/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/ProtocolException.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/ProtocolException.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/ProtocolException.java
deleted file mode 100644
index 5d23fb6..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/ProtocolException.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.exceptions;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class ProtocolException extends PushPullFrameworkException {
-
- private static final long serialVersionUID = -5585263924925230711L;
-
- public ProtocolException() {
- super();
- }
-
- public ProtocolException(String msg) {
- super(msg);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/ProtocolFileException.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/ProtocolFileException.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/ProtocolFileException.java
deleted file mode 100644
index cc2b9ac..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/ProtocolFileException.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.exceptions;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class ProtocolFileException extends PushPullFrameworkException {
-
- private static final long serialVersionUID = 5518075265972710679L;
-
- public ProtocolFileException() {
- super();
- }
-
- public ProtocolFileException(String msg) {
- super(msg);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/PushPullFrameworkException.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/PushPullFrameworkException.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/PushPullFrameworkException.java
deleted file mode 100644
index 511bea8..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/PushPullFrameworkException.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.exceptions;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class PushPullFrameworkException extends Exception {
-
- private static final long serialVersionUID = 1500358666243383567L;
-
- public PushPullFrameworkException() {
- super();
- }
-
- public PushPullFrameworkException(String msg) {
- super(PushPullFrameworkException.addCallingClassToMsg(msg));
- }
-
- public PushPullFrameworkException(String msg, Throwable t) {
- super(PushPullFrameworkException.addCallingClassToMsg(msg), t);
- }
-
- private static String addCallingClassToMsg(String msg) {
- try {
- Throwable stack = new Throwable();
- stack.fillInStackTrace();
- String[] splitName = stack.getStackTrace()[3].getClassName().split(
- "\\.");
- return "[" + splitName[splitName.length - 1] + "] " + msg;
- } catch (Exception e) {
- return "[Unknown] " + msg;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/RemoteConnectionException.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/RemoteConnectionException.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/RemoteConnectionException.java
deleted file mode 100644
index b9d5c5c..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/RemoteConnectionException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.exceptions;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class RemoteConnectionException extends PushPullFrameworkException {
-
- private static final long serialVersionUID = -8694907817201161502L;
-
- public RemoteConnectionException() {
- super();
- }
-
- public RemoteConnectionException(String msg) {
- super(msg);
- }
-
- public RemoteConnectionException(String msg, Throwable t) {
- super(msg, t);
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/RetrievalMethodException.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/RetrievalMethodException.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/RetrievalMethodException.java
deleted file mode 100644
index b43e716..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/RetrievalMethodException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.exceptions;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class RetrievalMethodException extends PushPullFrameworkException {
-
- private static final long serialVersionUID = 310484176199522L;
-
- public RetrievalMethodException() {
- super();
- }
-
- public RetrievalMethodException(String msg) {
- super(msg);
- }
-
- public RetrievalMethodException(String msg, Throwable t) {
- super(msg, t);
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/ThreadEvaluatorException.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/ThreadEvaluatorException.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/ThreadEvaluatorException.java
deleted file mode 100644
index 194230e..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/ThreadEvaluatorException.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.exceptions;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class ThreadEvaluatorException extends PushPullFrameworkException {
-
- private static final long serialVersionUID = 1974215121420264162L;
-
- public ThreadEvaluatorException() {
- super();
- }
-
- public ThreadEvaluatorException(String msg) {
- super(msg);
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/ToManyFailedDownloadsException.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/ToManyFailedDownloadsException.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/ToManyFailedDownloadsException.java
deleted file mode 100644
index 961cb4b..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/ToManyFailedDownloadsException.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.exceptions;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class ToManyFailedDownloadsException extends PushPullFrameworkException {
-
- private static final long serialVersionUID = -5603700192543496505L;
-
- public ToManyFailedDownloadsException() {
- super();
- }
-
- public ToManyFailedDownloadsException(String msg) {
- super(msg);
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/UndefinedTypeException.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/UndefinedTypeException.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/UndefinedTypeException.java
deleted file mode 100644
index e853ee8..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/UndefinedTypeException.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.exceptions;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class UndefinedTypeException extends PushPullFrameworkException {
-
- private static final long serialVersionUID = -5217518860967878598L;
-
- public UndefinedTypeException() {
- super();
- }
-
- public UndefinedTypeException(String msg) {
- super(msg);
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/expressions/GlobalVariables.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/expressions/GlobalVariables.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/expressions/GlobalVariables.java
deleted file mode 100644
index 12e2038..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/expressions/GlobalVariables.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.expressions;
-
-//JDK imports
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class GlobalVariables {
-
- public static final ConcurrentHashMap<String, Variable> ConcurrentHashMap = new ConcurrentHashMap<String, Variable>();
-
- private GlobalVariables() {
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/expressions/Method.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/expressions/Method.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/expressions/Method.java
deleted file mode 100644
index d61d21b..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/expressions/Method.java
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.expressions;
-
-import org.apache.oodt.cas.pushpull.exceptions.MethodException;
-
-import java.util.LinkedList;
-import java.util.Stack;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class Method {
-
- private static Logger LOG = Logger.getLogger(Method.class.getName());
- private String name;
-
- private String infix;
-
- private LinkedList<Variable> args;
-
- private LinkedList<String> argNames;
-
- private LinkedList<Integer> argTypes;
-
- public final int INT = 0;
-
- public final int STRING = 1;
-
- public Method(String name) {
- this.name = name;
- args = new LinkedList<Variable>();
- argNames = new LinkedList<String>();
- argTypes = new LinkedList<Integer>();
- }
-
- public void addArgSignature(String name, int type) {
- argNames.add(name);
- argTypes.add(type);
- }
-
- public boolean addArg(String name, String value) {
- int nextLoc = args.size();
- if (nextLoc >= 0) {
- switch (argTypes.get(nextLoc)) {
- case INT:
- addArg(new Variable(null, Integer.valueOf(value)));
- break;
- case STRING:
- addArg(new Variable(null, value));
- break;
- default:
- return false;
- }
- return true;
- } else {
- return false;
- }
- }
-
- public void addArg(Variable v) {
- args.addLast(v);
- }
-
- public void setBehavoir(String infix) {
- this.infix = infix;
- }
-
- private LinkedList<ValidInput> convert(String infix) throws MethodException {
- try {
- LinkedList<ValidInput> output = new LinkedList<ValidInput>();
- Stack<ValidInput> stack = new Stack<ValidInput>();
- char[] infixArray = infix.toCharArray();
- for (int i = 0; i < infixArray.length; i++) {
- char c = infixArray[i];
- // System.out.println("Next C = " + c);
- switch (c) {
- case '$':
- StringBuilder variable = new StringBuilder("");
- boolean globalVar = false;
-
- // skip $ by incr i and if true then variable is a global
- // variable and skip '{' by incr i again
- if (infixArray[++i] == '{') {
- globalVar = true;
- i++;
- }
-
- for (; i < infixArray.length; i++) {
- char ch = infixArray[i];
- // System.out.println("ch = " + ch);
- if ((ch <= 'Z' && ch >= 'A')
- || (ch <= 'z' && ch >= 'a')
- || (ch <= '9' && ch >= '0') || ch == '_') {
- variable.append(ch);
- } else {
- break;
- }
- }
-
- if (globalVar) {
- try {
- output.addLast(GlobalVariables.ConcurrentHashMap.get(variable
- .toString()));
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- }
- } else {
- i--;
- output.addLast(args.get(argNames.indexOf(variable
- .toString())));
- }
- break;
- case '#':
- StringBuilder variableIntString = new StringBuilder("");
- int k = i + 1;
- for (; k < infixArray.length; k++) {
- char ch = infixArray[k];
- if (ch <= '9' && ch >= '0') {
- variableIntString.append(ch);
- } else {
- break;
- }
- }
- output.addLast(new Variable(null, Integer.valueOf(
- variableIntString.toString())));
- i = k - 1;
- break;
- case '"':
- StringBuilder variableString = new StringBuilder("");
- int l = i + 1;
- for (; l < infixArray.length; l++) {
- char ch = infixArray[l];
- if (ch == '"') {
- break;
- } else {
- variableString.append(ch);
- }
- }
- output
- .addLast(new Variable(null, variableString
- .toString()));
- i = l;
- break;
- case '+':
- case '-':
- case '/':
- case '*':
- while (!stack.empty()
- && hasHigherPrecedence(stack.peek().toString()
- .charAt(0), c)) {
- output.addLast(stack.pop());
- }
- stack.push(new Operator(c + ""));
- break;
- case ')':
- while (!stack.empty()) {
- ValidInput vi = stack.pop();
- if (vi.toString().charAt(0) == '(') {
- break;
- }
- output.addLast(vi);
- }
- break;
- case '(':
- stack.push(new Punctuation(c + ""));
- break;
-
- }
- }
- while (!stack.empty()) {
- output.addLast(stack.pop());
- }
-
- return output;
- } catch (Exception e) {
- throw new MethodException("Failed to convert infix to postfix : "
- + e.getMessage());
- }
- }
-
- public Object execute() throws MethodException {
- try {
- Stack<ValidInput> stack = new Stack<ValidInput>();
- LinkedList<ValidInput> postfix = convert(infix);
- for (ValidInput vi : postfix) {
- if (vi instanceof Variable) {
- stack.push(vi);
- } else if (vi instanceof Operator) {
- ValidInput first = stack.pop();
- ValidInput second = stack.pop();
- switch (vi.toString().charAt(0)) {
- case '+':
- if (((Variable) first).isString()
- || ((Variable) second).isString()) {
- String value = second.toString() + first.toString();
- stack.push(new Variable(null, value));
- } else if (((Variable) first).isInteger()
- && ((Variable) second).isInteger()) {
- Integer value = (Integer) second
- .getValue()
- + (Integer) first.getValue();
- stack.push(new Variable(null, value));
- } else {
- throw new MethodException(
- "Invalid Concatination/Addition types. . .must be String or Integer");
- }
- break;
- case '-':
- if (((Variable) first).isInteger()
- && ((Variable) second).isInteger()) {
- Integer value = (Integer) second
- .getValue()
- - (Integer) first.getValue();
- stack.push(new Variable(null, value));
- } else {
- throw new MethodException(
- "Invalid Subtraction types. . .must be Integer");
- }
- break;
- case '*':
- if (((Variable) first).isInteger()
- && ((Variable) second).isInteger()) {
- Integer value = (Integer) second
- .getValue()
- * (Integer) first.getValue();
- stack.push(new Variable(null, value));
- } else {
- throw new MethodException(
- "Invalid Multiplication types. . .must be Integer");
- }
- break;
- case '/':
- if (((Variable) first).isInteger()
- && ((Variable) second).isInteger()
- && (Integer) first.getValue() > 0) {
- Integer value = (Integer) second
- .getValue()
- / (Integer) first.getValue();
- stack.push(new Variable(null, value));
- } else {
- throw new MethodException(
- "Invalid Division types. . .must be Integer and denominator must be greater than 0");
- }
- break;
- }
- }
- }
- return stack.pop().getValue();
- } catch (Exception e) {
- throw new MethodException("Failed to execute method " + name
- + " : " + e.getMessage());
- }
- }
-
- // does first have higher precedence than second
- private boolean hasHigherPrecedence(char first, char second) {
- switch (first) {
- case '+':
- case '-':
- switch (second) {
- case '+':
- case '-':
- return true;
- }
- return false;
- case '*':
- case '/':
- return true;
- }
- return false;
- }
-
- public String getName() {
- return name;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/expressions/Operator.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/expressions/Operator.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/expressions/Operator.java
deleted file mode 100644
index d6f16a9..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/expressions/Operator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.expressions;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class Operator implements ValidInput {
-
- private String value;
-
- public Operator(String value) {
- this.value = value;
- }
-
- public Object getValue() {
- return value;
- }
-
- public String toString() {
- return value;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/expressions/Punctuation.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/expressions/Punctuation.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/expressions/Punctuation.java
deleted file mode 100644
index fb108ad..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/expressions/Punctuation.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.expressions;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class Punctuation implements ValidInput {
-
- private String value;
-
- public Punctuation(String value) {
- this.value = value;
- }
-
- public Object getValue() {
- return value;
- }
-
- public String toString() {
- return value;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/expressions/ValidInput.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/expressions/ValidInput.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/expressions/ValidInput.java
deleted file mode 100644
index 729722b..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/expressions/ValidInput.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.expressions;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public interface ValidInput {
-
- Object getValue();
-
- String toString();
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/expressions/Variable.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/expressions/Variable.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/expressions/Variable.java
deleted file mode 100644
index 7dde7ae..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/expressions/Variable.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.expressions;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class Variable implements ValidInput {
-
- private String name;
-
- private Object value;
-
- private int fillSide;
-
- private String fillString;
-
- private int precision;
-
- private int type;
-
- public final int FILL_FRONT = 0;
-
- public final int FILL_BACK = 1;
-
- public final int TYPE_STRING = 2;
-
- public final int TYPE_INTEGER = 3;
-
- public Variable(String name) {
- this(name, null);
- }
-
- public Variable(String name, Object value) {
- this.name = name;
- this.value = value;
- fillSide = FILL_FRONT;
- fillString = " ";
- precision = -1;
- }
-
- public boolean isString() {
- return value instanceof String;
- }
-
- public boolean isInteger() {
- return value instanceof Integer;
- }
-
- public void setValue(Object value) {
- this.value = value;
- if (value instanceof String) {
- type = TYPE_STRING;
- } else if (value instanceof Integer) {
- type = TYPE_INTEGER;
- }
- }
-
- public void setPrecision(int precision) {
- this.precision = precision;
- }
-
- public void setFillString(String fillString) {
- this.fillString = fillString;
- }
-
- public void setFillSide(int fillSide) {
- this.fillSide = fillSide;
- }
-
- public Object getValue() {
- return value;
- }
-
- public int getPrecision() {
- return precision;
- }
-
- public String getFillString() {
- return fillString;
- }
-
- public int getFillSide() {
- return fillSide;
- }
-
- public String getName() {
- return name;
- }
-
- public String toString() {
- String strValue = value.toString();
- if (strValue.length() < this.precision) {
- while (strValue.length() < this.precision) {
- if (fillSide == FILL_FRONT) {
- strValue = fillString + strValue;
- } else {
- strValue = strValue + fillString;
- }
- }
- }
- return strValue;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/FileRestrictions.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/FileRestrictions.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/FileRestrictions.java
deleted file mode 100644
index 38f5ecb..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/FileRestrictions.java
+++ /dev/null
@@ -1,518 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.filerestrictions;
-
-//OODT imports
-import org.apache.oodt.cas.pushpull.protocol.ProtocolPath;
-
-//JDK imports
-import java.util.LinkedList;
-
-
-/**
- * This class allows the creation of restrictions for files and directories created below an actual directory which is passed
- * into the constructor. These restriction are loaded by passing a FileInputStream which contains a XML File
- * into the method and can be tested against by using the method.
- *
- * <pre>
- * The XML file schema is:
- * {@literal <root>
- * <variables>
- * <variable name="variable-name">
- * <type>INT-or-STRING</type>
- * <value>variable-value</value>
- * <precision>
- * <locations>number-of-fill-locations</locations>
- * <fill>fill-value</fill>
- * <side>front-or-back</side>
- * </precision>
- * </variable>
- * ...
- * ...
- * </variables>
- *
- * <methods>
- * <method name="method-name">
- * <args>
- * <arg name="argument-name">
- * <type>INT-or-STRING</type>
- * </arg>
- * ...
- * ...
- * </args>
- * <action>method-behavior</action>
- * </method>
- * ...
- * ...
- * </methods>
- *
- * <dirstruct name="root-directory-name">
- * <nodirs/>
- * <nofiles/>
- * <file name="file-name"/>
- * <dir name="directory-name">
- * <nodirs/>
- * <nofiles/>
- * <file name="file-name"/>
- * <dir name="directory-name">
- * ...
- * ...
- * </dir>
- * </dir>
- * ...
- * ...
- * </dirstruct>
- * </root>}
- * </pre>
- *
- * <i>{@literal <variables>}</i> and <i>{@literal <methods>}</i> can be created in this XML file so that they can be used in the <i>{@literal <dirstruct>}</i>
- * portion of the XML file. These <i>{@literal <variables>}</i> and <i>{@literal <methods>}</i> can be used inside the <i>{@literal <dir>}</i> and
- * <i>{@literal <file>}</i> elements within the <i>{@literal <dirstruct>}</i> element to allow for varrying directory and file names beyond the capability
- * of regular expressions (which are also allowed).
- *
- * <h2>VARIABLES (OPTIONAL):</h2>
- * Let's start with describing the <i>{@literal <variables>}</i> portion of the XML file. As many <i>{@literal <variable>}</i> elements as you would like
- * can be specified inside the <i>{@literal <variables>}</i> tag. The <i>{@literal <variable>}</i> element must have a parameter, 'name', which is the name
- * of this <i>{@literal <variable>}</i>. Every <i>{@literal <variable>}</i> is a global variable (that is, global in the scope of the XML file it is declared
- * in -- it is not usable in other XML file, unless redeclared) so variable names are unique (however, are case sensitive) so thus a name can only
- * be applied to one <i>{@literal <variable>}</i>. Within the <i>{@literal <variable>}</i> element there are three possible sub-elements that can be included.
- * <i>{@literal <type>}</i> and <i>{@literal <value>}</i> are required and <i>{@literal <precision>}</i> is optional. <i>{@literal <type>}</i> can be either (and it must be
- * in all UPPERCASE) INT or STRING (sorry, floating point numbers are not supported as of yet). This specifies what type of value will be given in
- * <i>{@literal <value>}</i>. This allows you to both use numerical values as either an integer or a string. <i>{@literal <precision>}</i> can also be specified
- * for each <i>{@literal <variable>}</i>. This allows you to insure that an integer or string will take up a certain amount of space. This is especially
- * useful when dealing with dates. For instance, say you had the following in your XML file:
- *
- * <pre>
- * {@literal <variable name="myVariable">
- * <type>INT</type>
- * <value>3</value>
- * </variable>}
- * </pre>
- *
- * When myVariable was finally returned it would look like 3, however many times for dates you would like 03 returned. You can specify this by adding
- * precision to the following XML:
- *
- * <pre>
- * {@literal <variable name="myVariable">
- * <type>INT</type>
- * <value>3</value>
- * <precision>
- * <locations>2</locations>
- * <fill>0</fill>
- * <side>front</side>
- * </precision>
- * </variable>}
- * </pre>
- *
- * This insures that the number is always printed with 2 digits and if the number does not take up 2 digits worth of space a fill value 0 will be added
- * to the front side of the integer, thus, in this example would give us 03. Note: <i>{@literal <value>03</value>}</i> would NOT accomplish the same!!!!
- *
- * <h2>METHODS (OPTIONAL):</h2>
- * Next let's look at the <i>{@literal <methods>}</i> portion of the XML file. <i>{@literal <method>}</i> elements must have a 'name' parameter, which is the name of the
- * <i>{@literal <method>}</i>. Every <i>{@literal <method>}</i> is also global in the same way as is every <i>{@literal <variable>}</i> and are also case-sensitive, thus method
- * names must be unique. A <i>{@literal <method>}</i> element may contain an <i>{@literal <args>}</i> sub-element, however this is optional and only needed if the method
- * is to take any arguments. If an <i>{@literal <args>}</i> element is given, then it should contain at least one <i>{@literal <arg>}</i> element. A <i>{@literal <method>}</i>
- * may contain as many <i>{@literal <arg>}</i> elements as it needs. What is being specified by a <i>{@literal <method>}</i> element is what would be known in java code
- * as the method signature. Thus all we are going to specify is each argument's name and type. Thus each <i>{@literal <arg>}</i> element must contain
- * a 'name' parameter, which is the name of the argument and must contain a <i>{@literal <type>}</i> sub-element, so it is known how to treat the arguments when
- * the method is used within the <i>{@literal <dirstruct>}</i> section of the XML file. Another sub-element, which is required, for the <i>{@literal <method>}</i>
- * element is the <i>{@literal <action>}</i> element. This element contains the behavior of the <i>{@literal <method>}</i>. Before going into detail about what can be
- * placed within the <i>{@literal <action>}</i> element let's first cover some syntax requirements for the XML file.
- *
- * <h2>SYNTAX REQUIREMENTS:</h2>
- * When a <i>{@literal <variable>}</i> is used it must be preceded by $ and inclosed in {} (e.g. ${myVariable}).<br>
- * When a <i>{@literal <method>}</i> is used it must be preceded by % and end with () (e.g. %myMethod(), however if arguments are given then %myMethod(12,9)).<br>
- * When a <i>{@literal <method>}</i> argument (<i>{@literal <arg>}</i> element) is used is must be preceded by $ (e.g. $myArg).<br>
- * When a literal integer is used it must be preceded by # (e.g. #234).<br>
- * When a literal string is used it must be inclosed in " (e.g. "my age is 56 -- no not really").<br>
- *
- * <p>NOTE: When passing arguments into methods the string and integer literal rules do not need to be followed because you have already defined what each
- * argument type should be and they will be evaluated as such.</p>
- * <p>NOTE*: Also note that at present a <i>{@literal <variable>}</i> cannot be passed as an argument to the methods. Just use the <i>{@literal <variable>}</i> where needed
- * inside the <i>{@literal <action>}</i> element. This feature should hopefully be added in a later release.</p>
- *
- * <h2>METHOD'S ACTION ELEMENT USAGE:</h2>
- * The <i>{@literal <action>}</i> element will evaluate expressions that contain both integers and strings. It obeys the rules of mathematical precedence and will
- * also handle parentheses. It also, like Java, still follows the order of precedence when strings are present. That is, if you have the expression:<br>
- *    <i>#2+#4+" years old, going on "+#2+#4</i><br>
- * It would evaluate to:<br>
- *    <i>6 years old, going on 24</i><br>
- * You may use any <i>{@literal <variable>}</i> declared within the same XML file and may also use any argument (<i>{@literal <arg>}</i> element) declared within that
- * <i>{@literal <method>}</i>. Also string and integer literals may be used. Currently the only operators supported are +,-,*,/ (which are respectively:
- * addition, subtraction, multiplication, and division). Parentheses, (), and embedded parentheses, (()()), are also all allowed.
- *
- * <h2>DIRSTRUCT:</h2>
- * The final section of the XML file is the actual main purpose of the XML file. This is the XML that controls which directories the crawler will be allowed
- * to crawl and which files will be allowed. The <i>{@literal <dirstruct>}</i> element requires a 'name' parameter which is the path to the root
- * directory that is to be considered (that is, all other directories below the given directory are unimportant and will not be crawled). You want your root
- * directory path to stop at the first directory in which you are interested in more than one of its sub-directories or want file(s) inside it.
- * For example, let say we want to crawl a remote site that has the following directory structure:
- *
- * <pre>
- * -parent
- * -child1
- * -grandChild1
- * -greatGrandChild1
- * -file1
- * -greatGrandChild2
- * -grandChild2
- * -file1
- * -child2
- * -file1
- * -child3
- * -file1
- * -file2
- * -grandChild1
- * -file1
- * -file2
- * -child4
- * </pre>
- *
- * Now, say, we only are interested in directories and files below the two shown 'grandChild1' directories. This would mean that for our <i>{@literal <dirstruct>}</i>
- * 'name' parameter we would put name="parent". This is because we need access to both 'child1' and 'child3' subdirectories. Now in order to avoid crawling
- * 'child2' and 'child4' directories we have to specify <i>{@literal <dir>}</i> elements. This would give us the following XML:
- *
- * <pre>
- * {@literal <dirstruct name="/parent">
- * <dir name="child1"/>
- * <dir name="child3"/>
- * </dirstruct>}
- * </pre>
- *
- * This would restrict the directories allowed under 'parent' to only be directories with names either 'child1' or 'child3', all other directory names will
- * be rejected. However, more must be added to this example because we have not yet specified any restrictions on files allowed beneath 'parent',
- * we have to add the <i>{@literal <nofiles/>}</i> element:
- *
- * <pre>
- * {@literal <dirstruct name="/parent">}
- * <i><b>{@literal <nofiles/>}</b></i>
- * {@literal <dir name="child1"/>
- * <dir name="child3"/>
- * </dirstruct>}
- * </pre>
- *
- * Now the only thing acceptable below parent is 'child1' and 'child3'. We have to still further our restrictions under 'child1' and 'child3'. Since under
- * 'child1' we only want 'grandChild1' we would have to make another <i>{@literal <dir>}</i> element and also add a <i>{@literal <nofiles/>}</i> element:
- *
- * <pre>
- * {@literal <dirstruct name="/parent">
- * <nofiles/>
- * <dir name="child1">}
- * <i><b>{@literal <nofiles/>
- * <dir name="grandChild1"/>}</b></i>
- * {@literal </dir>
- * <dir name="child3"/>
- * </dirstruct>}
- * </pre>
- *
- * We have to do the same also for 'child3', giving us:
- *
- * <pre>
- * {@literal <dirstruct name="/parent">
- * <nofiles/>
- * <dir name="child1">
- * <nofiles/>
- * <dir name="grandChild1"/>
- * </dir>
- * <dir name="child3">}
- * <i><b>{@literal <nofiles/>
- * <dir name="grandChild1"/>}</b></i>
- * {@literal </dir>
- * </dirstruct>}
- * </pre>
- *
- * From the example directory structure above, with this XML file specified, that directory structure would be limited to:
- *
- * <pre>
- * -parent
- * -child1
- * -grandChild1
- * -greatGrandChild1
- * -file1
- * -greatGrandChild2
- * -child3
- * -grandChild1
- * -file1
- * -file2
- * </pre>
- *
- * Say we now decide that we only want files below the two 'grandChild1' directories -- that is, no directories. So we would change or XML by adding
- * in the <i>{@literal <nodir/>}</i> element:
- *
- * <pre>
- * {@literal <dirstruct name="/parent">
- * <nofiles/>
- * <dir name="child1">
- * <nofiles/>
- * <dir name="grandChild1">}
- * <i><b>{@literal <nodirs/>}</b></i>
- * {@literal </dir>
- * </dir>
- * <dir name="child3">
- * <nofiles/>
- * <dir name="grandChild1">}
- * <i><b>{@literal <nodirs/>}</b></i>
- * {@literal </dir>
- * </dir>
- * </dirstruct>}
- * </pre>
- *
- * Which now restricts our directory structure to:
- *
- * <pre>
- * -parent
- * -child1
- * -grandChild1
- * -child3
- * -grandChild1
- * -file1
- * -file2
- * </pre>
- *
- * Let's further specify now that we only want 'file1' in the '/parent/child3/grandChild1' directory. This would change the XML to:
- *
- * <pre>
- * {@literal <dirstruct name="/parent">
- * <nofiles/>
- * <dir name="child1">
- * <nofiles/>
- * <dir name="grandChild1">
- * <nodirs/>
- * </dir>
- * </dir>
- * <dir name="child3">
- * <nofiles/>
- * <dir name="grandChild1">
- * <nodirs/>}
- * <i><b>{@literal <file name="file1"/>}</b></i>
- * {@literal </dir>
- * </dir>
- * </dirstruct>}
- * </pre>
- *
- * Our new allowed directory structure would now be:
- *
- * <pre>
- * -parent
- * -child1
- * -grandChild1
- * -child3
- * -grandChild1
- * -file1
- * </pre>
- *
- * NOTES:
- * -You would not want to use the <i>{@literal <nofiles/>}</i> and <i>{@literal <file>}</i> elements in the same directory (same goes for the
- * <i>{@literal <nodirs/>}</i> and <i>{@literal <dir>}</i> elements) because you would be specifying that you don't want any files in that
- * directory, and then contradict yourself by specifying a <i>{@literal <file>}</i> element that is okay to have. The <i>{@literal <file>}</i>
- * element states that no other file but the file I specified is allowed. The only exception is if you have two or more <i>{@literal <file>}</i>
- * elements in the same directory -- this is allowed. It follows the same rules as the <i>{@literal <dir>}</i> element in the example
- * given above where only 'child1' and 'child3' were allow. The two don't cancel each other out.
- *
- * <h2>ADVANCED USAGES OF DIRSTRUCT:</h2>
- * Regular expressions are allowed in the 'name' parameter of both <i>{@literal <dir>}</i> and <i>{@literal <file>}</i> elements. Also any
- * <i>{@literal <method>}</i> or <i>{@literal <variable>}</i> element declared can be used within the 'name' parameter of both <i>{@literal <dir>}</i>
- * and <i>{@literal <file>}</i> elements. There are also several predefined variables that can be used.
- *
- * <h4>REGULAR EXPRESSIONS:</h4>
- * The regular expressions are parsed by the <a href=http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html>Pattern</a> class
- * (See its documentation on rule for specifying regular expressions). Here is an example use of a regular expression:
- *
- * <pre>
- * {@literal <dirstruct name="/.../temp/test">
- * <nofiles/>
- * <dir name="\d{4}-\d{2}-\d{2}">
- * <nodirs/>
- * </dir>
- * </dirstruct>}
- * </pre>
- *
- * This would restrict the directory files in directories below /.../temp/test to only directories whose names are dates of the
- * format: YYYY-MM-DD.
- *
- * <h4>PREDEFINED DATE VARIABLES:</h4>
- * There are several predefined date variables than can be put as the <i>{@literal <value>}</i> of a <i>{@literal <variable>}</i> and then used.
- *
- * These variables are:
- * <pre>
- * [DATE.DAY] - day of today's date
- * [DATE.MONTH] - month of today's date
- * [DATE.YEAR] - year of today's date
- * [DATE-N.DAY] - the day of the date N days ago
- * [DATE-N.MONTH] - the month of the date N days ago
- * [DATE-N.YEAR] - the year of the date N days ago
- * [DATE+N.DAY] - the day of the date N days from now
- * [DATE+N.MONTH] - the month of the date N days from now
- * [DATE+N.YEAR] - the year of the date N days from now
- *
- * -sorry, no DayOfYear implemented yet -- hopefully in a later release
- * </pre>
- *
- * Usage:
- * <pre>
- * {@literal <root>
- * <variables>
- * <variable name="todaysDay">
- * <type>INT</type>
- * <value>[DATE.DAY]</value>
- * <precision>
- * <locations>2</locations>
- * <fill>0</fill>
- * <side>front</side>
- * </precision>
- * </variable>
- * </variabls>
- * <dirstruct name="/path/to/parent/dir">
- * <nofiles/>
- * <dir name="MyFiles">
- * <nodirs/>
- * <file name="MyPaper_${todaysDay}"/>
- * </dir>
- * </dirstruct>
- * </root>}
- * </pre>
- *
- * This would allow only a file in /path/to/parent/dir/MyFiles which had the name which started with MyPaper_ and ended with the
- * day of the current day of the month. For example, if to days date was 03/23/2005, then the file name allowed would be
- * MyPaper_23.
- *
- * <h4>METHOD AND VARIABLE USAGE IN DIRSTRUCT:</h4>
- * Here is an example of using <i>{@literal <variables>}</i> and <i>{@literal <methods>}</i>:
- *
- * <pre>
- * {@literal <root>
- * <variables>
- * <variable name="DAY">
- * <type>INT</type>
- * <value>[DATE.DAY]</value>
- * <precision>
- * <locations>2</locations>
- * <fill>0</fill>
- * <side>front</side>
- * </precision>
- * </variable>
- * <variable name="MONTH">
- * <type>INT</type>
- * <value>[DATE.MONTH]</value>
- * <precision>
- * <locations>2</locations>
- * <fill>0</fill>
- * <side>front</side>
- * </precision>
- * </variable>
- * <variable name="YEAR">
- * <type>INT</type>
- * <value>[DATE.YEAR]</value>
- * </variable>
- * </variables>
- *
- * <methods>
- * <method name="ADD">
- * <args>
- * <arg name="1">
- * <type>INT</type>
- * </arg>
- * </args>
- * <action>"THE_YEAR_PLUS_"+$1+": "+(${YEAR}+$1)</action>
- * </method>
- * <method name="HOW_OLD_AM_I">
- * <action>${YEAR}-#1984</action>
- * </method>
- * <method name="DATE">
- * <action>${YEAR}+"-"+${MONTH}+"-"+${DAY}</action>
- * </method>
- * </methods>
- *
- * <dirstruct name="/path/to/parent/dir">
- * <nofiles/>
- * <dir name="AGE_%HOW_OLD_AM_I()"/>
- * <dir name="DATE">
- * <nodirs/>
- * <file name="%ADD(5)"/>
- * </dir>
- * </dirstruct>
- * </root>}
- * </pre>
- *
- * This would accept only the directories under /path/to/parent/dir which had the name (given today is 9/7/2007) 'AGE_23' or '2007-09-07'.
- * This would allow any file or directory in under 'AGE_23', but would only allow a file with the name 'THE_YEAR_PLUS_5: 2012' in the
- * directory '2007-09-07'.
- *
- *
- * @author bfoster
- *
- */
-public class FileRestrictions {
-
- private FileRestrictions() throws InstantiationException{
- throw new InstantiationException("Don't construct FileRestrictions!");
- }
-
- /**
- *
- * @param path
- * @return The initial cd directory which needs to be changed to (in order
- * to take care of possible auto-mounted directories)
- */
- public static boolean isAllowed(ProtocolPath path, VirtualFile root) {
- return (isValidPath(path) && isAllowed(new VirtualFile(path
- .getPathString(), path.isDirectory()), root));
- }
-
- public static boolean isAllowed(VirtualFile file, VirtualFile root) {
- boolean vfDoesNotExist = false, lastFileIsDir = file.isDir();
- VirtualFile vf;
- while ((vf = root.getChildRecursive(file)) == null) {
- vfDoesNotExist = true;
- lastFileIsDir = file.isDir();
- file = file.getParentFile();
- if (file == null) {
- break;
- }
- }
- return !(file == null || (vfDoesNotExist && ((lastFileIsDir && !vf
- .allowNewDirs()) || (!lastFileIsDir && !vf.allowNewFiles()))));
- }
-
- private static boolean isValidPath(ProtocolPath path) {
- return path != null && !path.getFileName().equals(".")
- && !path.getFileName().equals("..");
- }
-
- public static LinkedList<String> toStringList(VirtualFile root) {
- LinkedList<String> stringList = new LinkedList<String>();
- stringList.addAll(toStringList(root.getChildren(), ""));
- return stringList;
- }
-
- private static LinkedList<String> toStringList(
- LinkedList<VirtualFile> children, String curPath) {
- LinkedList<String> stringList = new LinkedList<String>();
- for (VirtualFile child : children) {
- String currentPath = curPath + "/" + child.getRegExp();
- if (!child.isDir()) {
- stringList.add(currentPath);
- } else {
- stringList
- .addAll(toStringList(child.getChildren(), currentPath));
- }
- }
- return stringList;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/Parser.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/Parser.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/Parser.java
deleted file mode 100644
index 2d49fe4..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/Parser.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.filerestrictions;
-
-//JDK imports
-import java.io.FileInputStream;
-
-
-import org.apache.oodt.cas.metadata.Metadata;
-//OODT imports
-import org.apache.oodt.cas.pushpull.exceptions.ParserException;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public interface Parser {
-
- VirtualFileStructure parse(FileInputStream inputFile, Metadata metadata)
- throws ParserException;
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/VirtualFile.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/VirtualFile.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/VirtualFile.java
deleted file mode 100644
index ae16686..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/VirtualFile.java
+++ /dev/null
@@ -1,315 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.filerestrictions;
-
-import java.util.LinkedList;
-import java.util.StringTokenizer;
-import java.util.regex.Pattern;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class VirtualFile {
-
- private String regExp;
-
- private LinkedList<VirtualFile> children;
-
- private VirtualFile parent;
-
- private boolean noDirs;
-
- private boolean noFiles;
-
- private boolean isDir;
-
- private boolean allowNewFiles;
-
- private boolean allowNewDirs;
-
- private VirtualFile(boolean isDir) {
- this.isDir = isDir;
- children = new LinkedList<VirtualFile>();
- noDirs = noFiles = !isDir;
- allowNewFiles = allowNewDirs = isDir;
- }
-
- public VirtualFile(String path, boolean isDir) {
- this(isDir);
-
- if (path != null) {
- StringTokenizer st = new StringTokenizer(path, "/");
-
- if (st.countTokens() > 1) {
- VirtualFile vf = path.startsWith("/") ? VirtualFile
- .createRootDir()
- : new VirtualFile(st.nextToken(), true);
- String curRegExp = st.nextToken();
-
- while (st.hasMoreTokens()) {
- VirtualFile temp = new VirtualFile(curRegExp, true);
- vf.addChild(temp);
- vf = temp;
- curRegExp = st.nextToken();
- }
- this.regExp = curRegExp;
- vf.addChild(this);
- } else if (st.countTokens() > 0) {
- this.regExp = st.nextToken();
- if (path.startsWith("/")) {
- VirtualFile.createRootDir().addChild(this);
- }
- } else {
- this.copy(VirtualFile.createRootDir());
- }
- } else {
- this.copy(VirtualFile.createRootDir());
- }
- }
-
- public VirtualFile(VirtualFile root, String path, boolean isDir) {
- this(isDir);
-
- if (path != null) {
- StringTokenizer st = new StringTokenizer(path, "/");
-
- if (st.countTokens() > 0) {
- VirtualFile vf = root;
- String curRegExp = st.nextToken();
-
- while (st.hasMoreTokens()) {
- VirtualFile temp = new VirtualFile(curRegExp, true);
- vf.addChild(temp);
- vf = temp;
- curRegExp = st.nextToken();
- }
- this.regExp = curRegExp;
- vf.addChild(this);
- } else {
- this.copy(root);
- }
- } else {
- this.copy(root);
- }
- }
-
- public static VirtualFile createRootDir() {
- VirtualFile root = new VirtualFile(true);
- root.regExp = "/";
- return root;
- }
-
- public VirtualFile getRootDir() {
- VirtualFile vf = this;
- while (vf.getParentFile() != null) {
- vf = vf.getParentFile();
- }
- return vf;
- }
-
- public static VirtualFile mergeTwoFiles(VirtualFile vf1, VirtualFile vf2) {
- if (vf1.isDir) {
- VirtualFile newFile = VirtualFile.createRootDir();
- newFile.children.addAll(vf1.children);
- newFile.children.addAll(vf2.children);
- return newFile;
- } else {
- return null;
- }
- }
-
- public void addChild(VirtualFile vf) {
- if (this.isDir) {
- VirtualFile existingChildWithSameName = this.getChild(vf.regExp,
- vf.isDir);
- if (existingChildWithSameName == null) {
- children.add(vf);
- if (vf.isDir()) {
- allowNewDirs = false;
- } else {
- allowNewFiles = false;
- }
- vf.parent = this;
- } else {
- vf.copy(existingChildWithSameName);
- }
- }
- }
-
- public LinkedList<VirtualFile> getChildren() {
- return children;
- }
-
- public VirtualFile getChild(String regExp, boolean isDirectory) {
- for (VirtualFile vf : children) {
- if ((regExp.equals(vf.regExp) || Pattern.matches(vf.regExp, regExp))
- && vf.isDir == isDirectory) {
- return vf;
- }
- }
- return null;
- }
-
- public VirtualFile getChildRecursive(VirtualFile vf) {
- return this.getChildRecursive(vf.getAbsolutePath(), vf.isDir);
- }
-
- public VirtualFile getChildRecursive(String path, boolean isDirectory) {
- StringTokenizer st = new StringTokenizer(path, "/");
- VirtualFile vf = this;
- while (st.hasMoreTokens()) {
- String curRegExp = st.nextToken();
- if (st.hasMoreTokens()) {
- if ((vf = vf.getChild(curRegExp, true)) == null) {
- return null;
- }
- } else {
- return vf.getChild(curRegExp, isDirectory);
- }
- }
- return null;
- }
-
- public boolean hasChild(VirtualFile vf) {
- return children.contains(vf);
- }
-
- public String getAbsolutePath() {
- if (regExp == null) {
- return null;
- }
- StringBuilder path = new StringBuilder(this.regExp);
- VirtualFile parent = this.parent;
- while (parent != null) {
- path.insert(0, (!parent.regExp.equals("/") ? parent.regExp : "") + "/");
- parent = parent.parent;
- }
- return path.toString();
- }
-
- public VirtualFile getParentFile() {
- return parent;
- }
-
- public String getRegExp() {
- return regExp;
- }
-
- public void setNoDirs(boolean noDirs) {
- if (this.isDir) {
- if (noDirs) {
- allowNewDirs = false;
- }
- this.noDirs = noDirs;
- }
- }
-
- public void setNoFiles(boolean noFiles) {
- if (this.isDir) {
- if (noFiles) {
- allowNewFiles = false;
- }
- this.noFiles = noFiles;
- }
- }
-
- public boolean allowNewDirs() {
- return allowNewDirs;
- }
-
- public boolean allowNewFiles() {
- return allowNewFiles;
- }
-
- public boolean allowNoDirs() {
- return noDirs;
- }
-
- public boolean allowNoFiles() {
- return noFiles;
- }
-
- public boolean isDir() {
- return isDir;
- }
-
- public void copy(VirtualFile vf) {
- this.allowNewDirs = vf.allowNewDirs;
- this.allowNewFiles = vf.allowNewFiles;
- this.children = vf.children;
- this.isDir = vf.isDir;
- this.noDirs = vf.noDirs;
- this.noFiles = vf.noFiles;
- this.parent = vf.parent;
- this.regExp = vf.regExp;
- }
-
- // TODO: make it compare against all variables
- public boolean equals(Object obj) {
- if (obj instanceof VirtualFile) {
- VirtualFile compareFile = (VirtualFile) obj;
- if (compareFile.getRegExp().equals(regExp)
- && compareFile.isDir() == this.isDir) {
- return true;
- }
- }
- return false;
- }
-
- public String toString() {
- StringBuilder sb = new StringBuilder(
- "-<VirtualFile>\t : allowNewDirs/noDirs\t : allowNewFiles/noFiles\n------------\n");
- LinkedList<VirtualFile> printFiles = new LinkedList<VirtualFile>();
- printFiles.add(this);
- sb.append(printVirtualFiles(printFiles, "-"));
- return sb.toString();
- }
-
- private StringBuffer printVirtualFiles(LinkedList<VirtualFile> list,
- String spacer) {
- StringBuffer output = new StringBuffer("");
- for (VirtualFile vf : list) {
- output.append(spacer);
- output.append(vf.getRegExp()).append(vf.isDir && !vf.regExp.equals("/") ? "/" : "").append("\t : ")
- .append(vf.allowNewDirs).append("/").append(vf.noDirs).append("\t\t : ").append(vf.allowNewFiles)
- .append("/").append(vf.noFiles).append("\n");
- output.append(printVirtualFiles(vf.getChildren(), " " + spacer));
- }
- return output;
- }
-
- @Override
- public int hashCode() {
- int result = regExp != null ? regExp.hashCode() : 0;
- result = 31 * result + (children != null ? children.hashCode() : 0);
- result = 31 * result + (parent != null ? parent.hashCode() : 0);
- result = 31 * result + (noDirs ? 1 : 0);
- result = 31 * result + (noFiles ? 1 : 0);
- result = 31 * result + (isDir ? 1 : 0);
- result = 31 * result + (allowNewFiles ? 1 : 0);
- result = 31 * result + (allowNewDirs ? 1 : 0);
- return result;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/VirtualFileStructure.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/VirtualFileStructure.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/VirtualFileStructure.java
deleted file mode 100644
index cca4983..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/VirtualFileStructure.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.filerestrictions;
-
-//OODT imports
-import org.apache.oodt.cas.pushpull.protocol.RemoteSite;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>Describe your class here</p>.
- */
-public class VirtualFileStructure {
-
- private String pathToRoot;
-
- private VirtualFile root;
-
- private RemoteSite remoteSite;
-
- public VirtualFileStructure(String pathToRoot, VirtualFile root) {
- this.pathToRoot = pathToRoot;
- this.root = root;
- }
-
- public VirtualFileStructure(RemoteSite remoteSite, String pathToRoot,
- VirtualFile root) {
- this(pathToRoot, root);
- this.remoteSite = remoteSite;
- }
-
- public String getPathToRoot() {
- return this.pathToRoot;
- }
-
- public VirtualFile getRootVirtualFile() {
- return this.root;
- }
-
- public RemoteSite getRemoteSite() {
- return this.remoteSite;
- }
-
- public boolean isRootBased() {
- return this.pathToRoot.startsWith("/");
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/ClassNoaaEmailParser.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/ClassNoaaEmailParser.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/ClassNoaaEmailParser.java
deleted file mode 100644
index b3dd672..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/ClassNoaaEmailParser.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.filerestrictions.parsers;
-
-//OODT imports
-
-import org.apache.oodt.cas.metadata.Metadata;
-import org.apache.oodt.cas.pushpull.exceptions.ParserException;
-import org.apache.oodt.cas.pushpull.filerestrictions.Parser;
-import org.apache.oodt.cas.pushpull.filerestrictions.VirtualFile;
-import org.apache.oodt.cas.pushpull.filerestrictions.VirtualFileStructure;
-import org.apache.oodt.cas.pushpull.protocol.RemoteSite;
-
-import java.io.FileInputStream;
-import java.net.URL;
-import java.util.Scanner;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-//JDK imports
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>Describe your class here</p>.
- */
-public class ClassNoaaEmailParser implements Parser {
- private static Logger LOG = Logger.getLogger(ClassNoaaEmailParser.class.getName());
- public ClassNoaaEmailParser() {}
-
- public VirtualFileStructure parse(FileInputStream emailFile, Metadata metadata)
- throws ParserException {
- try {
- VirtualFile root = VirtualFile.createRootDir();
- Scanner s = new Scanner(emailFile);
- StringBuffer sb = new StringBuffer("");
- while (s.hasNextLine()) {
- sb.append(s.nextLine()).append("\n");
- }
-
- if (!validEmail(sb.toString())) {
- throw new ParserException(
- "Email not a IASI data processed notification email");
- }
-
- Pattern cdPattern = Pattern.compile("\\s*cd\\s{1,}.{1,}?(?:\\s|$)");
- Matcher cdMatcher = cdPattern.matcher(sb);
- Pattern getPattern = Pattern.compile("\\s*get\\s{1,}.{1,}?(?:\\s|$)");
- Matcher getMatcher = getPattern.matcher(sb);
-
- VirtualFile vf;
- while (cdMatcher.find() && getMatcher.find()) {
- String cdCommand = sb.substring(cdMatcher.start(), cdMatcher.end());
- String directory = cdCommand.trim().split(" ")[1];
-
- vf = new VirtualFile(root, directory, true);
- vf.setNoDirs(true);
-
- String getCommand = sb.substring(getMatcher.start(), getMatcher.end());
- String file = getCommand.trim().split(" ")[1];
-
- if (file.endsWith("*")) {
- vf.addChild(new VirtualFile(file.substring(0,
- file.length() - 1), false));
- vf.addChild(new VirtualFile(file.substring(0,
- file.length() - 1)
- + ".sig", false));
- } else {
- vf.addChild(new VirtualFile(file, false));
- }
- }
-
- Pattern ftpPattern = Pattern.compile("\\sftp\\..*?\\s");
- Matcher ftpMatcher = ftpPattern.matcher(sb);
- RemoteSite remoteSite = null;
- if (ftpMatcher.find()) {
- String ftpSite = sb.substring(ftpMatcher.start(), ftpMatcher.end()).trim();
- remoteSite = new RemoteSite(null, new URL("ftp://"
- + ftpSite), "anonymous", System
- .getenv("user.name")
- + "@jpl.nasa.gov");
- }
-
- return new VirtualFileStructure(remoteSite, "/", root);
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- throw new ParserException("Failed to parse IASI email : "
- + e.getMessage());
- }
- }
-
- private boolean validEmail(String email) {
- String[] containsStrings = (System.getProperties()
- .getProperty("org.apache.oodt.cas.pushpull.filerestrictions.parsers.class.noaa.email.parser.contains.exprs")
- + ",").split(",");
- for (String containsString : containsStrings) {
- if (!email.contains(containsString)) {
- return false;
- }
- }
- return true;
- }
-}
[35/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/static/js/jquery-1.7.2.min.js
----------------------------------------------------------------------
diff --git a/balance/modules/puny/static/js/jquery-1.7.2.min.js b/balance/modules/puny/static/js/jquery-1.7.2.min.js
deleted file mode 100644
index 93adea1..0000000
--- a/balance/modules/puny/static/js/jquery-1.7.2.min.js
+++ /dev/null
@@ -1,4 +0,0 @@
-/*! jQuery v1.7.2 jquery.com | jquery.org/license */
-(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cu(a){if(!cj[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ck||(ck=c.createElement("iframe"),ck.frameBorder=ck.width=ck.height=0),b.appendChild(ck);if(!cl||!ck.createElement)cl=(ck.contentWindow||ck.contentDocument).document,cl.write((f.support.boxModel?"<!doctype html>":"")+"<html><body>"),cl.close();d=cl.createElement(a),cl.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ck)}cj[a]=e}return cj[a]}function ct(a,b){var c={};f.each(cp.concat.apply([],cp.slice(0,b)),function(){c[this]=a});return c}function cs(){cq=b}function cr(){setTimeout(cs,0);return cq=f.now()}function ci(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ch(){try{return new a.XMLHttpRequest}catch(b){}}function cb(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;
g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function ca(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function b_(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bD.test(a)?d(a,e):b_(a+"["+(typeof e=="object"?b:"")+"]",e,c,d)});else if(!c&&f.type(b)==="object")for(var e in b)b_(a+"["+e+"]",b[e],c,d);e
lse d(a,b)}function b$(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function bZ(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bS,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=bZ(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=bZ(a,c,d,e,"*",g));return l}function bY(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bO),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bB(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?1:0,g=4;if(d>0){if(c!=="border")for(;e<g;e+=2)c||(d-=parseFloat(f.css(a,"padding"+bx[e]))||0),c==="margin"?d+=parseFloat(f.css(a,c+bx[e]))||0:d-=parseFloat(f.css(a,"border"+bx[e]+"Width"))||0;return d+"px"}d=by(a,b);if(d<0||d==null)d=a.style[b];if(bt.test(d))return d;d
=parseFloat(d)||0;if(c)for(;e<g;e+=2)d+=parseFloat(f.css(a,"padding"+bx[e]))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+bx[e]+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+bx[e]))||0);return d+"px"}function bo(a){var b=c.createElement("div");bh.appendChild(b),b.innerHTML=a.outerHTML;return b.firstChild}function bn(a){var b=(a.nodeName||"").toLowerCase();b==="input"?bm(a):b!=="script"&&typeof a.getElementsByTagName!="undefined"&&f.grep(a.getElementsByTagName("input"),bm)}function bm(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bl(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bk(a,b){var c;b.nodeType===1&&(b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase(),c==="object"?b.outerHTML=a.outerHTML:c!=="input"||a.type!=="checkbox"&&a.type!=="radio"?c==="option"?b.selected=a.defaul
tSelected:c==="input"||c==="textarea"?b.defaultValue=a.defaultValue:c==="script"&&b.text!==a.text&&(b.text=a.text):(a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value)),b.removeAttribute(f.expando),b.removeAttribute("_submit_attached"),b.removeAttribute("_change_attached"))}function bj(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c,d,e,g=f._data(a),h=f._data(b,g),i=g.events;if(i){delete h.handle,h.events={};for(c in i)for(d=0,e=i[c].length;d<e;d++)f.event.add(b,c,i[c][d])}h.data&&(h.data=f.extend({},h.data))}}function bi(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function U(a){var b=V.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function T(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typ
eof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(O.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?+d:j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c<d;c++)b[a[c]]=!0;return b}var c
=a.document,d=a.navigator,e=a.location,f=function(){function J(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(J,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;r
eturn this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.2",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==nu
ll?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),t
ypeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready
);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:functio
n(c){if(typeof c!="string"||!c)return null;var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:G?function(a){return a==null?"":G.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[
];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?E.call(c,a):e.merge(c,a)}return c},inArray:function(a,b,c){var d;if(b){if(H)return H.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=F.call(arguments,2),g=function(){return a.apply(c,f
.concat(F.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h,i){var j,k=d==null,l=0,m=a.length;if(d&&typeof d=="object"){for(l in d)e.access(a,c,l,d[l],1,h,f);g=1}else if(f!==b){j=i===b&&e.isFunction(f),k&&(j?(j=c,c=function(a,b,c){return j.call(e(a),c)}):(c.call(a,f),c=null));if(c)for(;l<m;l++)c(a[l],d,j?f.call(a[l],l,c(a[l],d)):f,i);g=1}return g?a:k?c.call(a):m?c(a[0],d):h},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date
RegExp Object".split(" "),function(a,b){I["[object "+b+"]"]=b.toLowerCase()}),z=e.uaMatch(y),z.browser&&(e.browser[z.browser]=!0,e.browser.version=z.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?B=function(){c.removeEventListener("DOMContentLoaded",B,!1),e.ready()}:c.attachEvent&&(B=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",B),e.ready())});return e}(),g={};f.Callbacks=function(a){a=a?g[a]||h(a):{};var c=[],d=[],e,i,j,k,l,m,n=function(b){var d,e,g,h,i;for(d=0,e=b.length;d<e;d++)g=b[d],h=f.type(g),h==="array"?n(g):h==="function"&&(!a.unique||!p.has(g))&&c.push(g)},o=function(b,f){f=f||[],e=!a.memory||[b,f],i=!0,j=!0,m=k||0,k=0,l=c.length;for(;c&&m<l;m++)if(c[m].apply(b,f)===!1&&a.stopOnFalse){e=!0;break}j=!1,c&&(a.once?e===!0?p.disable():c=[]:d&&d.length&&(e=d.shift(),p.fireWith(e[0],e[1])))},p={add:function(){if(c){var a=c.length;n(arguments),j?l=c.length:e&&e!==!0&&(k=a,o(e[0],e
[1]))}return this},remove:function(){if(c){var b=arguments,d=0,e=b.length;for(;d<e;d++)for(var f=0;f<c.length;f++)if(b[d]===c[f]){j&&f<=l&&(l--,f<=m&&m--),c.splice(f--,1);if(a.unique)break}}return this},has:function(a){if(c){var b=0,d=c.length;for(;b<d;b++)if(a===c[b])return!0}return!1},empty:function(){c=[];return this},disable:function(){c=d=e=b;return this},disabled:function(){return!c},lock:function(){d=b,(!e||e===!0)&&p.disable();return this},locked:function(){return!d},fireWith:function(b,c){d&&(j?a.once||d.push([b,c]):(!a.once||!e)&&o(b,c));return this},fire:function(){p.fireWith(this,arguments);return this},fired:function(){return!!i}};return p};var i=[].slice;f.extend({Deferred:function(a){var b=f.Callbacks("once memory"),c=f.Callbacks("once memory"),d=f.Callbacks("memory"),e="pending",g={resolve:b,reject:c,notify:d},h={done:b.add,fail:c.add,progress:d.add,state:function(){return e},isResolved:b.fired,isRejected:c.fired,then:function(a,b,c){i.done(a).fail(b).progress(c);ret
urn this},always:function(){i.done.apply(i,arguments).fail.apply(i,arguments);return this},pipe:function(a,b,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[b,"reject"],progress:[c,"notify"]},function(a,b){var c=b[0],e=b[1],g;f.isFunction(c)?i[a](function(){g=c.apply(this,arguments),g&&f.isFunction(g.promise)?g.promise().then(d.resolve,d.reject,d.notify):d[e+"With"](this===i?d:this,[g])}):i[a](d[e])})}).promise()},promise:function(a){if(a==null)a=h;else for(var b in h)a[b]=h[b];return a}},i=h.promise({}),j;for(j in g)i[j]=g[j].fire,i[j+"With"]=g[j].fireWith;i.done(function(){e="resolved"},c.disable,d.lock).fail(function(){e="rejected"},b.disable,d.lock),a&&a.call(i,i);return i},when:function(a){function m(a){return function(b){e[a]=arguments.length>1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.
isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c<d;c++)b[c]&&b[c].promise&&f.isFunction(b[c].promise)?b[c].promise().then(l(c),j.reject,m(c)):--g;g||j.resolveWith(j,b)}else j!==a&&j.resolveWith(j,d?[a]:[]);return k}}),f.support=function(){var b,d,e,g,h,i,j,k,l,m,n,o,p=c.createElement("div"),q=c.documentElement;p.setAttribute("className","t"),p.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=p.getElementsByTagName("*"),e=p.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=p.getElementsByTagName("input")[0],b={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.val
ue==="on",optSelected:h.selected,getSetAttribute:p.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,pixelMargin:!0},f.boxModel=b.boxModel=c.compatMode==="CSS1Compat",i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete p.test}catch(r){b.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",function(){b.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),i.setAttribute("name","t"),p.appendChild(i),j=c.createDocumentFragment(),j.appendChild(p.lastChild),b.checkClone=j.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked
=i.checked,j.removeChild(i),j.appendChild(p);if(p.attachEvent)for(n in{submit:1,change:1,focusin:1})m="on"+n,o=m in p,o||(p.setAttribute(m,"return;"),o=typeof p[m]=="function"),b[n+"Bubbles"]=o;j.removeChild(p),j=g=h=p=i=null,f(function(){var d,e,g,h,i,j,l,m,n,q,r,s,t,u=c.getElementsByTagName("body")[0];!u||(m=1,t="padding:0;margin:0;border:",r="position:absolute;top:0;left:0;width:1px;height:1px;",s=t+"0;visibility:hidden;",n="style='"+r+t+"5px solid #000;",q="<div "+n+"display:block;'><div style='"+t+"0;display:block;overflow:hidden;'></div></div>"+"<table "+n+"' cellpadding='0' cellspacing='0'>"+"<tr><td></td></tr></table>",d=c.createElement("div"),d.style.cssText=s+"width:0;height:0;position:static;top:0;margin-top:"+m+"px",u.insertBefore(d,u.firstChild),p=c.createElement("div"),d.appendChild(p),p.innerHTML="<table><tr><td style='"+t+"0;display:none'></td><td>t</td></tr></table>",k=p.getElementsByTagName("td"),o=k[0].offsetHeight===0,k[0].style.display="",k[1].style.display="non
e",b.reliableHiddenOffsets=o&&k[0].offsetHeight===0,a.getComputedStyle&&(p.innerHTML="",l=c.createElement("div"),l.style.width="0",l.style.marginRight="0",p.style.width="2px",p.appendChild(l),b.reliableMarginRight=(parseInt((a.getComputedStyle(l,null)||{marginRight:0}).marginRight,10)||0)===0),typeof p.style.zoom!="undefined"&&(p.innerHTML="",p.style.width=p.style.padding="1px",p.style.border=0,p.style.overflow="hidden",p.style.display="inline",p.style.zoom=1,b.inlineBlockNeedsLayout=p.offsetWidth===3,p.style.display="block",p.style.overflow="visible",p.innerHTML="<div style='width:5px;'></div>",b.shrinkWrapBlocks=p.offsetWidth!==3),p.style.cssText=r+s,p.innerHTML=q,e=p.firstChild,g=e.firstChild,i=e.nextSibling.firstChild.firstChild,j={doesNotAddBorder:g.offsetTop!==5,doesAddBorderForTableAndCells:i.offsetTop===5},g.style.position="fixed",g.style.top="20px",j.fixedPosition=g.offsetTop===20||g.offsetTop===15,g.style.position=g.style.top="",e.style.overflow="hidden",e.style.position="
relative",j.subtractsBorderForOverflowNotVisible=g.offsetTop===-5,j.doesNotIncludeMarginInBodyOffset=u.offsetTop!==m,a.getComputedStyle&&(p.style.marginTop="1%",b.pixelMargin=(a.getComputedStyle(p,null)||{marginTop:0}).marginTop!=="1%"),typeof d.style.zoom!="undefined"&&(d.style.zoom=1),u.removeChild(d),l=p=d=null,f.extend(b,j))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n
].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e<g;e++)delete d[b[e]];if(!(c?m:f.isEmptyObject)(d))return}}if(!c){delete j[k].data;if(!m(j[k]))return}f.support.deleteExpando||!j.setInterval?delete j[k]:j[k]=null,i&&(f.support.deleteExpando?delete a[h]:a.removeAttribute?a.removeAttribute(h):a[h]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d,e,g,h,i,j=this[0],k=0,m=null;if(a===b){if(this.length){m=f.data(j);if(j.nodeType===1&&!f._data(j
,"parsedAttrs")){g=j.attributes;for(i=g.length;k<i;k++)h=g[k].name,h.indexOf("data-")===0&&(h=f.camelCase(h.substring(5)),l(j,h,m[h]));f._data(j,"parsedAttrs",!0)}}return m}if(typeof a=="object")return this.each(function(){f.data(this,a)});d=a.split(".",2),d[1]=d[1]?"."+d[1]:"",e=d[1]+"!";return f.access(this,function(c){if(c===b){m=this.triggerHandler("getData"+e,[d[0]]),m===b&&j&&(m=f.data(j,a),m=l(j,a,m));return m===b&&d[1]?this.data(d[0]):m}d[1]=c,this.each(function(){var b=f(this);b.triggerHandler("setData"+e,d),f.data(this,a,c),b.triggerHandler("changeData"+e,d)})},null,c,arguments.length>1,null,!1)},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",f._data(a,b,(f._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,"mark"))}},queue:function(a,b,c){var d;if(a){b=(b||"fx")+"queue",d=f.
_data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),f._data(a,b+".run",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+"queue "+b+".run",!0),n(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){var d=2;typeof a!="string"&&(c=a,a="fx",d--);if(arguments.length<d)return f.queue(this[0],a);return c===b?this:this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=thi
s,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f.Callbacks("once memory"),!0))h++,l.add(m);m();return d.promise(c)}});var o=/[\n\t\r]/g,p=/\s+/,q=/\r/g,r=/^(?:button|input)$/i,s=/^(?:button|input|object|select|textarea)$/i,t=/^a(?:rea)?$/i,u=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,v=f.support.getSetAttribute,w,x,y;f.fn.extend({attr:function(a,b){return f.access(this,f.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,f.prop,a,b,arguments.length>1)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof
a=="string"){b=a.split(p);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(p);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(o," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(p);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClas
s"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(o," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.type]||f.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.type]||f.valHooks[g.nodeName.toLowerCase()];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.
attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c<d;c++){e=i[c];if(e.selected&&(f.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!f.nodeName(e.parentNode,"optgroup"))){b=f(e).val();if(j)return b;h.push(b)}}if(j&&!h.length&&i.length)return f(i[g]).val();return h},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);re
turn}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h,i=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;i<g;i++)e=d[i],e&&(c=f.propFix[e]||e,h=u.test(e),h||f.attr(a,e,""),a.removeAttribute(v?e:c),h&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(r.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(w&&f.nodeName(a,"button"))return w.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(w&&f.nodeName(a,"button"))return w.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspa
n:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e,g,h,i=a.nodeType;if(!!a&&i!==3&&i!==8&&i!==2){h=i!==1||!f.isXMLDoc(a),h&&(c=f.propFix[c]||c,g=f.propHooks[c]);return d!==b?g&&"set"in g&&(e=g.set(a,d,c))!==b?e:a[c]=d:g&&"get"in g&&(e=g.get(a,c))!==null?e:a[c]}},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):s.test(a.nodeName)||t.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabindex=f.propHooks.tabIndex,x={get:function(a,c){var d,e=f.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},v||(y={name:!0,id:!0,coords:!0},w=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&(y[c]?d.nodeValue!=="":d.specified)?d.nodeValue:b},
set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+""}},f.attrHooks.tabindex.set=w.set,f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})}),f.attrHooks.contenteditable={get:w.get,set:function(a,b,c){b===""&&(b="false"),w.set(a,b,c)}}),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.enctype||(f.propFix.enctype="encoding"),f.support.checkOn||f.each(["ra
dio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/(?:^|\s)hover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(
-a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")};f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler,g=p.selector),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k<c.length;k++){l=A.exec(c[k])||[],m=l[1],n=(l[2]||"").split(".").sort(),s=f.event.special[m]||{},m=(g?s.delegateType:s.bindType)||m,s=f.event.special[m]||{},o=f.extend({type:m,origType:l[1],data:e,handler:d,guid:d.gui
d,selector:g,quick:g&&G(g),namespace:n.join(".")},p),r=j[m];if(!r){r=j[m]=[],r.delegateCount=0;if(!s.setup||s.setup.call(a,e,n,i)===!1)a.addEventListener?a.addEventListener(m,i,!1):a.attachEvent&&a.attachEvent("on"+m,i)}s.add&&(s.add.call(a,o),o.handler.guid||(o.handler.guid=d.guid)),g?r.splice(r.delegateCount++,0,o):r.push(o),f.event.global[m]=!0}a=null}},global:{},remove:function(a,b,c,d,e){var g=f.hasData(a)&&f._data(a),h,i,j,k,l,m,n,o,p,q,r,s;if(!!g&&!!(o=g.events)){b=f.trim(I(b||"")).split(" ");for(h=0;h<b.length;h++){i=A.exec(b[h])||[],j=k=i[1],l=i[2];if(!j){for(j in o)f.event.remove(a,j+b[h],c,d,!0);continue}p=f.event.special[j]||{},j=(d?p.delegateType:p.bindType)||j,r=o[j]||[],m=r.length,l=l?new RegExp("(^|\\.)"+l.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;for(n=0;n<r.length;n++)s=r[n],(e||k===s.origType)&&(!c||c.guid===s.guid)&&(!l||l.test(s.namespace))&&(!d||d===s.selector||d==="**"&&s.selector)&&(r.splice(n--,1),s.selector&&r.delegateCount--,p.remove&&p.remov
e.call(a,s));r.length===0&&m!==r.length&&((!p.teardown||p.teardown.call(a,l)===!1)&&f.removeEvent(a,j,g.handle),delete o[j])}f.isEmptyObject(o)&&(q=g.handle,q&&(q.elem=null),f.removeData(a,["events","handle"],!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){if(!e||e.nodeType!==3&&e.nodeType!==8){var h=c.type||c,i=[],j,k,l,m,n,o,p,q,r,s;if(E.test(h+f.event.triggered))return;h.indexOf("!")>=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=
f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;l<r.length&&!c.isPropagationStopped();l++)m=r[l][0],c.type=r[l][1],q=(f._data(m,"events")||{})[c.type]&&f._data(m,"handle"),q&&q.apply(m,d),q=o&&m[o],q&&f.acceptData(m)&&q.apply(m,d)===!1&&c.preventDefault();c.type=h,!g&&!c.isDefaultPrevented()&&(!p._default||p._default.apply(e.ownerDocument,d)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)&&o&&e[h]&&(h!=="focus"&&h!=="blur"||c.target.offsetWidth!==0)&&!f.isWindow(e)&&(n=e[o],n&&(e[o]=null),f.event.triggered=h,e[h](),f.event.triggered=b,n&&(e[o]=n));return c.result}},dispatch:function(c){c=f.event.fix(c||a.event);var d=(f._data(this,"events")||{})[c.type]||[],e=d.delegateCount,g=[].slice.call(arguments,0),h=!c.exclusive&&!c.na
mespace,i=f.event.special[c.type]||{},j=[],k,l,m,n,o,p,q,r,s,t,u;g[0]=c,c.delegateTarget=this;if(!i.preDispatch||i.preDispatch.call(this,c)!==!1){if(e&&(!c.button||c.type!=="click")){n=f(this),n.context=this.ownerDocument||this;for(m=c.target;m!=this;m=m.parentNode||this)if(m.disabled!==!0){p={},r=[],n[0]=m;for(k=0;k<e;k++)s=d[k],t=s.selector,p[t]===b&&(p[t]=s.quick?H(m,s.quick):n.is(t)),p[t]&&r.push(s);r.length&&j.push({elem:m,matches:r})}}d.length>e&&j.push({elem:this,matches:d.slice(e)});for(k=0;k<j.length&&!c.isPropagationStopped();k++){q=j[k],c.currentTarget=q.elem;for(l=0;l<q.matches.length&&!c.isImmediatePropagationStopped();l++){s=q.matches[l];if(h||!c.namespace&&!s.namespace||c.namespace_re&&c.namespace_re.test(s.namespace))c.data=s.data,c.handleObj=s,o=((f.event.special[s.origType]||{}).handle||s.handler).apply(q.elem,g),o!==b&&(c.result=o,o===!1&&(c.preventDefault(),c.stopPropagation()))}}i.postDispatch&&i.postDispatch.call(this,c);return c.result}},props:"attrChange attr
Name relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode);return a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,d){var e,f,g,h=d.button,i=d.fromElement;a.pageX==null&&d.clientX!=null&&(e=a.target.ownerDocument||c,f=e.documentElement,g=e.body,a.pageX=d.clientX+(f&&f.scrollLeft||g&&g.scrollLeft||0)-(f&&f.clientLeft||g&&g.clientLeft||0),a.pageY=d.clientY+(f&&f.scrollTop||g&&g.scrollTop||0)-(f&&f.clientTop||g&&g.clientTop||0)),!a.relatedTarget&&i&&(a.relatedTarget=i===a.target?d.toElement:i),!a.which&&h!==b&&(a.which=h&1?1:h&2?3:h&4?2:0);return a}},fix:function(a){if(a[f.expando])return a;var d,e,g=a,h=f.event.fixHooks[a.type]||{},i=h.prop
s?this.props.concat(h.props):this.props;a=f.Event(g);for(d=i.length;d;)e=i[--d],a[e]=g[e];a.target||(a.target=g.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey===b&&(a.metaKey=a.ctrlKey);return h.filter?h.filter(a,g):a},special:{ready:{setup:f.bindReady},load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=f.extend(new f.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?f.event.trigger(e,null,b):f.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},f.event.handle=f.event.dispatch,f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!(this instanceof f.Event))return new f.Event(a,b);a&&a.
type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?K:J):this.type=a,b&&f.extend(this,b),this.timeStamp=a&&a.timeStamp||f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=K;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=K;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=K,this.stopPropagation()},isDefaultPrevented:J,isPropagationStopped:J,isImmediatePropagationStopped:J},f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c=this,d=a.relatedTarget,e=a.handleObj,g=e.selector,h;if(!d||d!==c&&!f.contains(c,d))a.type=e.origType,h=e.handler.apply(this,arguments),a.
type=b;return h}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(){if(f.nodeName(this,"form"))return!1;f.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=f.nodeName(c,"input")||f.nodeName(c,"button")?c.form:b;d&&!d._submit_attached&&(f.event.add(d,"submit._submit",function(a){a._submit_bubble=!0}),d._submit_attached=!0)})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&f.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){if(f.nodeName(this,"form"))return!1;f.event.remove(this,"._submit")}}),f.support.changeBubbles||(f.event.special.change={setup:function(){if(z.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")f.event.add(this,"propertychange._change",function(a){a.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),f.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1,f.event.simulate("ch
ange",this,a,!0))});return!1}f.event.add(this,"beforeactivate._change",function(a){var b=a.target;z.test(b.nodeName)&&!b._change_attached&&(f.event.add(b,"change._change",function(a){this.parentNode&&!a.isSimulated&&!a.isTrigger&&f.event.simulate("change",this.parentNode,a,!0)}),b._change_attached=!0)})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||b.type!=="radio"&&b.type!=="checkbox")return a.handleObj.handler.apply(this,arguments)},teardown:function(){f.event.remove(this,"._change");return z.test(this.nodeName)}}),f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){var d=0,e=function(a){f.event.simulate(b,a.target,f.event.fix(a),!0)};f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.fn.extend({on:function(a,c,d,e,g){var h,i;if(typeof a=="object"){typeof c!="string"&&(d=d||c,c=b);for(i in a)this.on(i,c,d,a[i],g);return this}d==null&&e=
=null?(e=c,d=c=b):e==null&&(typeof c=="string"?(e=d,d=b):(e=d,d=c,c=b));if(e===!1)e=J;else if(!e)return this;g===1&&(h=e,e=function(a){f().off(a);return h.apply(this,arguments)},e.guid=h.guid||(h.guid=f.guid++));return this.each(function(){f.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,c,d){if(a&&a.preventDefault&&a.handleObj){var e=a.handleObj;f(a.delegateTarget).off(e.namespace?e.origType+"."+e.namespace:e.origType,e.selector,e.handler);return this}if(typeof a=="object"){for(var g in a)this.off(g,c,a[g]);return this}if(c===!1||typeof c=="function")d=c,c=b;d===!1&&(d=J);return this.each(function(){f.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){f(this.context).on(a,this.selector,b,c);return this},die:function(a,b){f(this.context).off(a,this.selector||"**",b);return this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:funct
ion(a,b,c){return arguments.length==1?this.off(a,"**"):this.off(b,a,c)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f._data(this,"lastToggle"+a.guid)||0)%d;f._data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.tes
t(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}if(j.nodeType===1){g||(j[d]=c,j.sizset=h);if(typeof b!="string"){if(j===b){k=!0;break}}else if(m.filter(b,[j]).length>0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}j.nodeType===1&&!g&&(j[d]=c,j.sizset=h);if(j.nodeName.toLowerCase()===b){k=j;break}j=j[a]}e[h]=k}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,
l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[
t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},m.matches=function(a,b){return m(a,null,null,b)},m.matchesSelector=function(a,b){return m(b,null,null,[a]).length>0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e<f;e++){h=o.order[e];if(g=o.leftMatch[h].exec(a)){i=g[1],g.splice(1,1);if(i.substr(i.length-1)!=="\\"){g[1]=(g[1]||"").replace(j,""),d=o.find[h](g,b,c);if(d!=null){a=a.replace(o.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},m.filter=function(a,c,d,e){var f,g,h,i,j,k,l,n,p,q=a,r=[],s=c,t=c&&c[0]&&m.isXML(c[0]);while(a&&c.length){for(h in o.filter)if((f=o.leftMatch[h].exec(a))!=null&&f[2]){k=o.filter[h],l=f[1],g=!1,f.splice(1,1);if(l.substr(l.length-1)==="\\")continue;s===r&&(r=[]);if(o.preFilter[h]){f=o.preFi
lter[h](f,s,d,r,e,t);if(!f)g=i=!0;else if(f===!0)continue}if(f)for(n=0;(j=s[n])!=null;n++)j&&(i=k(j,f,n,s),p=e^i,d&&i!=null?p?g=!0:s[n]=!1:p&&(r.push(j),g=!0));if(i!==b){d||(s=r),a=a.replace(o.match[h],"");if(!g)return[];break}}if(a===q)if(g==null)m.error(a);else break;q=a}return s},m.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)};var n=m.getText=function(a){var b,c,d=a.nodeType,e="";if(d){if(d===1||d===9||d===11){if(typeof a.textContent=="string")return a.textContent;if(typeof a.innerText=="string")return a.innerText.replace(k,"");for(a=a.firstChild;a;a=a.nextSibling)e+=n(a)}else if(d===3||d===4)return a.nodeValue}else for(b=0;c=a[b];b++)c.nodeType!==8&&(e+=n(c));return e},o=m.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]
|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!l.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&m.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode=
==b);d&&m.filter(b,a,!0)}},"":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("parentNode",b,f,a,d,c)},"~":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("previousSibling",b,f,a,d,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(j,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG
:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.
parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a)
{var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}m.error(e)},CHILD:function(a,b){var c,e,f,g,h,i,j,k=b[1],l=a;switch(k){case"only":case"first":while(l=l.previousSibling)if(l.nodeType===1)return!1;if(k==="first")return!0;l=a;case"last":while(l=l.nextSibling)if(l.nod
eType===1)return!1;return!0;case"nth":c=b[2],e=b[3];if(c===1&&e===0)return!0;f=b[0],g=a.parentNode;if(g&&(g[d]!==f||!a.nodeIndex)){i=0;for(l=g.firstChild;l;l=l.nextSibling)l.nodeType===1&&(l.nodeIndex=++i);g[d]=f}j=a.nodeIndex-e;return c===0?j===0:j%c===0&&j/c>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p
=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));o.match.globalPOS=p;var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c<e;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var u,v;c.documentElement.compareDocumentPosition?u=function(a,b){if(a===b){h=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(u=function(a,b){if(a===b){h=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,
e=[],f=[],g=a.parentNode,i=b.parentNode,j=g;if(g===i)return v(a,b);if(!g)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return v(e[k],f[k]);return k===c?v(a,f[k],-1):v(e[k],b,1)},v=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElemen
t("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]
);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}
}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h<i;h++)m(a,g[h],e,c);return m.filter(f,e)};m.attr=f.attr,m.select
ors.attrMap={},f.find=m,f.expr=m.selectors,f.expr[":"]=f.expr.filters,f.unique=m.uniqueSort,f.text=m.getText,f.isXMLDoc=m.isXML,f.contains=m.contains}();var L=/Until$/,M=/^(?:parents|prevUntil|prevAll)/,N=/,/,O=/^.[^:#\[\.,]*$/,P=Array.prototype.slice,Q=f.expr.match.globalPOS,R={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(T(this,a,!1),"not",a)},filter:function(a){return this.pushStack(T(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?Q.test(a)?f(a,this.c
ontext).index(this[0])>=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d<a.length;d++)f(g).is(a[d])&&c.push({selector:a[d],elem:g,level:h});g=g.parentNode,h++}return c}var i=Q.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(i?i.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({p
arent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P
.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/<tbody/i,_=/<|&#?\w+;/,ba=/<(?:script|style)/i,bb=/<(?:script|object|embed|option|style)/i,bc=new RegExp("<(?:"+V+")[\\s/>]","i"),bd=/checked\s*(?:[^=]|=\s*.checked.)/i,be=/\/(java|ecma)script/i,bf=/^
\s*<!(?:\[CDATA\[|\-\-)/,bg={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){return f.access(this,function(a){return a===b?f.text(this):this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChi
ld;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f
-.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){return f.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(W,""):null;
if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1></$2>");try{for(;d<e;d++)c=this[d]||{},c.nodeType===1&&(f.cleanData(c.getElementsByTagName("*")),c.innerHTML=a);c=0}catch(g){}}c&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bd.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(functi
on(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bi(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,function(a,b){b.src?f.ajax({type:"GET",global:!1,url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bf,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)})}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i,j=a[0];b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof j=="string"&&j.length<512&&i===c&&j.charAt(0)==="<"&&!bb.test(j)&&(f.support.checkClone||!bd.test(j))&&(f.support.html5Clone||!bc.test(j))&&(g=!0,h=f.fragments[j],h&&h!==1&&(e=h))
,e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[j]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||f.isXMLDoc(a)||!bc.test("<"+a.nodeName+">")?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g,h,i,j=[];b=b||c,typeof b.
createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);for(var k=0,l;(l=a[k])!=null;k++){typeof l=="number"&&(l+="");if(!l)continue;if(typeof l=="string")if(!_.test(l))l=b.createTextNode(l);else{l=l.replace(Y,"<$1></$2>");var m=(Z.exec(l)||["",""])[1].toLowerCase(),n=bg[m]||bg._default,o=n[0],p=b.createElement("div"),q=bh.childNodes,r;b===c?bh.appendChild(p):U(b).appendChild(p),p.innerHTML=n[1]+l+n[2];while(o--)p=p.lastChild;if(!f.support.tbody){var s=$.test(l),t=m==="table"&&!s?p.firstChild&&p.firstChild.childNodes:n[1]==="<table>"&&!s?p.childNodes:[];for(i=t.length-1;i>=0;--i)f.nodeName(t[i],"tbody")&&!t[i].childNodes.length&&t[i].parentNode.removeChild(t[i])}!f.support.leadingWhitespace&&X.test(l)&&p.insertBefore(b.createTextNode(X.exec(l)[0]),p.firstChild),l=p.childNodes,p&&(p.parentNode.removeChild(p),q.length>0&&(r=q[q.length-1],r&&r.parentNode&&r.parentNode.removeChild(r)))}var u;if(!f.support.appendChecked)if(l[0]&&typeof (u=l.length)=="number")for(i=0;
i<u;i++)bn(l[i]);else bn(l);l.nodeType?j.push(l):j=f.merge(j,l)}if(d){g=function(a){return!a.type||be.test(a.type)};for(k=0;j[k];k++){h=j[k];if(e&&f.nodeName(h,"script")&&(!h.type||be.test(h.type)))e.push(h.parentNode?h.parentNode.removeChild(h):h);else{if(h.nodeType===1){var v=f.grep(h.getElementsByTagName("script"),g);j.splice.apply(j,[k+1,0].concat(v))}d.appendChild(h)}}}return j},cleanData:function(a){var b,c,d=f.cache,e=f.event.special,g=f.support.deleteExpando;for(var h=0,i;(i=a[h])!=null;h++){if(i.nodeName&&f.noData[i.nodeName.toLowerCase()])continue;c=i[f.expando];if(c){b=d[c];if(b&&b.events){for(var j in b.events)e[j]?f.event.remove(i,j):f.removeEvent(i,j,b.handle);b.handle&&(b.handle.elem=null)}g?delete i[f.expando]:i.removeAttribute&&i.removeAttribute(f.expando),delete d[c]}}}});var bp=/alpha\([^)]*\)/i,bq=/opacity=([^)]*)/,br=/([A-Z]|^ms)/g,bs=/^[\-+]?(?:\d*\.)?\d+$/i,bt=/^-?(?:\d*\.)?\d+(?!px)[^\d\s]+$/i,bu=/^([\-+])=([\-+.\de]+)/,bv=/^margin/,bw={position:"absolute",vi
sibility:"hidden",display:"block"},bx=["Top","Right","Bottom","Left"],by,bz,bA;f.fn.css=function(a,c){return f.access(this,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)},a,c,arguments.length>1)},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=by(a,"opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=bu.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f
.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(by)return by(a,c)},swap:function(a,b,c){var d={},e,f;for(f in b)d[f]=a.style[f],a.style[f]=b[f];e=c.call(a);for(f in b)a.style[f]=d[f];return e}}),f.curCSS=f.css,c.defaultView&&c.defaultView.getComputedStyle&&(bz=function(a,b){var c,d,e,g,h=a.style;b=b.replace(br,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b))),!f.support.pixelMargin&&e&&bv.test(b)&&bt.test(c)&&(g=h.width,h.width=c,c=e.width,h.width=g);return c}),c.documentElement.currentStyle&&(bA=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f==null&&g&&(e=g[b])&&(f=e),bt.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f
===""?"auto":f}),by=bz||bA,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth!==0?bB(a,b,d):f.swap(a,bw,function(){return bB(a,b,d)})},set:function(a,b){return bs.test(b)?b+"px":b}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bq.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bp,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bp.test(g)?g.replace(bp,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){return f.swap(a,{display:"inline-block"},function(){return b?by(a,"margin-right"):a.style.marginRight})}})}),f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.su
pport.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)}),f.each({margin:"",padding:"",border:"Width"},function(a,b){f.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bx[d]+b]=e[d]||e[d-2]||e[0];return f}}});var bC=/%20/g,bD=/\[\]$/,bE=/\r?\n/g,bF=/#.*$/,bG=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bH=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bI=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bJ=/^(?:GET|HEAD)$/,bK=/^\/\//,bL=/\?/,bM=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bN=/^(?:select|textarea)/i,bO=/\s+/,bP=/([?&])_=[^&]*/,bQ=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bR=f.fn.load,bS={},bT={},bU,bV,bW=["*/"]+["*"];try{bU=e.href}catch(bX){bU=c.createElement("a"),bU.href="",bU=bU.href}bV=bQ.exec(bU.toLowerCase())||[],f.fn.extend({load:f
unction(a,c,d){if(typeof a!="string"&&bR)return bR.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bM,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bN.test(this.nodeName)||bH.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bE,"\r\n")}}):{name:b.name,value:c.replace(bE,"\r\n")}}).get()}}),f.e
ach("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b$(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b$(a,b);return a},ajaxSettings:{url:bU,isLocal:bI.test(bV[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bW},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},
ajaxPrefilter:bY(bS),ajaxTransport:bY(bT),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?ca(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cb(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if
(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bG.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bF,"").replace(bK,bV[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bO),d.crossDomain==null&&(r=bQ.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bV[1]&&r[2]==bV[2]&&(r[3]||(r[1]==="http:"?80:443))==(bV[3]||(bV[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bZ(bS,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.
toUpperCase(),d.hasContent=!bJ.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bL.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bP,"$1_="+x);d.url=y+(y===d.url?(bL.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bW+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bZ(bT,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d
.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)b_(g,a[g],c,e);return d.join("&").replace(bC,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cc=f.now(),cd=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cc++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=typeof b.data=="string"&&/^application\/x\-www\-form\-urlencoded/.test(b.contentType);if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(cd.test(b.url)||e&&cd.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.json
p!==!1&&(j=j.replace(cd,l),b.url===j&&(e&&(k=k.replace(cd,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||
/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var ce=a.ActiveXObject?function(){for(var a in cg)cg[a](0,1)}:!1,cf=0,cg;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ch()||ci()}:ch,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{i
f(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,ce&&delete cg[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n);try{m.text=h.responseText}catch(a){}try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cf,ce&&(cg||(cg={},f(a).unload(ce)),cg[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cj={},ck,cl,cm=/^(?:toggle|show|hide)$/,cn=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,co,cp=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cq;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(ct("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),(e===""&&f.
css(d,"display")==="none"||!f.contains(d.ownerDocument.documentElement,d))&&f._data(d,"olddisplay",cu(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(ct("hide",3),a,b,c);var d,e,g=0,h=this.length;for(;g<h;g++)d=this[g],d.style&&(e=f.css(d,"display"),e!=="none"&&!f._data(d,"olddisplay")&&f._data(d,"olddisplay",e));for(g=0;g<h;g++)this[g].style&&(this[g].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(ct("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){function g(){e.queue===!1&&f._mark
(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o,p,q;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]);if((k=f.cssHooks[g])&&"expand"in k){l=k.expand(a[g]),delete a[g];for(i in l)i in a||(a[i]=l[i])}}for(g in a){h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(!f.support.inlineBlockNeedsLayout||cu(this.nodeName)==="inline"?this.style.display="inline-block":this.style.zoom=1))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)j=new f.fx(this,b,i),h=a[i],cm.test(h)?(q=f._data(this,"toggle"+i)||(h==="toggle"?d?"show":"hide":0),q?(f._data(this,"toggle"+i,q==="show"?"hide":"show"
),j[q]()):j[h]()):(m=cn.exec(h),n=j.cur(),m?(o=parseFloat(m[2]),p=m[3]||(f.cssNumber[i]?"":"px"),p!=="px"&&(f.style(this,i,(o||1)+p),n=(o||1)/j.cur()*n,f.style(this,i,n+p)),m[1]&&(o=(m[1]==="-="?-1:1)*o+n),j.custom(n,o,p)):j.custom(n,h,""));return!0}var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return e.queue===!1?this.each(g):this.queue(e.queue,g)},stop:function(a,c,d){typeof a!="string"&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]);return this.each(function(){function h(a,b,c){var e=b[c];f.removeData(a,c,!0),e.stop(d)}var b,c=!1,e=f.timers,g=f._data(this);d||f._unmark(!0,this);if(a==null)for(b in g)g[b]&&g[b].stop&&b.indexOf(".run")===b.length-4&&h(this,g,b);else g[b=a+".run"]&&g[b].stop&&h(this,g,b);for(b=e.length;b--;)e[b].elem===this&&(a==null||e[b].queue===a)&&(d?e[b](!0):e[b].saveState(),c=!0,e.splice(b,1));(!d||!c)&&f.dequeue(this,a)})}}),f.each({slideDown:ct("show",1),slideUp:ct("hide",1),slideToggle:ct("toggle",1),fadeIn:{
opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default;if(d.queue==null||d.queue===!0)d.queue="fx";d.old=d.complete,d.complete=function(a){f.isFunction(d.old)&&d.old.call(this),d.queue?f.dequeue(this,d.queue):a!==!1&&f._unmark(this)};return d},easing:{linear:function(a){return a},swing:function(a){return-Math.cos(a*Math.PI)/2+.5}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=nul
l&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,c,d){function h(a){return e.step(a)}var e=this,g=f.fx;this.startTime=cq||cr(),this.end=c,this.now=this.start=a,this.pos=this.state=0,this.unit=d||this.unit||(f.cssNumber[this.prop]?"":"px"),h.queue=this.options.queue,h.elem=this.elem,h.saveState=function(){f._data(e.elem,"fxshow"+e.prop)===b&&(e.options.hide?f._data(e.elem,"fxshow"+e.prop,e.start):e.options.show&&f._data(e.elem,"fxshow"+e.prop,e.end))},h()&&f.timers.push(h)&&!co&&(co=setInterval(g.tick,g.interval))},show:function(){var a=f._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=a||f.style(this.elem,this.prop),this.options.show=!0,a!==b?this.custom(this.cur(),a):this.custom(this.prop==="width"||this.prop==="height
<TRUNCATED>
[27/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceLocal.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceLocal.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceLocal.java
deleted file mode 100644
index 92f6455..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceLocal.java
+++ /dev/null
@@ -1,1336 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.system.impl;
-
-import org.apache.oodt.cas.catalog.exception.CatalogException;
-import org.apache.oodt.cas.catalog.exception.CatalogServiceException;
-import org.apache.oodt.cas.catalog.mapping.IngestMapper;
-import org.apache.oodt.cas.catalog.metadata.TransactionalMetadata;
-import org.apache.oodt.cas.catalog.page.*;
-import org.apache.oodt.cas.catalog.query.QueryExpression;
-import org.apache.oodt.cas.catalog.query.QueryLogicalGroup;
-import org.apache.oodt.cas.catalog.query.WrapperQueryExpression;
-import org.apache.oodt.cas.catalog.repository.CatalogRepository;
-import org.apache.oodt.cas.catalog.struct.Dictionary;
-import org.apache.oodt.cas.catalog.struct.Index;
-import org.apache.oodt.cas.catalog.struct.TransactionId;
-import org.apache.oodt.cas.catalog.struct.TransactionIdFactory;
-import org.apache.oodt.cas.catalog.system.Catalog;
-import org.apache.oodt.cas.catalog.system.CatalogService;
-import org.apache.oodt.cas.catalog.util.PluginURL;
-import org.apache.oodt.cas.catalog.util.QueryUtils;
-import org.apache.oodt.cas.metadata.Metadata;
-
-//JDK imports
-import java.io.File;
-import java.net.URL;
-import java.util.*;
-import java.util.Map.Entry;
-import java.util.concurrent.locks.ReadWriteLock;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A Calatog Service that manages Metadata via one or more underlying Catalogs
- * <p>
- */
-public class CatalogServiceLocal implements CatalogService {
-
- private static Logger LOG = Logger.getLogger(CatalogServiceLocal.class.getName());
-
- protected Set<Catalog> catalogs;
- protected ReadWriteLock catalogsLock;
- protected CatalogRepository catalogRepository;
- protected IngestMapper ingestMapper;
- protected ReadWriteLock ingestMapperLock;
- protected boolean restrictQueryPermissions;
- protected boolean restrictIngestPermissions;
- protected TransactionIdFactory transactionIdFactory;
- protected File pluginStorageDir;
- protected boolean oneCatalogFailsAllFail;
- protected boolean simplifyQueries;
- protected boolean disableIntersectingCrossCatalogQueries;
- protected int crossCatalogResultSortingThreshold;
-
- public CatalogServiceLocal(CatalogRepository catalogRepository, IngestMapper ingestMapper, File pluginStorageDir, TransactionIdFactory transactionIdFactory, boolean restrictQueryPermissions, boolean restrictIngestPermissions, boolean oneCatalogFailsAllFail, boolean simplifyQueries, boolean disableIntersectingCrossCatalogQueries, int crossCatalogResultSortingThreshold) throws InstantiationException {
- try {
- this.catalogs = new HashSet<Catalog>();
- this.catalogsLock = new ReentrantReadWriteLock();
- this.ingestMapperLock = new ReentrantReadWriteLock();
- this.setPluginStorageDir(pluginStorageDir);
- this.setRestrictQueryPermissions(restrictQueryPermissions);
- this.setRestrictIngestPermissions(restrictIngestPermissions);
- this.setTransactionIdFactory(transactionIdFactory);
- this.setIngestMapper(ingestMapper);
- this.setCatalogRepository(catalogRepository);
- this.oneCatalogFailsAllFail = oneCatalogFailsAllFail;
- this.simplifyQueries = simplifyQueries;
- this.disableIntersectingCrossCatalogQueries = disableIntersectingCrossCatalogQueries;
- this.crossCatalogResultSortingThreshold = crossCatalogResultSortingThreshold;
- }catch (Exception e) {
- LOG.log(Level.SEVERE,e.getMessage());
- throw new InstantiationException(e.getMessage());
- }
- }
-
- /**
- * Set the CatalogRepository for this CatalogService, with replace existing CatalogRepository
- * and immediately load all Catalogs from it.
- * @throws CatalogServiceException On Error loading given CatalogRepository
- */
- protected void setCatalogRepository(CatalogRepository catalogRepository) throws CatalogServiceException {
- if (catalogRepository != null) {
- this.catalogsLock.writeLock().lock();
- CatalogRepository backupRepository = null;
- Set<Catalog> backupCatalogs = null;
- try {
- LOG.log(Level.INFO, "Using CatalogRepository '" + catalogRepository.getClass().getName() + "'");
- backupRepository = this.catalogRepository;
- backupCatalogs = new HashSet<Catalog>(this.catalogs);
- LOG.log(Level.INFO, "Loading Catalogs from CatalogRepository . . .");
- this.catalogs = catalogRepository.deserializeAllCatalogs();
- LOG.log(Level.INFO, "Loaded Catalogs: '" + this.catalogs + "'");
- this.catalogRepository = catalogRepository;
- }catch (Exception e) {
- this.catalogs = backupCatalogs;
- this.catalogRepository = backupRepository;
- throw new CatalogServiceException("Failed to set CatalogRepository '" + catalogRepository + "', reverting back to original settings : " + e.getMessage(), e);
- }finally {
- this.catalogsLock.writeLock().unlock();
- }
- }else {
- throw new CatalogServiceException("Cannot add NULL CatalogRepository to CatalogService, reverting back to original settings");
- }
- }
-
- protected void setIngestMapper(IngestMapper ingestMapper) {
- this.ingestMapperLock.writeLock().lock();
- try {
- LOG.log(Level.INFO, "Using IngestMapper '" + ingestMapper.getClass().getName() + "'");
- this.ingestMapper = ingestMapper;
- }catch (Exception e) {
- LOG.log(Level.SEVERE, "Failed to set ingest mapper : " + e.getMessage(), e);
- }finally {
- this.ingestMapperLock.writeLock().unlock();
- }
- }
-
- public void shutdown() throws CatalogServiceException {
- this.catalogsLock.writeLock().lock();
- this.ingestMapperLock.writeLock().lock();
- }
-
- /**
- * Returns true if this CatalogService is restricting any queries
- * from being made to the Catalogs it is managing
- * @return True is restricting queries, false if restriction is
- * on a per Catalog bases.
- */
- public boolean isRestrictQueryPermissions() {
- return this.restrictIngestPermissions;
- }
-
- /**
- * Modify this CatalogServices query restriction, default is false.
- * @param restrictQueryPermissions True to block all querys to managing
- * Catalogs or false to leave it at a per Catalog bases.
- */
- protected void setRestrictQueryPermissions(boolean restrictQueryPermissions) {
- this.restrictQueryPermissions = restrictQueryPermissions;
- }
-
- /**
- * Returns true if this CatalogService is restricting any ingestions
- * from being made to the Catalogs it is managing
- * @return True is restricting ingestions, false if restriction is
- * on a per Catalog bases.
- */
- public boolean isRestrictIngestPermissions() {
- return this.restrictIngestPermissions;
- }
-
- /**
- * Modify this CatalogServices ingest restriction, default is false.
- * @param restrictIngestPermissions True to block all ingestions to managing
- * Catalogs or false to leave it at a per Catalog bases.
- */
- protected void setRestrictIngestPermissions(boolean restrictIngestPermissions) {
- this.restrictIngestPermissions = restrictIngestPermissions;
- }
-
- /**
- *
- */
- protected void setTransactionIdFactory(
- TransactionIdFactory transactionIdFactory) {
- this.transactionIdFactory = transactionIdFactory;
- }
-
- public void addCatalog(String catalogId, Index index) throws CatalogServiceException {
- if (!this.containsCatalog(catalogId)) {
- try {
- this.replaceCatalog(new Catalog(catalogId, index, null, false, false));
- }catch (Exception ignored) {
-
- }
- } else {
- LOG.log(Level.WARNING, "Attempt to override an existing catalog '" + catalogId + "' already used in CatalogService, remedy and retry add -- no changes took place!");
- }
- }
-
- public void addCatalog(String catalogId, Index index, List<Dictionary> dictionaries) throws CatalogServiceException {
- if (!this.containsCatalog(catalogId)) {
- try {
- this.replaceCatalog(new Catalog(catalogId, index, dictionaries, false, false));
- }catch (Exception ignored) {
-
- }
- } else {
- LOG.log(Level.WARNING, "Attempt to override an existing catalog '" + catalogId + "' already used in CatalogService, remedy and retry add -- no changes took place!");
- }
- }
-
- public void addCatalog(String catalogId, Index index, List<Dictionary> dictionaries, boolean restrictQueryPermission, boolean restrictIngestPermission) throws CatalogServiceException {
- if (!this.containsCatalog(catalogId)) {
- try {
- this.replaceCatalog(new Catalog(catalogId, index, dictionaries, restrictQueryPermission, restrictIngestPermission));
- }catch (Exception ignored) {
-
- }
- } else {
- LOG.log(Level.WARNING, "Attempt to override an existing catalog '" + catalogId + "' already used in CatalogService, remedy and retry add -- no changes took place!");
- }
- }
-
- public void addDictionary(String catalogId, Dictionary dictionary) throws CatalogServiceException {
- if (this.containsCatalog(catalogId)) {
- Set<Catalog> backupCatalogs = null;
- this.catalogsLock.writeLock().lock();
- try {
- backupCatalogs = new HashSet<Catalog>(this.catalogs);
- for (Catalog catalog : this.catalogs) {
- if (catalog.getId().equals(catalogId)) {
- catalog.addDictionary(dictionary);
- this.catalogRepository.serializeCatalog(catalog);
- break;
- }
- }
- }catch (Exception e) {
- this.catalogs = backupCatalogs;
- throw new CatalogServiceException("Failed to serialize Catalog '" + catalogId + "' -- if CatalogService goes down, Catalog will have to be readded : " + e.getMessage(), e);
- }finally {
- this.catalogsLock.writeLock().unlock();
- }
- } else {
- LOG.log(Level.WARNING, "Attempt to change an existing catalog '" + catalogId + "' already used in CatalogService, remedy and retry add -- no changes took place!");
- }
- }
-
- public void replaceDictionaries(String catalogId, List<Dictionary> dictionaries) throws CatalogServiceException {
- this.modifyCatalog(catalogId, dictionaries, null, null, null);
- }
-
- public void replaceIndex(String catalogId, Index index) throws CatalogServiceException {
- this.modifyCatalog(catalogId, null, index, null, null);
- }
-
- public void modifyIngestPermission(String catalogId, boolean restrictIngestPermission) throws CatalogServiceException {
- this.modifyCatalog(catalogId, null, null, null, restrictIngestPermission);
- }
-
- public void modifyQueryPermission(String catalogId, boolean restrictQueryPermission) throws CatalogServiceException {
- this.modifyCatalog(catalogId, null, null, restrictQueryPermission, null);
- }
-
- protected void modifyCatalog(String catalogId, List<Dictionary> dictionaries, Index index, Boolean restrictQueryPermission, Boolean restrictIngestPermission) throws CatalogServiceException {
- if (this.containsCatalog(catalogId)) {
- Set<Catalog> backupCatalogs = null;
- this.catalogsLock.writeLock().lock();
- try {
- backupCatalogs = new HashSet<Catalog>(this.catalogs);
- for (Catalog catalog : this.catalogs) {
- if (catalog.getId().equals(catalogId)) {
- if (dictionaries != null) {
- catalog.setDictionaries(dictionaries);
- }
- if (index != null) {
- catalog.setIndex(index);
- }
- if (restrictQueryPermission != null) {
- catalog.setRestrictQueryPermissions(restrictQueryPermissions);
- }
- if (restrictIngestPermission != null) {
- catalog.setRestrictIngestPermissions(restrictIngestPermissions);
- }
- this.catalogRepository.serializeCatalog(catalog);
- break;
- }
- }
- }catch (Exception e) {
- this.catalogs = backupCatalogs;
- throw new CatalogServiceException("Failed to serialize Catalog '" + catalogId + "' -- if CatalogService goes down, Catalog will have to be readded : " + e.getMessage(), e);
- }finally {
- this.catalogsLock.writeLock().unlock();
- }
- }
- }
-
- protected boolean containsCatalog(String catalogId) throws CatalogServiceException {
- this.catalogsLock.readLock().lock();
- try {
- return this.catalogs.contains(catalogId);
- }catch (Exception e) {
- throw new CatalogServiceException("Failed to check if catalog '" + catalogId + "' has already been added to this CatalogService : " + e.getMessage(), e);
- }finally {
- this.catalogsLock.readLock().unlock();
- }
- }
-
- /**
- * Ability to dynamically add a Catalog to this CatalogService for managing
- * @param catalog Catalog for this CatalogService to manage
- * @return True if catalogs where added to list
- * @throws CatalogServiceException If one of the adding Catalog
- * URNs equals that of an existing Catalog.
- */
- public void addCatalog(Catalog catalog) throws CatalogServiceException {
- if (!this.containsCatalog(catalog.getId())) {
- this.replaceCatalog(catalog);
- } else {
- LOG.log(Level.WARNING, "Attempt to override an existing catalog '" + catalog
- + "' already used in CatalogService, remedy and retry add -- no changes took place!");
- }
- }
-
- /**
- * Ability to dynamically add a Catalog to this CatalogService for managing
- * @param catalog Catalog for this CatalogService to manage
- * @throws CatalogServiceException When allowOverride=false and one of the adding Catalog
- * URNs equals that of an existing Catalog.
- */
- public void replaceCatalog(Catalog catalog) throws CatalogServiceException {
- Set<Catalog> backupCatalogs = null;
- this.catalogsLock.writeLock().lock();
- try {
- backupCatalogs = new HashSet<Catalog>(this.catalogs);
- this.catalogs.remove(catalog);
- this.catalogs.add(catalog);
- this.catalogRepository.serializeCatalog(catalog);
- }catch (Exception e) {
- this.catalogs = backupCatalogs;
- throw new CatalogServiceException("Failed to serialize Catalog '" + catalog + "' -- if CatalogService goes down, Catalog will have to be readded : " + e.getMessage(), e);
- }finally {
- this.catalogsLock.writeLock().unlock();
- }
- }
-
- public void removeCatalog(String catalogUrn) throws CatalogServiceException {
- this.removeCatalog(catalogUrn, false);
- }
-
- /**
- *
- * @throws CatalogServiceException
- */
- public void removeCatalog(String catalogId, boolean preserveMapping) throws CatalogServiceException {
- this.catalogsLock.readLock().lock();
- Catalog rmCatalog = null;
- try {
- for (Catalog catalog : this.catalogs) {
- if (catalog.getId().equals(catalogId)) {
- rmCatalog = catalog;
- break;
- }
- }
- }catch (Exception e) {
- throw new CatalogServiceException("Failed to find catalog object for catalog URN '" + catalogId + "' : " + e.getMessage(), e);
- }finally {
- this.catalogsLock.readLock().unlock();
- }
-
- if (rmCatalog != null) {
- this.catalogsLock.writeLock().lock();
- try {
- LOG.log(Level.INFO, "Removing catalog '" + rmCatalog + "'");
- this.catalogs.remove(rmCatalog);
- this.catalogRepository.deleteSerializedCatalog(catalogId);
- if (!preserveMapping) {
- this.ingestMapperLock.writeLock().lock();
- try {
- LOG.log(Level.INFO, "Deleting all index mappings for catalog '" + rmCatalog + "'");
- this.ingestMapper.deleteAllMappingsForCatalog(catalogId);
- } finally {
- this.ingestMapperLock.writeLock().unlock();
- }
- }
- }catch (Exception e) {
- throw new CatalogServiceException("Failed to remove Catalog '" + catalogId + "' from this CatalogService");
- }finally {
- this.catalogsLock.writeLock().unlock();
- }
- }else {
- LOG.log(Level.WARNING, "Catalog '" + catalogId + "' is not currently managed by this CatalogService");
- }
- }
-
- public void setPluginStorageDir(File pluginStorageDir) {
- this.pluginStorageDir = pluginStorageDir;
- this.pluginStorageDir.mkdirs();
- }
-
- public URL getPluginStorageDir() throws CatalogServiceException {
- try {
- return new URL("file://" + this.pluginStorageDir.getAbsolutePath());
- }catch (Exception e) {
- throw new CatalogServiceException("Failed to get plugin storage dir directory : " + e.getMessage(), e);
- }
- }
-
- public List<PluginURL> getPluginUrls() throws CatalogServiceException {
- try {
- return this.catalogRepository.deserializePluginURLs();
- }catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
-
- public void addPluginUrls(List<PluginURL> urls) throws CatalogServiceException {
- try {
- List<PluginURL> currentUrls = new Vector<PluginURL>(this.catalogRepository.deserializePluginURLs());
- currentUrls.addAll(urls);
- this.catalogRepository.serializePluginURLs(currentUrls);
- }catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
-
- /**
- *
- * @return
- * @throws CatalogServiceException
- */
- public Set<Catalog> getCurrentCatalogList() throws CatalogServiceException {
- this.catalogsLock.readLock().lock();
- try {
- return new HashSet<Catalog>(this.catalogs);
- }catch (Exception e) {
- throw new CatalogServiceException("Failed to get current catalog list : " + e.getMessage(), e);
- }finally {
- this.catalogsLock.readLock().unlock();
- }
- }
-
- protected Catalog getCatalog(String catalogUrn) throws CatalogServiceException {
- this.catalogsLock.readLock().lock();
- try {
- for (Catalog catalog : this.catalogs) {
- if (catalog.getId().equals(catalogUrn)) {
- return catalog;
- }
- }
- return null;
- }catch (Exception e) {
- throw new CatalogServiceException("Failed to get catalog catalog '" + catalogUrn + "' : " + e.getMessage(), e);
- }finally {
- this.catalogsLock.readLock().unlock();
- }
- }
-
- /**
- *
- * @return
- * @throws CatalogServiceException
- */
- public Set<String> getCurrentCatalogIds() throws CatalogServiceException {
- this.catalogsLock.readLock().lock();
- try {
- Set<String> catalogIds = new HashSet<String>();
- for (Catalog catalog : this.catalogs) {
- catalogIds.add(catalog.getId());
- }
- return catalogIds;
- }catch (Exception e) {
- throw new CatalogServiceException("Failed to get current catalog ids list : " + e.getMessage(), e);
- }finally {
- this.catalogsLock.readLock().unlock();
- }
- }
-
- public TransactionReceipt ingest(Metadata metadata) throws CatalogServiceException {
- if (this.restrictIngestPermissions) {
- throw new CatalogServiceException(
- "Ingest permissions are restricted for this CatalogService -- request denied");
- }
- try {
- boolean performUpdate;
- TransactionId<?> catalogServiceTransactionId = this.getCatalogServiceTransactionId(metadata);
- if (performUpdate = this.ingestMapper.hasCatalogServiceTransactionId(catalogServiceTransactionId)) {
- LOG.log(Level.INFO, "TransactionId '" + catalogServiceTransactionId
- + "' is an existing TransactionId, switching to update mode");
- }
- List<CatalogReceipt> catalogReceipts = new Vector<CatalogReceipt>();
- for (Catalog catalog : this.getFilteredCatalogList(metadata)) {
- if (catalog.isIngestable()) {
- this.ingestMapperLock.writeLock().lock();
- try {
- // perform update
- if (performUpdate) {
- if (!Boolean.parseBoolean(metadata.getMetadata(ENABLE_UPDATE_MET_KEY))) {
- throw new CatalogServiceException("TransactionId '" + catalogServiceTransactionId
- + "' already exists -- enable update by setting metadata key '"
- + ENABLE_UPDATE_MET_KEY + "'=true");
- }
- TransactionId<?> catalogTransactionId = this.ingestMapper.getCatalogTransactionId(catalogServiceTransactionId, catalog.getId());
- if (catalogTransactionId != null) {
- CatalogReceipt catalogReceipt = catalog.update(catalogTransactionId, metadata);
- if (catalogReceipt != null) {
- if (!catalogReceipt.getTransactionId().equals(catalogTransactionId)) {
- this.ingestMapper.deleteTransactionIdMapping(catalogTransactionId, catalog.getId());
- this.ingestMapper.storeTransactionIdMapping(catalogServiceTransactionId, this.transactionIdFactory, catalogReceipt, catalog.getTransactionIdFactory());
- }
- catalogReceipts.add(catalogReceipt);
- LOG.log(Level.INFO, "Successfully updated metadata to catalog '" + catalog + "' for TransactionId '" + catalogServiceTransactionId + "'");
- }else {
- LOG.log(Level.SEVERE, "Update attempt to catalog '" + catalog + "' failed for TransactionId '" + catalogServiceTransactionId + "' -- update returned false");
- }
- }else {
- LOG.log(Level.INFO, "Catalog '" + catalog + "' was not on ingest list for TransactionId '" + catalogServiceTransactionId + "' -- skipping");
- }
- // perform ingest
- }else {
- LOG.log(Level.INFO, "Performing ingest for TransactionId '" + catalogServiceTransactionId + "' to catalog '" + catalog + "'");
- CatalogReceipt catalogReceipt = catalog.ingest(metadata);
- if (catalogReceipt != null) {
- LOG.log(Level.INFO, "Successfully ingested metadata -- Indexing TransactionId information for ingest (CatalogService TransactionId = '" + catalogServiceTransactionId + "', Catalog TransactionId = '" + catalogReceipt.getTransactionId() + "', catalog = '" + catalogReceipt.getCatalogId() + "')");
- this.ingestMapper.storeTransactionIdMapping(catalogServiceTransactionId, this.transactionIdFactory, catalogReceipt, catalog.getTransactionIdFactory());
- catalogReceipts.add(catalogReceipt);
- }else {
- LOG.log(Level.WARNING, "Catalog '" + catalog + "' not interested in any Metadata for TransactionId '" + catalogServiceTransactionId + "'");
- }
- }
- }catch (Exception e) {
- LOG.log(Level.WARNING, "Failed to add metadata to catalog '" + catalog.getId() + "' : " + e.getMessage(), e);
- if (this.oneCatalogFailsAllFail) {
- throw new CatalogServiceException(
- "Failed to add metadata to catalog '" + catalog.getId() + "' : " + e.getMessage(), e);
- }
- }finally {
- this.ingestMapperLock.writeLock().unlock();
- }
- }else {
- LOG.log(Level.WARNING, "Ingest not permitted to catalog '" + catalog + "' -- skipping over catalog");
- }
- }
- return (catalogReceipts.size() > 0) ? new TransactionReceipt(catalogServiceTransactionId, catalogReceipts) : null;
- }catch (Exception e) {
- throw new CatalogServiceException("Error occured during Metadata ingest attempt : " + e.getMessage(), e);
- }
- }
-
- /**
- *
- * @param metadata
- * @throws CatalogServiceException
- */
- public void delete(Metadata metadata) throws CatalogServiceException {
- if (this.restrictIngestPermissions) {
- throw new CatalogServiceException(
- "Delete permissions are restricted for this CatalogService -- request denied");
- }
- TransactionId<?> catalogServiceTransactionId = this.getCatalogServiceTransactionId(metadata, false);
- if (catalogServiceTransactionId != null) {
- for (Catalog catalog : this.getFilteredCatalogList(metadata)) {
- if (catalog.isIngestable()) {
- this.ingestMapperLock.writeLock().lock();
- try {
- TransactionId<?> catalogTransactionId = this.ingestMapper.getCatalogTransactionId(catalogServiceTransactionId, catalog.getId());
- if (catalogTransactionId != null) {
- if (this.doReduce(metadata)) {
- LOG.log(Level.INFO, "Deleting metadata from TransactionId '" + catalogServiceTransactionId + "' for catalog '" + catalog + "'");
- if (catalog.reduce(catalogTransactionId, metadata)) {
- LOG.log(Level.INFO, "Successfully deleted metadata from catalog '" + catalog + "' for TransactionId [id = " + catalogServiceTransactionId + "]");
- }else {
- LOG.log(Level.INFO, "Failed to deleted metadata from catalog '" + catalog + "' for TransactionId [id = " + catalogServiceTransactionId + "] -- delete returned false");
- }
- }else {
- LOG.log(Level.INFO, "Deleting all records of TransactionId from catalog '" + catalog + "'");
- if (catalog.delete(catalogTransactionId)) {
- this.ingestMapper.deleteTransactionIdMapping(catalogTransactionId, catalog.getId());
- LOG.log(Level.INFO, "Successfully deleted metadata from catalog '" + catalog + "' for TransactionId [id = " + catalogServiceTransactionId + "]");
- }else {
- LOG.log(Level.INFO, "Failed to deleted metadata from catalog '" + catalog + "' for TransactionId [id = " + catalogServiceTransactionId + "] -- delete returned false");
- }
- }
- }else {
- LOG.log(Level.INFO, "Catalog '" + catalog + "' was not on delete list for TransactionId '" + catalogServiceTransactionId + "' -- skipping");
- }
- }catch (Exception e) {
- LOG.log(Level.WARNING, "Error occured while deleting metadata for TransactionId [id = " + catalogServiceTransactionId + "] : " + e.getMessage(), e);
- if (this.oneCatalogFailsAllFail) {
- throw new CatalogServiceException(
- "Error occured while deleting metadata for TransactionId [id = "
- + catalogServiceTransactionId + "] : " + e.getMessage(), e);
- }
- }finally {
- this.ingestMapperLock.writeLock().unlock();
- }
- }else {
- LOG.log(Level.WARNING, "Deletion is not permitted to catalog '" + catalog + "' -- skipping over catalog");
- }
- }
- }else {
- throw new CatalogServiceException("Must specify a TransactionId to delete");
- }
- }
-
- protected boolean doReduce(Metadata metadata) {
- for (String key : metadata.getAllKeys()) {
- if (!(key.equals(CATALOG_SERVICE_TRANSACTION_ID_MET_KEY) || key.equals(CATALOG_IDS_MET_KEY) || key
- .equals(CATALOG_TRANSACTION_ID_MET_KEY) || key.equals(CATALOG_ID_MET_KEY))) {
- return true;
- }
- }
- return false;
- }
-
- public List<String> getProperty(String key) throws CatalogServiceException {
- List<String> vals = new Vector<String>();
- for (Catalog catalog : this.getCurrentCatalogList()) {
- try {
- String val = catalog.getProperty(key);
- if (val != null) {
- vals.add(val);
- }
- }catch (Exception e) {
- if (this.oneCatalogFailsAllFail) {
- throw new CatalogServiceException(
- "Failed to get catalog property '" + key + "' from catalog '" + catalog.getId() + "' : " + e
- .getMessage(), e);
- } else {
- LOG.log(Level.WARNING,
- "Failed to get catalog property '" + key + "' from catalog '" + catalog.getId() + "' : " + e
- .getMessage(), e);
- }
- }
- }
- return vals;
- }
-
- public Properties getCalalogProperties() throws CatalogServiceException {
- Properties properties = new Properties();
- for (Catalog catalog : this.getCurrentCatalogList()) {
- try {
- Properties catalogProperties = catalog.getProperties();
- for (Object key : catalogProperties.keySet()) {
- String value = properties.getProperty((String) key);
- if (value != null) {
- value += "," + catalogProperties.getProperty((String) key);
- } else {
- value = catalogProperties.getProperty((String) key);
- }
- properties.setProperty((String) key, value);
- }
- }catch (Exception e) {
- if (this.oneCatalogFailsAllFail) {
- throw new CatalogServiceException(
- "Failed to get catalog properties from catalog '" + catalog.getId() + "' : " + e.getMessage(), e);
- } else {
- LOG.log(Level.WARNING,
- "Failed to get catalog properties from catalog '" + catalog.getId() + "' : " + e.getMessage(), e);
- }
- }
- }
- return properties;
- }
-
- public Properties getCalalogProperties(String catalogUrn) throws CatalogServiceException {
- try {
- Catalog catalog = this.getCatalog(catalogUrn);
- if (catalog != null) {
- return catalog.getProperties();
- } else {
- return null;
- }
- }catch (Exception e) {
- throw new CatalogServiceException("Failed to get catalog properties from catalog '" + catalogUrn + "' : " + e.getMessage(), e);
- }
- }
-
- public Page getNextPage(Page page) throws CatalogServiceException {
- QueryPager queryPager = new QueryPager(this._query(page.getQueryExpression(), page.getRestrictToCatalogIds()));
- queryPager.setPageInfo(new PageInfo(page.getPageSize(), page.getPageNum() + 1));
- return this.getPage(page.getQueryExpression(), page.getRestrictToCatalogIds(), queryPager);
- }
-
- public Page getPage(PageInfo pageInfo, QueryExpression queryExpression) throws CatalogServiceException {
- return this.getPage(pageInfo, queryExpression, this.getCurrentCatalogIds());
- }
-
- public Page getPage(PageInfo pageInfo, QueryExpression queryExpression, Set<String> catalogIds) throws CatalogServiceException {
- if (this.disableIntersectingCrossCatalogQueries) {
- try {
- int totalResults = 0;
- LinkedHashMap<String, Integer> catalogToSizeOfMap = new LinkedHashMap<String, Integer>();
- for (String catalogId : catalogIds) {
- Catalog catalog = this.getCatalog(catalogId);
- QueryExpression qe = this.reduceToUnderstoodExpressions(catalog, queryExpression);
- if (qe != null) {
- int catalogResultSize = catalog.sizeOf(qe);
- totalResults += catalogResultSize;
- catalogToSizeOfMap.put(catalogId, catalogResultSize);
- }
- }
-
- LOG.log(Level.INFO, "Routing query to catalogs as non-cross catalog intersecting queries . . .");
- if (totalResults <= this.crossCatalogResultSortingThreshold) {
- List<CatalogReceipt> catalogReceipts = new Vector<CatalogReceipt>();
- for (String catalogId : catalogToSizeOfMap.keySet()) {
- Catalog catalog = this.getCatalog(catalogId);
- QueryExpression qe = this.reduceToUnderstoodExpressions(catalog, queryExpression);
- if (qe != null) {
- catalogReceipts.addAll(catalog.query(qe));
- }
- }
- List<TransactionReceipt> transactionReceipts = this.getPossiblyUnindexedTransactionReceipts(catalogReceipts);
- LOG.log(Level.INFO, "Sorting Query Results . . . ");
- Collections.sort(transactionReceipts, new Comparator<TransactionReceipt>() {
- public int compare(TransactionReceipt o1,
- TransactionReceipt o2) {
- return o2.getTransactionDate().compareTo(o1.getTransactionDate());
- }
- });
- QueryPager queryPager = new QueryPager(transactionReceipts);
- queryPager.setPageInfo(pageInfo);
- return this.getPage(queryExpression, catalogIds, queryPager);
- }else {
- int currentIndex = 0;
- int desiredStartingIndex = pageInfo.getPageNum() * pageInfo.getPageSize();
- List<CatalogReceipt> pageOfReceipts = new Vector<CatalogReceipt>();
- for (Entry<String, Integer> entry : catalogToSizeOfMap.entrySet()) {
- if (desiredStartingIndex - currentIndex <= entry.getValue()) {
- Catalog catalog = this.getCatalog(entry.getKey());
- QueryExpression qe = this.reduceToUnderstoodExpressions(catalog, queryExpression);
- if (qe != null) {
- List<CatalogReceipt> receipts = catalog.query(qe, desiredStartingIndex - currentIndex, Math.min((desiredStartingIndex - currentIndex) + pageInfo.getPageSize(), entry.getValue()));
- pageOfReceipts.addAll(receipts);
- if (pageOfReceipts.size() >= pageInfo.getPageSize()) {
- break;
- }
- }
- }else {
- currentIndex += entry.getValue();
- }
- }
- return new Page(new ProcessedPageInfo(pageInfo.getPageSize(), pageInfo.getPageNum(), totalResults), queryExpression, catalogIds, this.indexReceipts(this.getPossiblyUnindexedTransactionReceipts(pageOfReceipts)));
- }
- }catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }else {
- QueryPager queryPager = new QueryPager(this._query(queryExpression, catalogIds));
- queryPager.setPageInfo(pageInfo);
- return this.getPage(queryExpression, catalogIds, queryPager);
- }
- }
-
- public QueryPager query(QueryExpression queryExpression) throws CatalogServiceException {
- return this.query(queryExpression, this.getCurrentCatalogIds());
- }
-
- public List<TransactionalMetadata> getMetadata(Page page) throws CatalogServiceException {
- return this.getMetadata(page.getReceipts());
- }
-
- protected Page getPage(QueryExpression queryExpression, Set<String> restrictToCatalogIds, QueryPager queryPager) throws CatalogServiceException {
- return new Page(new ProcessedPageInfo(queryPager.getPageSize(), queryPager.getPageNum(), queryPager.getNumOfHits()), queryExpression, restrictToCatalogIds, this.indexReceipts(queryPager.getCurrentPage()));
- }
-
- public QueryPager query(QueryExpression queryExpression, Set<String> catalogIds) throws CatalogServiceException {
- return new QueryPager(this.indexReceipts(this._query(queryExpression, catalogIds)));
- }
-
- /**
- *
- * @param queryExpression
- * @return
- * @throws CatalogServiceException
- */
- public List<TransactionReceipt> _query(QueryExpression queryExpression, Set<String> catalogIds) throws CatalogServiceException {
- if (this.restrictQueryPermissions) {
- throw new CatalogServiceException(
- "Query permissions are restricted for this CatalogService -- request denied");
- }
- try {
- LOG.log(Level.INFO, "Recieved query '" + queryExpression + "'");
- if (this.simplifyQueries) {
- queryExpression = QueryUtils.simplifyQuery(queryExpression);
- LOG.log(Level.INFO, "Simplified query to '" + queryExpression + "' -- routing query to catalogs");
- }
- QueryResult queryResult = this.queryRecur(queryExpression, catalogIds);
- List<CatalogReceipt> catalogReceipts = new Vector<CatalogReceipt>();
- if (queryResult.getCatalogReceipts() == null && queryResult.getInterestedCatalogs() != null) {
- for (Catalog catalog : this.getCurrentCatalogList()) {
- try {
- if (queryResult.getInterestedCatalogs().contains(catalog.getId())) {
- LOG.log(Level.INFO, "Restricting query to understood terms for Catalog '" + catalog + "'");
- QueryExpression reducedExpression = this.reduceToUnderstoodExpressions(catalog, queryExpression);
- LOG.log(Level.INFO, "Querying Catalog '" + catalog + "' with query '" + reducedExpression + "'");
- catalogReceipts.addAll(catalog.query(reducedExpression));
- }
- }catch (Exception e) {
- if (this.oneCatalogFailsAllFail) {
- throw new CatalogServiceException(
- "Failed to query catalog '" + catalog.getId() + "' for query '" + queryExpression + "' : "
- + e.getMessage(), e);
- } else {
- LOG.log(Level.WARNING,
- "Failed to query catalog '" + catalog.getId() + "' for query '" + queryExpression + "' : "
- + e.getMessage(), e);
- }
- }
- }
- }
- List<TransactionReceipt> transactionReceipts = this.getPossiblyUnindexedTransactionReceipts(catalogReceipts);
- LOG.log(Level.INFO, "Sorting Query Results . . . ");
- Collections.sort(transactionReceipts, new Comparator<TransactionReceipt>() {
- public int compare(TransactionReceipt o1,
- TransactionReceipt o2) {
- return o2.getTransactionDate().compareTo(o1.getTransactionDate());
- }
- });
-
- LOG.log(Level.INFO, "Query returned " + transactionReceipts.size() + " results");
- return transactionReceipts;
- }catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- throw new CatalogServiceException("Failed to get TransactionId to Metadata map for query '" + queryExpression + "' : " + e.getMessage(), e);
- }
- }
-
- protected List<TransactionReceipt> getPossiblyUnindexedTransactionReceipts(List<CatalogReceipt> catalogReceipts) throws CatalogServiceException {
- try {
- List<TransactionReceipt> returnList = new Vector<TransactionReceipt>();
- LinkedHashMap<TransactionId<?>, List<CatalogReceipt>> existing = new LinkedHashMap<TransactionId<?>, List<CatalogReceipt>>();
- for (CatalogReceipt catalogReceipt : catalogReceipts) {
- TransactionId<?> catalogServiceTransactionId = this.getCatalogServiceTransactionId(catalogReceipt.getTransactionId(), catalogReceipt.getCatalogId());
- if (catalogServiceTransactionId != null) {
- List<CatalogReceipt> found = existing.get(catalogServiceTransactionId);
- if (found == null) {
- found = new Vector<CatalogReceipt>();
- }
- found.add(catalogReceipt);
- existing.put(catalogServiceTransactionId, found);
- }else {
- returnList.add(new TransactionReceipt(null, Collections.singletonList(catalogReceipt)));
- }
- }
- for (Map.Entry<TransactionId<?>, List<CatalogReceipt>> transactionId : existing.entrySet()) {
- returnList.add(new TransactionReceipt(transactionId.getKey(), existing.get(transactionId.getKey())));
- }
- return returnList;
- }catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
-
- protected List<TransactionReceipt> indexReceipts(List<TransactionReceipt> transactionReceipts) throws CatalogServiceException {
- List<TransactionReceipt> indexedReceipts = new Vector<TransactionReceipt>();
- for (TransactionReceipt transactionReceipt : transactionReceipts) {
- try {
- if (transactionReceipt.getTransactionId() == null) {
- transactionReceipt = new TransactionReceipt(
- this.getCatalogServiceTransactionId(transactionReceipt.getCatalogReceipts().get(0), true),
- transactionReceipt.getCatalogReceipts());
- }
- indexedReceipts.add(transactionReceipt);
- }catch(Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
- return indexedReceipts;
- }
-
- public List<TransactionalMetadata> getNextPage(QueryPager queryPager) throws CatalogServiceException {
- try {
- return this.getMetadata(queryPager.getCurrentPage());
- }catch (Exception e) {
- throw new CatalogServiceException("Failed to get next page of Metadata : " + e.getMessage(), e);
- }
- }
-
- public List<TransactionalMetadata> getAllPages(QueryPager queryPager) throws CatalogServiceException {
- try {
- return this.getMetadata(queryPager.getTransactionReceipts());
- }catch (Exception e) {
- throw new CatalogServiceException("Failed to get all page of Metadata : " + e.getMessage(), e);
- }
- }
-
- public List<TransactionalMetadata> getMetadataFromTransactionIdStrings(List<String> catalogServiceTransactionIdStrings) throws CatalogServiceException {
- List<TransactionId<?>> catalogServiceTransactionIds = new Vector<TransactionId<?>>();
- for (String catalogServiceTransactionIdString : catalogServiceTransactionIdStrings) {
- catalogServiceTransactionIds.add(this.generateTransactionId(catalogServiceTransactionIdString));
- }
- return this.getMetadataFromTransactionIds(catalogServiceTransactionIds);
- }
-
- public List<TransactionalMetadata> getMetadata(List<TransactionReceipt> transactionReceipts) throws CatalogServiceException {
- LinkedHashSet<TransactionalMetadata> metadataSet = new LinkedHashSet<TransactionalMetadata>();
- for (TransactionReceipt transactionReceipt : transactionReceipts) {
- Metadata metadata = new Metadata();
- Vector<CatalogReceipt> successfulCatalogReceipts = new Vector<CatalogReceipt>();
- for (CatalogReceipt catalogReceipt : transactionReceipt.getCatalogReceipts()) {
- try {
- Catalog catalog = this.getCatalog(catalogReceipt.getCatalogId());
- metadata.addMetadata(catalog.getMetadata(catalogReceipt.getTransactionId()));
- successfulCatalogReceipts.add(catalogReceipt);
- }catch (Exception e) {
- if (this.oneCatalogFailsAllFail) {
- throw new CatalogServiceException(
- "Failed to get metadata for transaction ids for catalog '" + catalogReceipt.getCatalogId()
- + "' : " + e.getMessage(), e);
- } else {
- LOG.log(Level.WARNING,
- "Failed to get metadata for transaction ids for catalog '" + catalogReceipt.getCatalogId()
- + "' : " + e.getMessage(), e);
- }
- }
- }
- if (metadata.getMap().keySet().size() > 0) {
- metadataSet.add(new TransactionalMetadata(
- new TransactionReceipt(transactionReceipt.getTransactionId(), successfulCatalogReceipts), metadata));
- }
- }
- return new Vector<TransactionalMetadata>(metadataSet);
- }
-
- public List<TransactionalMetadata> getMetadataFromTransactionIds(List<TransactionId<?>> catalogServiceTransactionIds) throws CatalogServiceException {
- LinkedHashSet<TransactionalMetadata> metadataSet = new LinkedHashSet<TransactionalMetadata>();
- for (TransactionId<?> catalogServiceTransactionId : catalogServiceTransactionIds) {
- Metadata metadata = new Metadata();
- Vector<CatalogReceipt> catalogReceipts = new Vector<CatalogReceipt>();
- for (Catalog catalog : this.getCurrentCatalogList()) {
- try {
- CatalogReceipt catalogReceipt = this.ingestMapper.getCatalogReceipt(catalogServiceTransactionId, catalog.getId());
- if (catalogReceipt != null) {
- metadata.addMetadata(catalog.getMetadata(catalogReceipt.getTransactionId()).getMap());
- catalogReceipts.add(catalogReceipt);
- }
- }catch (Exception e) {
- if (this.oneCatalogFailsAllFail) {
- throw new CatalogServiceException(
- "Failed to get metadata for transaction ids for catalog '" + catalog.getId() + "' : " + e
- .getMessage(), e);
- } else {
- LOG.log(Level.WARNING,
- "Failed to get metadata for transaction ids for catalog '" + catalog.getId() + "' : " + e
- .getMessage(), e);
- }
- }
- }
- if (metadata.getMap().keySet().size() > 0) {
- metadataSet.add(
- new TransactionalMetadata(new TransactionReceipt(catalogServiceTransactionId, catalogReceipts),
- metadata));
- }
- }
- return new Vector<TransactionalMetadata>(metadataSet);
- }
-
- public List<TransactionId<?>> getCatalogServiceTransactionIds(List<TransactionId<?>> catalogTransactionIds, String catalogUrn) throws CatalogServiceException {
- LinkedHashSet<TransactionId<?>> catalogServiceTransactionIds = new LinkedHashSet<TransactionId<?>>();
- for (TransactionId<?> catalogTransactionId : catalogTransactionIds) {
- TransactionId<?> catalogServiceTransactionId = this.getCatalogServiceTransactionId(catalogTransactionId, catalogUrn);
- catalogServiceTransactionIds.add(catalogServiceTransactionId);
- }
- return new Vector<TransactionId<?>>(catalogServiceTransactionIds);
- }
-
- public TransactionId<?> getCatalogServiceTransactionId(TransactionId<?> catalogTransactionId, String catalogUrn) throws CatalogServiceException {
- this.ingestMapperLock.readLock().lock();
- try {
- return this.ingestMapper.getCatalogServiceTransactionId(catalogTransactionId, catalogUrn);
- }catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }finally {
- this.ingestMapperLock.readLock().unlock();
- }
- }
-
- public TransactionId<?> getCatalogServiceTransactionId(CatalogReceipt catalogReceipt, boolean generateNew) throws CatalogServiceException {
- try {
- TransactionId<?> catalogServiceTransactionId = this.getCatalogServiceTransactionId(catalogReceipt.getTransactionId(), catalogReceipt.getCatalogId());
- if (catalogServiceTransactionId == null && generateNew) {
- catalogServiceTransactionId = this.generateNewUniqueTransactionId();
- LOG.log(Level.INFO, "CatalogServer mapping transaction: " + catalogServiceTransactionId + "," + catalogReceipt.getTransactionId() + "," + catalogReceipt.getCatalogId());
- this.ingestMapperLock.writeLock().lock();
- try {
- this.ingestMapper.storeTransactionIdMapping(catalogServiceTransactionId, this.transactionIdFactory, catalogReceipt, this.getCatalog(catalogReceipt.getCatalogId()).getTransactionIdFactory());
- }catch (Exception e) {
- throw new CatalogServiceException("Failed to write TransactionId '" + catalogServiceTransactionId + "' : " + e.getMessage(), e);
- }finally {
- this.ingestMapperLock.writeLock().unlock();
- }
- }
- return catalogServiceTransactionId;
- }catch (Exception e) {
- throw new CatalogServiceException("Failed to get CatalogServiceTransactionId : " + e.getMessage(), e);
- }
- }
-
- protected TransactionId<?> generateNewUniqueTransactionId() {
- try {
- return this.transactionIdFactory.createNewTransactionId();
- }catch (Exception e) {
- LOG.log(Level.SEVERE, "Failed to generate a new TransactionId from factory '" + this.transactionIdFactory.getClass().getCanonicalName() + "' : " + e.getMessage(), e);
- return null;
- }
- }
-
- protected TransactionId<?> generateTransactionId(String stringTransactionId) {
- try {
- return this.transactionIdFactory.createTransactionId(stringTransactionId);
- }catch (Exception e) {
- LOG.log(Level.SEVERE, "Failed to generate a new TransactionId from factory '" + this.transactionIdFactory.getClass().getCanonicalName() + "' for string value '" + stringTransactionId + ": " + e.getMessage(), e);
- return null;
- }
- }
-
- // check if transaction id was specified by user, otherwise generate a new one
- protected TransactionId<?> getCatalogServiceTransactionId(Metadata metadata) throws CatalogServiceException {
- return this.getCatalogServiceTransactionId(metadata, true);
- }
-
- protected TransactionId<?> getCatalogServiceTransactionId(Metadata metadata, boolean generateNew) throws CatalogServiceException {
- try {
- if (metadata.getMetadata(CatalogServiceLocal.CATALOG_SERVICE_TRANSACTION_ID_MET_KEY) != null) {
- return this.generateTransactionId(metadata.getMetadata(CatalogServiceLocal.CATALOG_SERVICE_TRANSACTION_ID_MET_KEY));
- }else if (metadata.getMetadata(CatalogServiceLocal.CATALOG_TRANSACTION_ID_MET_KEY) != null && metadata.getMetadata(CatalogServiceLocal.CATALOG_ID_MET_KEY) != null) {
- String catalogId = metadata.getMetadata(CatalogServiceLocal.CATALOG_ID_MET_KEY);
- Catalog catalog = this.getCatalog(catalogId);
- if (catalog != null) {
- TransactionId<?> catalogTransactionId = catalog.getTransactionIdFromString(metadata.getMetadata(CatalogServiceLocal.CATALOG_TRANSACTION_ID_MET_KEY));
- TransactionId<?> catalogServiceTransactionId = this.ingestMapper.getCatalogServiceTransactionId(catalogTransactionId, catalogId);
- if (catalogServiceTransactionId == null) {
- throw new CatalogServiceException(
- "CatalogService's Catalog '" + catalog.getId() + "' is not aware of TransactionId '"
- + catalogTransactionId + "'s");
- }
- return catalogServiceTransactionId;
- }else {
- throw new CatalogServiceException("This CatalogService has no Catalog with ID = '" + catalogId + "'");
- }
- }else if (generateNew) {
- return this.generateNewUniqueTransactionId();
- }else {
- throw new CatalogServiceException("Metadata fields not present to determine a TransactionId");
- }
- }catch (Exception e) {
- throw new CatalogServiceException("Failed determine TransactionId : " + e.getMessage(), e);
- }
- }
-
- protected Set<Catalog> getFilteredCatalogList(Metadata metadata) throws CatalogServiceException {
- try {
- if (metadata.containsKey(CATALOG_ID_MET_KEY)) {
- Catalog catalog = this.getCatalog(metadata.getMetadata(CATALOG_ID_MET_KEY));
- if (catalog == null) {
- throw new CatalogServiceException("Catalog '" + metadata.getMetadata(CATALOG_ID_MET_KEY)
- + "' is not managed by this CatalogService");
- } else {
- return Collections.singleton(catalog);
- }
- }else if (metadata.containsKey(CATALOG_IDS_MET_KEY)) {
- HashSet<Catalog> filteredCatalogList = new HashSet<Catalog>();
- for (Object catalogUrn : metadata.getAllMetadata(CATALOG_IDS_MET_KEY)) {
- Catalog catalog = this.getCatalog((String) catalogUrn);
- if (catalog == null) {
- throw new CatalogServiceException("Catalog '" + metadata.getMetadata(CATALOG_ID_MET_KEY)
- + "' is not managed by this CatalogService");
- } else {
- filteredCatalogList.add(catalog);
- }
- }
- return filteredCatalogList;
- }else {
- return new HashSet<Catalog>(this.catalogs);
- }
- }catch (Exception e) {
- throw new CatalogServiceException("Failed to get filtered catalog list : " + e.getMessage(), e);
- }
- }
-
- protected QueryResult queryRecur(QueryExpression queryExpression, Set<String> restrictToCatalogIds) throws CatalogServiceException, CatalogException {
- // get QueryResults for sub queries
- if (queryExpression instanceof QueryLogicalGroup) {
-
- // get children query results
- List<QueryResult> childrenQueryResults = new Vector<QueryResult>();
- for (QueryExpression subQueryExpression : ((QueryLogicalGroup) queryExpression).getExpressions()) {
- childrenQueryResults.add(queryRecur(subQueryExpression, restrictToCatalogIds));
- }
-
- if ((((QueryLogicalGroup) queryExpression).getOperator().equals(QueryLogicalGroup.Operator.AND) && containsUnbalancedCatalogInterest(childrenQueryResults)) || containsTranactionReceipts(childrenQueryResults)) {
-
- for (QueryResult childQueryResult : childrenQueryResults) {
- // if childQueryResult has not been used, use it
- if (childQueryResult.getCatalogReceipts() == null) {
- List<CatalogReceipt> catalogReceipts = new Vector<CatalogReceipt>();
- for (Catalog catalog : this.getCurrentCatalogList()) {
- try {
- if (childQueryResult.getInterestedCatalogs().contains(catalog.getId())) {
- catalogReceipts.addAll(catalog
- .query(this.reduceToUnderstoodExpressions(catalog, childQueryResult.getQueryExpression())));
- }
- } catch (Exception e) {
- if (this.oneCatalogFailsAllFail) {
- throw new CatalogServiceException(
- "Failed to query catalog '" + catalog.getId() + "' for query '" + queryExpression + "' : "
- + e.getMessage(), e);
- } else {
- LOG.log(Level.WARNING,
- "Failed to query catalog '" + catalog.getId() + "' for query '" + queryExpression + "' : "
- + e.getMessage(), e);
- }
- }
- }
- childQueryResult.setCatalogReceipts(catalogReceipts);
- }
-
- }
-
- // get intersection of results
- QueryResult queryResult = new QueryResult(queryExpression);
- queryResult.setCatalogReceipts(this.getIntersection(childrenQueryResults));
- return queryResult;
- }else {
- // get merge of results
- QueryResult queryResult = new QueryResult(queryExpression);
- HashSet<String> interestedCatalogs = new HashSet<String>();
- for (QueryResult childQueryResult : childrenQueryResults) {
- interestedCatalogs.addAll(childQueryResult.getInterestedCatalogs());
- }
- queryResult.setInterestedCatalogs(interestedCatalogs);
- return queryResult;
- }
- }else if (queryExpression instanceof WrapperQueryExpression) {
-
- // check for catalogs interested in wrapper query expression
- restrictToCatalogIds.retainAll(getInterestedCatalogs(queryExpression, restrictToCatalogIds));
-
- // check for catalogs interested in wrapped query expression
- QueryResult wrapperExprQueryResult;
- QueryExpression wrapperQE = ((WrapperQueryExpression) queryExpression).getQueryExpression();
- if (wrapperQE instanceof QueryLogicalGroup) {
- wrapperExprQueryResult = this.queryRecur((QueryLogicalGroup) wrapperQE, restrictToCatalogIds);
- }else {
- wrapperExprQueryResult = new QueryResult(wrapperQE);
- wrapperExprQueryResult.interestedCatalogs = getInterestedCatalogs(wrapperQE, restrictToCatalogIds);
- wrapperExprQueryResult.interestedCatalogs.retainAll(restrictToCatalogIds);
- }
- return wrapperExprQueryResult;
- }else {
- // determine catalogs interested in this query expression
- QueryResult queryResult = new QueryResult(queryExpression);
- Set<String> interestedCatalogs = getInterestedCatalogs(queryExpression, restrictToCatalogIds);
- interestedCatalogs.retainAll(restrictToCatalogIds);
- queryResult.setInterestedCatalogs(interestedCatalogs);
- return queryResult;
- }
- }
-
- protected List<CatalogReceipt> getIntersection(List<QueryResult> queryResults) {
- List<CatalogReceipt> catalogReceipts = new Vector<CatalogReceipt>();
- if (queryResults.size() > 0) {
- catalogReceipts.addAll(queryResults.get(0).getCatalogReceipts());
- for (int i = 1; i < queryResults.size(); i++) {
- QueryResult qr = queryResults.get(i);
-TR: for (CatalogReceipt catalogReceipt : qr.getCatalogReceipts()) {
- for (CatalogReceipt compCatalogReceipt : catalogReceipts) {
- if (catalogReceipt.getTransactionId().equals(compCatalogReceipt.getTransactionId())) {
- continue TR;
- }
- }
- catalogReceipts.remove(catalogReceipt);
- }
- }
- }
- return catalogReceipts;
- }
-
- protected QueryExpression reduceToUnderstoodExpressions(Catalog catalog, QueryExpression queryExpression) throws
- CatalogException {
- if (queryExpression instanceof QueryLogicalGroup) {
- QueryLogicalGroup queryLogicalGroup = (QueryLogicalGroup) queryExpression;
- List<QueryExpression> restrictedExpressions = new Vector<QueryExpression>();
- for (QueryExpression qe : queryLogicalGroup.getExpressions()) {
- QueryExpression restrictedQE = this.reduceToUnderstoodExpressions(catalog, qe);
- if (restrictedQE == null && queryLogicalGroup.getOperator().equals(QueryLogicalGroup.Operator.AND) && this.disableIntersectingCrossCatalogQueries) {
- restrictedExpressions.clear();
- break;
- }
- if (restrictedQE != null) {
- restrictedExpressions.add(restrictedQE);
- }
- }
- if (restrictedExpressions.size() > 0) {
- if (restrictedExpressions.size() == 1) {
- return restrictedExpressions.get(0);
- }else {
- QueryLogicalGroup restrictedQueryLogicalGroup = queryLogicalGroup.clone();
- restrictedQueryLogicalGroup.setExpressions(restrictedExpressions);
- return restrictedQueryLogicalGroup;
- }
- }else {
- return null;
- }
- }else if (queryExpression instanceof WrapperQueryExpression) {
- WrapperQueryExpression wrapperQueryExpresssion = (WrapperQueryExpression) queryExpression;
- if (catalog.isInterested(queryExpression)) {
- QueryExpression qe = this.reduceToUnderstoodExpressions(catalog, wrapperQueryExpresssion.getQueryExpression());
- if (qe != null) {
- WrapperQueryExpression wqe = wrapperQueryExpresssion.clone();
- wqe.setQueryExpression(qe);
- return wqe;
- }else if (wrapperQueryExpresssion.isValidWithNoSubExpression()){
- WrapperQueryExpression wqe = wrapperQueryExpresssion.clone();
- wqe.setQueryExpression(null);
- return wqe;
- }else {
- return null;
- }
- }else {
- return null;
- }
-
- }else if (catalog.isInterested(queryExpression)) {
- return queryExpression;
- }else {
- return null;
- }
- }
-
- protected boolean containsTranactionReceipts(List<QueryResult> queryResults) {
- for (QueryResult queryResult : queryResults) {
- if (queryResult.getCatalogReceipts() != null) {
- return true;
- }
- }
- return false;
- }
-
- protected boolean containsUnbalancedCatalogInterest(List<QueryResult> queryResults) {
- if (queryResults.size() > 0) {
- QueryResult firstQueryResult = queryResults.get(0);
- for (int i = 1; i < queryResults.size(); i++) {
- QueryResult queryResult = queryResults.get(i);
- if (!(queryResult.interestedCatalogs.containsAll(firstQueryResult.interestedCatalogs) && firstQueryResult.interestedCatalogs.containsAll(queryResult.interestedCatalogs))) {
- return true;
- }
- }
- return false;
- }else {
- return false;
- }
- }
-
- protected HashSet<String> getInterestedCatalogs(QueryExpression queryExpression, Set<String> restrictToCatalogIds) throws CatalogException, CatalogServiceException {
- HashSet<String> interestedCatalogs = new HashSet<String>();
- for (Catalog catalog : this.getCurrentCatalogList()) {
- try {
- if (restrictToCatalogIds.contains(catalog.getId())) {
- if (catalog.isInterested(queryExpression)) {
- interestedCatalogs.add(catalog.getId());
- }
- }
- }catch (Exception e) {
- if (this.oneCatalogFailsAllFail) {
- throw new CatalogException(
- "Failed to determine if Catalog '" + catalog.getId() + "' is interested in query expression '"
- + queryExpression + "' : " + e.getMessage(), e);
- } else {
- LOG.log(Level.WARNING,
- "Failed to determine if Catalog '" + catalog.getId() + "' is interested in query expression '"
- + queryExpression + "' : " + e.getMessage(), e);
- }
- }
- }
- return interestedCatalogs;
- }
-
- protected class QueryResult {
-
- private QueryExpression queryExpression;
- private List<CatalogReceipt> catalogReceipts;
- private Set<String> interestedCatalogs;
-
- public QueryResult(QueryExpression queryExpression) {
- this.queryExpression = queryExpression;
- }
-
- public QueryExpression getQueryExpression() {
- return queryExpression;
- }
-
- public void setQueryExpression(QueryExpression queryExpression) {
- this.queryExpression = queryExpression;
- }
-
- public List<CatalogReceipt> getCatalogReceipts() {
- return catalogReceipts;
- }
-
- public void setCatalogReceipts(
- List<CatalogReceipt> catalogReceipts) {
- this.catalogReceipts = catalogReceipts;
- }
-
- public Set<String> getInterestedCatalogs() {
- return interestedCatalogs;
- }
-
- public void setInterestedCatalogs(Set<String> interestedCatalogs) {
- this.interestedCatalogs = interestedCatalogs;
- }
-
- }
-
- protected class QueryResultGroup {
- HashSet<TransactionReceipt> transactionReceipts;
- String id;
-
- public QueryResultGroup(String id) {
- this.id = id;
- transactionReceipts = new HashSet<TransactionReceipt>();
- }
-
- public HashSet<TransactionReceipt> getResults() {
- return this.transactionReceipts;
- }
-
- public void addTransactionReceipt(TransactionReceipt transactionReceipt) {
- this.transactionReceipts.add(transactionReceipt);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceLocalFactory.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceLocalFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceLocalFactory.java
deleted file mode 100644
index 8b36c98..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceLocalFactory.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.system.impl;
-
-//JDK imports
-import org.apache.oodt.cas.catalog.mapping.IngestMapperFactory;
-import org.apache.oodt.cas.catalog.repository.CatalogRepositoryFactory;
-import org.apache.oodt.cas.catalog.struct.TransactionIdFactory;
-import org.apache.oodt.cas.catalog.system.CatalogServiceFactory;
-
-import org.springframework.beans.factory.annotation.Required;
-
-import java.io.File;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-//OODT imports
-//Spring imports
-
-//OODT imports
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A Factory class for CatalogServiceLocal
- * <p>
- */
-public class CatalogServiceLocalFactory implements CatalogServiceFactory {
-
- public static final int INT = 200;
- private static Logger LOG = Logger.getLogger(CatalogServiceLocalFactory.class.getName());
-
- protected CatalogRepositoryFactory catalogRepositoryFactory = null;
- protected IngestMapperFactory ingestMapperFactory = null;
- protected boolean restrictQueryPermissions = false;
- protected boolean restrictIngestPermissions = false;
- protected TransactionIdFactory transactionIdFactory = null;
- protected String pluginStorageDir = null;
- protected boolean oneCatalogFailsAllFail = false;
- protected boolean simplifyQueries = false;
- protected boolean disableIntersectingCrossCatalogQueries = false;
- protected int crossCatalogResultSortingThreshold = INT;
-
- public CatalogServiceLocalFactory() {}
-
- public CatalogServiceLocal createCatalogService() {
- try {
- return new CatalogServiceLocal(this.catalogRepositoryFactory.createRepository(), this.ingestMapperFactory.createMapper(), new File(this.pluginStorageDir), this.transactionIdFactory, this.restrictQueryPermissions, this.restrictIngestPermissions, this.oneCatalogFailsAllFail, this.simplifyQueries, this.disableIntersectingCrossCatalogQueries, this.crossCatalogResultSortingThreshold);
- }catch (Exception e) {
- LOG.log(Level.SEVERE, "Failed to create CatalogServiceLocal : " + e.getMessage(), e);
- return null;
- }
- }
-
- @Required
- public void setCatalogRepositoryFactory(CatalogRepositoryFactory catalogRepositoryFactory) {
- this.catalogRepositoryFactory = catalogRepositoryFactory;
- }
-
- @Required
- public void setIngestMapperFactory(IngestMapperFactory ingestMapperFactory) {
- this.ingestMapperFactory = ingestMapperFactory;
- }
-
- @Required
- public void setRestrictQueryPermissions(boolean restrictQueryPermissions) {
- this.restrictQueryPermissions = restrictQueryPermissions;
- }
-
- @Required
- public void setRestrictIngestPermissions(boolean restrictIngestPermissions) {
- this.restrictIngestPermissions = restrictIngestPermissions;
- }
-
- @Required
- public void setTransactionIdFactory(String transactionIdFactory) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
- this.transactionIdFactory = (TransactionIdFactory) Class.forName(transactionIdFactory).newInstance();
- }
-
- @Required
- public void setPluginStorageDir(String pluginStorageDir) {
- this.pluginStorageDir = pluginStorageDir;
- }
-
- @Required
- public void setOneCatalogFailsAllFail(boolean oneCatalogFailsAllFail) {
- this.oneCatalogFailsAllFail = oneCatalogFailsAllFail;
- }
-
- @Required
- public void setSimplifyQueries(boolean simplifyQueries) {
- this.simplifyQueries = simplifyQueries;
- }
-
- @Required
- public void setDisableIntersectingCrossCatalogQueries(boolean disableIntersectingCrossCatalogQueries) {
- this.disableIntersectingCrossCatalogQueries = disableIntersectingCrossCatalogQueries;
- }
-
- @Required
- public void setCrossCatalogResultSortingThreshold(
- int crossCatalogResultSortingThreshold) {
- this.crossCatalogResultSortingThreshold = crossCatalogResultSortingThreshold;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/term/Bucket.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/term/Bucket.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/term/Bucket.java
deleted file mode 100644
index 8f9b9af..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/term/Bucket.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.term;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A Bucket represents an ingestable or queriable group
- * <p>
- */
-public class Bucket {
-
- private String name;
-
- public Bucket() {
- this.name = "Default";
- }
-
- public Bucket(String name) {
- this.name = name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getName() {
- return this.name;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/term/Term.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/term/Term.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/term/Term.java
deleted file mode 100644
index 8670f58..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/term/Term.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.term;
-
-//JDK imports
-import java.util.Collections;
-import java.util.List;
-import java.util.Vector;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A ingestable or queriable item
- * <p>
- */
-public class Term implements Cloneable {
-
- protected String name;
- protected List<String> values;
- protected Type type;
- public enum Type {
- xml_boolean,
- xml_base64Binary,
- xml_hexBinary,
- xml_anyURI,
- xml_language,
- xml_normalizedString,
- xml_string,
- xml_token,
- xml_byte,
- xml_decimal,
- xml_double,
- xml_float,
- xml_int,
- xml_integer,
- xml_long,
- xml_negativeInteger,
- xml_nonNegativeInteger,
- xml_nonPositiveInteger,
- xml_positiveInteger,
- xml_short,
- xml_unsignedByte,
- xml_unsignedInt,
- xml_unsignedLong,
- xml_unsignedShort,
- xml_date,
- xml_dateTime,
- xml_duration,
- xml_gDay,
- xml_gMonth,
- xml_gMonthDay,
- xml_gYear,
- xml_gYearMonth,
- xml_time,
- xml_Name,
- xml_NCName,
- xml_NOTATION,
- xml_QName,
- xml_ENTITY,
- xml_ENTITIES,
- xml_ID,
- xml_IDREF,
- xml_IDREFS,
- xml_NMTOKEN,
- xml_NMTOKENS,
- xml_anyType,
- xml_anySimpleType
- }
-
- public Term() {
- this.type = Type.xml_string;
- this.values = Collections.emptyList();
- }
-
- public Term(String name) {
- this();
- this.name = name;
- }
-
- public Term(String name, List<String> values) {
- this(name);
- this.setValues(values);
- }
-
- public Term(String name, List<String> values, Type type) {
- this(name, values);
- if (type != null) {
- this.type = type;
- }
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public List<String> getValues() {
- return values;
- }
-
- public void setValues(List<String> values) {
- this.values = new Vector<String>(values);
- }
-
- public String getFirstValue() {
- String firstValue = null;
- if (this.values.size() > 0) {
- firstValue = this.values.get(0);
- }
- return firstValue;
- }
-
- public Type getType() {
- return type;
- }
-
- public void setType(Type type) {
- this.type = type;
- }
-
- @Override
- public int hashCode() {
- return this.name.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof Term) {
- Term compareToTerm = (Term) obj;
- return (this.name.equals(compareToTerm.name)
- && this.type.equals(compareToTerm.type)
- && this.values.containsAll(compareToTerm.values) && compareToTerm.values
- .containsAll(this.values));
- }else {
- return false;
- }
- }
-
- @Override
- public Term clone() {
- return new Term(this.name, this.values, this.type);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/term/TermBucket.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/term/TermBucket.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/term/TermBucket.java
deleted file mode 100644
index 513ebaa..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/term/TermBucket.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.term;
-
-//JDK imports
-import java.util.Collections;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.Vector;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A Bucket which has Terms attached to it
- * <p>
- */
-public class TermBucket extends Bucket {
-
- private ConcurrentHashMap<String, Term> terms;
-
- public TermBucket() {
- super();
- this.terms = new ConcurrentHashMap<String, Term>();
- }
-
- public TermBucket(String name) {
- super(name);
- this.terms = new ConcurrentHashMap<String, Term>();
- }
-
- public TermBucket(String name, Set<Term> terms) {
- this(name);
- this.setTerms(terms);
- }
-
- public void setTerms(Set<Term> terms) {
- if (terms != null) {
- this.terms = new ConcurrentHashMap<String, Term>();
- for (Term term : terms) {
- this.terms.put(term.name, term);
- }
- }
- }
-
- public void addTerms(Set<Term> terms) {
- this.addTerms(terms, false);
- }
-
- public void addTerms(Set<Term> terms, boolean replace) {
- if (replace) {
- for (Term term : terms) {
- this.terms.put(term.name, term);
- }
- }else {
- for (Term term : terms) {
- Term found = this.terms.get(term.name);
- if (found != null) {
- List<String> newTermValues = new Vector<String>();
- newTermValues.addAll(found.getValues());
- newTermValues.addAll(term.getValues());
- found.setValues(newTermValues);
- }else {
- this.terms.put(term.name, term);
- }
- }
- }
- }
-
- public void addTerm(Term term) {
- this.addTerms(Collections.singleton(term));
- }
-
- public void addTerm(Term term, boolean replace) {
- this.addTerms(Collections.singleton(term), replace);
- }
-
- public Set<Term> getTerms() {
- return Collections.unmodifiableSet(new HashSet<Term>(this.terms.values()));
- }
-
- public Term getTermByName(String termName) {
- return this.terms.get(termName);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/util/CasPropertyPlaceholderConfigurer.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/util/CasPropertyPlaceholderConfigurer.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/util/CasPropertyPlaceholderConfigurer.java
deleted file mode 100644
index 6ad2beb..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/util/CasPropertyPlaceholderConfigurer.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.util;
-
-//OODT imports
-
-import org.apache.oodt.cas.metadata.util.PathUtils;
-
-import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-//Spring imports
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>Describe your class here</p>.
- */
-public class CasPropertyPlaceholderConfigurer extends
- PropertyPlaceholderConfigurer {
-
- private static Logger LOG = Logger.getLogger(CasPropertyPlaceholderConfigurer.class.getName());
- @Override
- protected String convertPropertyValue(String value) {
- try {
- String defaultValue = null;
- String[] splitValue = value.split(";");
- if (splitValue.length == 2) {
- value = splitValue[0];
- defaultValue = splitValue[1];
- }
- String result = PathUtils.doDynamicReplacement(value);
- if (result.equals("null")) {
- return defaultValue;
- } else {
- return result;
- }
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- return value;
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/util/PluginClassLoader.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/util/PluginClassLoader.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/util/PluginClassLoader.java
deleted file mode 100644
index ac322f9..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/util/PluginClassLoader.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.util;
-
-//JDK imports
-import org.apache.oodt.cas.metadata.util.PathUtils;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.List;
-import java.util.Vector;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-//OODT imports
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>Java ClassLoader for loading plugin classes in Catalogs and QueryExpressions</p>.
- */
-public class PluginClassLoader extends URLClassLoader {
-
- private static final Logger LOG = Logger.getLogger(PluginClassLoader.class.getName());
-
- public PluginClassLoader() {
- super(getPluginURLs());
- }
-
- public PluginClassLoader(ClassLoader parent) {
- super(new URL[0], parent);
- }
-
- protected void addURL(PluginURL pluginURL) {
- super.addURL(pluginURL.getURL());
- }
-
- protected void addURLs(List<URL> urls) {
- for (URL url : urls) {
- this.addURL(url);
- }
- }
-
- public static URL[] getPluginURLs() {
- List<URL> urls = new Vector<URL>();
- try {
- String pluginDirs = System.getProperty("org.apache.oodt.cas.catalog.plugin.dirs");
- if (pluginDirs != null) {
- for (String pluginDir : PathUtils.doDynamicReplacement(pluginDirs).split(",")) {
- File[] jarFiles = new File(pluginDir).listFiles(new FileFilter() {
- public boolean accept(File pathname) {
- return pathname.getName().endsWith(".jar");
- }
- });
- if (jarFiles != null) {
- for (File jarFile : jarFiles) {
- try {
- urls.add(jarFile.toURL());
- } catch (Exception e) {
- LOG.log(Level.SEVERE, "Failed to load jar file '" + jarFile + "' : " + e.getMessage(), e);
- }
-
- }
- }
- }
- }
- }catch (Exception ignored) {}
- return urls.toArray(new URL[urls.size()]);
- }
-
- public Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
- try {
- Class<?> clazz = this.findLoadedClass(name);
- if (clazz == null) {
- clazz = this.findClass(name);
- }
- return clazz;
- }catch (Exception ignored) {}
- return super.loadClass(name, resolve);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/util/PluginURL.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/util/PluginURL.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/util/PluginURL.java
deleted file mode 100644
index 9f4d254..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/util/PluginURL.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.util;
-
-//JDK imports
-import java.net.URL;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>Plugin URL for transfering Jars to server side</p>.
- */
-public class PluginURL{
-
- protected String catalogId;
- protected URL url;
-
- public PluginURL(String catalogId, URL url) {
- this.catalogId = catalogId;
- this.url = url;
- }
-
- public String getCatalogId() {
- return this.catalogId;
- }
-
- public URL getURL() {
- return this.url;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/util/QueryUtils.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/util/QueryUtils.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/util/QueryUtils.java
deleted file mode 100644
index 9062ef2..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/util/QueryUtils.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.util;
-
-import org.apache.oodt.cas.catalog.metadata.TransactionalMetadata;
-import org.apache.oodt.cas.catalog.query.QueryExpression;
-import org.apache.oodt.cas.catalog.query.QueryLogicalGroup;
-import org.apache.oodt.cas.catalog.query.WrapperQueryExpression;
-import org.apache.oodt.cas.catalog.query.filter.QueryFilter;
-import org.apache.oodt.cas.catalog.query.parser.ParseException;
-import org.apache.oodt.cas.catalog.query.parser.QueryParser;
-import org.apache.oodt.cas.catalog.query.parser.TokenMgrError;
-
-import java.util.List;
-import java.util.Vector;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Utilities for helping filter query results
- * <p>
- */
-public class QueryUtils {
-
- public static List<TransactionalMetadata> filterMetadata(QueryFilter<?> queryFilter, List<TransactionalMetadata> metadataList) {
- return queryFilter.filterMetadataList(metadataList);
- }
-
- public static List<TransactionalMetadata> sort(List<TransactionalMetadata> metadataList, String sortByMetadataKey) {
- return null;
- }
-
- public static QueryExpression simplifyQuery(QueryExpression queryExpression) {
- return _simplifyQuery(queryExpression.clone());
- }
-
- /**
- * Might later be factored out into a Query Normalizer Interface . . . this method currently compacts AND(s).
- * @param queryExpression Query to be simplified
- * @return simplified query
- */
- private static QueryExpression _simplifyQuery(QueryExpression queryExpression) {
- if (queryExpression instanceof QueryLogicalGroup) {
- QueryLogicalGroup.Operator operator = ((QueryLogicalGroup) queryExpression).getOperator();
- boolean changed;
- do {
- changed = false;
- Vector<QueryExpression> children = new Vector<QueryExpression>();
- for (QueryExpression qe : ((QueryLogicalGroup) queryExpression).getExpressions()) {
- if (qe instanceof QueryLogicalGroup && ((QueryLogicalGroup) qe).getOperator().equals(operator)) {
- children.addAll(((QueryLogicalGroup) qe).getExpressions());
- changed = true;
- }else {
- children.add(qe);
- }
- }
- ((QueryLogicalGroup) queryExpression).setExpressions(children);
- }while(changed);
- }else if (queryExpression instanceof WrapperQueryExpression) {
- ((WrapperQueryExpression) queryExpression).setQueryExpression(((WrapperQueryExpression) queryExpression).getQueryExpression());
- }
- return queryExpression;
- }
-
- public static void main(String[] args) throws ParseException, TokenMgrError {
- QueryExpression qe = QueryParser.parseQueryExpression("{bucketNames = 'joe,tim' ; Name == 'Tim,Joe' AND City == 'Upland' AND State == 'CA'}");
- System.out.println(qe.toString());
- System.out.println(simplifyQuery(qe).toString());
- System.out.println("");
- qe = QueryParser.parseQueryExpression("Name == 'Tim,Joe' AND (City == 'Upland' AND State == 'CA')");
- System.out.println(qe.toString());
- System.out.println(simplifyQuery(qe).toString());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/util/Serializer.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/util/Serializer.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/util/Serializer.java
deleted file mode 100644
index 5b29db2..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/util/Serializer.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.util;
-
-//JDK imports
-import java.io.InputStream;
-import java.io.OutputStream;
-
-//XStream imports
-import com.thoughtworks.xstream.XStream;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- */
-public class Serializer {
-
- protected ClassLoader classLoader;
- protected boolean usePluginUrls;
-
- public Serializer() {
- this(true);
- }
-
- public Serializer(boolean usePluginUrls) {
- this.usePluginUrls = usePluginUrls;
- this.refreshClassLoader();
- }
-
- public void refreshClassLoader() {
- if (usePluginUrls) {
- this.classLoader = new PluginClassLoader();
- } else {
- this.classLoader = Serializer.class.getClassLoader();
- }
- }
-
- public void setUsePluginUrls(boolean usePluginUrls) {
- this.usePluginUrls = usePluginUrls;
- }
-
- public ClassLoader getClassLoader() {
- return classLoader;
- }
-
- /**
- * Serializes any java object into a java Serializable String
- * @param <T> Object type to be serialized
- * @param object The Object of type <T> to be serialized
- * @return A String for of the object arg
- */
- public <T> String serializeObject(T object) {
- XStream xStream = new XStream();
- return xStream.toXML(object);
- }
-
- public <T> void serializeObject(T object, OutputStream outStream) {
- XStream xStream = new XStream();
- xStream.toXML(object, outStream);
- }
-
- /**
- * Deserializes any object that has been serialized by the serializedObject(T) method
- * @param <T> Type of Object that was originally serialized
- * @param clazz The class object representation of the object type
- * @param xmlObject The String for of the object to be deserialized
- * @return The deserialized object
- * @throws ClassNotFoundException
- * @throws InstantiationException
- * @throws IllegalAccessException
- */
- public <T> T deserializeObject(Class<T> clazz, String xmlObject) {
- XStream xStream = new XStream();
- xStream.setClassLoader(getClassLoader());
- return (T) xStream.fromXML(xmlObject);
- }
-
- public <T> T deserializeObject(Class<T> clazz, InputStream inStream) {
- XStream xStream = new XStream();
- xStream.setClassLoader(getClassLoader());
- return (T) xStream.fromXML(inStream);
- }
-
-}
[26/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/util/SpringUtils.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/util/SpringUtils.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/util/SpringUtils.java
deleted file mode 100644
index 61bf00b..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/util/SpringUtils.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.util;
-
-import org.apache.oodt.cas.catalog.exception.CatalogException;
-import org.apache.oodt.cas.catalog.system.Catalog;
-import org.springframework.context.support.FileSystemXmlApplicationContext;
-
-import java.util.HashSet;
-import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- */
-public class SpringUtils {
-
- private static Logger LOG = Logger.getLogger(SpringUtils.class.getName());
-
- public static HashSet<Catalog> loadCatalogs(String catalogBeanRepo) throws CatalogException {
- FileSystemXmlApplicationContext appContext = new FileSystemXmlApplicationContext(catalogBeanRepo);
- Map<String, Catalog> catalogsMap = appContext.getBeansOfType(Catalog.class);
- HashSet<Catalog> catalogs = new HashSet<Catalog>();
- for (Map.Entry<String, Catalog> key : catalogsMap.entrySet()) {
- Catalog curCatalog = key.getValue();
- LOG.log(Level.INFO, "Loading catalog configuration for Catalog: '" + curCatalog + "'");
- if (catalogs.contains(curCatalog)) {
- throw new CatalogException("Catalog URN : '" + curCatalog + "' conflicts with another Catalog's URN. "
- + "**NOTE: URNs are created based on the following rule: urn:<namespace>:<id or name (if set)>");
- }
- catalogs.add(curCatalog);
- }
- return catalogs;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/resources/REMOVE.log
----------------------------------------------------------------------
diff --git a/catalog/src/main/resources/REMOVE.log b/catalog/src/main/resources/REMOVE.log
deleted file mode 100644
index 4f706a1..0000000
--- a/catalog/src/main/resources/REMOVE.log
+++ /dev/null
@@ -1,19 +0,0 @@
-###########################################################################
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-###########################################################################
-
-You can remove this file. It was only included to ensure that the log directory for this
-distribution was created on assembly.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/resources/logging.properties
----------------------------------------------------------------------
diff --git a/catalog/src/main/resources/logging.properties b/catalog/src/main/resources/logging.properties
deleted file mode 100644
index 678a422..0000000
--- a/catalog/src/main/resources/logging.properties
+++ /dev/null
@@ -1,56 +0,0 @@
-###########################################################################
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-###########################################################################
-
-# Specify the handlers to create in the root logger
-# (all loggers are children of the root logger)
-# The following creates two handlers
-handlers = java.util.logging.ConsoleHandler, java.util.logging.FileHandler
-
-# Set the default logging level for the root logger
-.level = ALL
-
-# Set the default logging level for new ConsoleHandler instances
-java.util.logging.ConsoleHandler.level = ALL
-java.util.logging.FileHandler.level = ALL
-
-# Set the default formatter for new ConsoleHandler instances
-java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
-
-# default file output is in user's home directory.
-java.util.logging.FileHandler.pattern = ../logs/cas_catalog%g.log
-java.util.logging.FileHandler.limit = 50000
-java.util.logging.FileHandler.count = 5
-java.util.logging.FileHandler.append = true
-java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
-
-# control the underlying commons-httpclient transport layer for xmlrpc
-org.apache.commons.httpclient.level = INFO
-httpclient.wire.header.level = INFO
-httpclient.wire.level = INFO
-
-# airs dom loggin
-sun.rmi.level = INFO
-
-# spring framework logging
-org.springframework.beans.level = SEVERE
-org.springframework.core.level = SEVERE
-org.springframework.level = SEVERE
-org.springframework.beans.factory.level = SEVERE
-org.springframework.beans.factory.config.level = SEVERE
-org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.level = SEVERE
-org.apache.oodt.cas.crawl.util.CasPropertyPlaceholderConfigurer.level = SEVERE
-sun.net.level = SEVERE
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/resources/oracle/create-transaction-id-map-table.sql
----------------------------------------------------------------------
diff --git a/catalog/src/main/resources/oracle/create-transaction-id-map-table.sql b/catalog/src/main/resources/oracle/create-transaction-id-map-table.sql
deleted file mode 100644
index b5f0181..0000000
--- a/catalog/src/main/resources/oracle/create-transaction-id-map-table.sql
+++ /dev/null
@@ -1,29 +0,0 @@
- -- Licensed to the Apache Software Foundation (ASF) under one or more
- -- contributor license agreements. See the NOTICE file distributed with
- -- this work for additional information regarding copyright ownership.
- -- The ASF licenses this file to You under the Apache License, Version 2.0
- -- (the "License"); you may not use this file except in compliance with
- -- the License. You may obtain a copy of the License at
- --
- -- http://www.apache.org/licenses/LICENSE-2.0
- --
- -- Unless required by applicable law or agreed to in writing, software
- -- distributed under the License is distributed on an "AS IS" BASIS,
- -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- -- See the License for the specific language governing permissions and
- -- limitations under the License.
-
-CREATE TABLE CatalogServiceMapper (
- CAT_SERV_TRANS_ID VARCHAR2(255) NOT NULL ,
- CAT_SERV_TRANS_FACTORY VARCHAR2(255) NOT NULL ,
- CAT_TRANS_ID VARCHAR2(255) NOT NULL ,
- CAT_TRANS_FACTORY VARCHAR2(255) NOT NULL ,
- CAT_TRANS_DATE VARCHAR2(255) NOT NULL ,
- CATALOG_ID VARCHAR2(255) NOT NULL
-);
-
-CREATE INDEX CatalogServiceMapper_CSTId_idx ON CatalogServiceMapper(CAT_SERV_TRANS_ID);
-CREATE INDEX CatalogServiceMapper_CTId_idx ON CatalogServiceMapper(CAT_TRANS_ID);
-CREATE INDEX CatalogServiceMapper_CatId_idx ON CatalogServiceMapper(CATALOG_ID);
-
-EXIT;
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/resources/oracle/create-transaction-index-table.sql
----------------------------------------------------------------------
diff --git a/catalog/src/main/resources/oracle/create-transaction-index-table.sql b/catalog/src/main/resources/oracle/create-transaction-index-table.sql
deleted file mode 100644
index d89271d..0000000
--- a/catalog/src/main/resources/oracle/create-transaction-index-table.sql
+++ /dev/null
@@ -1,31 +0,0 @@
- -- Licensed to the Apache Software Foundation (ASF) under one or more
- -- contributor license agreements. See the NOTICE file distributed with
- -- this work for additional information regarding copyright ownership.
- -- The ASF licenses this file to You under the Apache License, Version 2.0
- -- (the "License"); you may not use this file except in compliance with
- -- the License. You may obtain a copy of the License at
- --
- -- http://www.apache.org/licenses/LICENSE-2.0
- --
- -- Unless required by applicable law or agreed to in writing, software
- -- distributed under the License is distributed on an "AS IS" BASIS,
- -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- -- See the License for the specific language governing permissions and
- -- limitations under the License.
-
-CREATE TABLE transactions
-(
- transaction_id varchar2(256) NOT NULL,
- transaction_date varchar2(256) NOT NULL
-);
-
-CREATE TABLE transaction_terms
-(
- transaction_id varchar2(256) NOT NULL,
- bucket_name varchar2(256) NOT NULL,
- term_name varchar2(256) NOT NULL,
- term_value varchar2(1000) NOT NULL
-);
-
-CREATE INDEX transactions_transid_idx ON transactions(transaction_id);
-CREATE INDEX transaction_terms_transid_idx ON transaction_terms(transaction_id);
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/resources/policy/catserv-beans.xml
----------------------------------------------------------------------
diff --git a/catalog/src/main/resources/policy/catserv-beans.xml b/catalog/src/main/resources/policy/catserv-beans.xml
deleted file mode 100644
index da9a6e0..0000000
--- a/catalog/src/main/resources/policy/catserv-beans.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
- <bean class="org.apache.oodt.commons.spring.postprocessor.SetIdBeanPostProcessor" />
-
- <!-- Catalog Services -->
- <bean id="CatalogServiceLocalFactory" lazy-init="true" class="org.apache.oodt.cas.catalog.system.impl.CatalogServiceLocalFactory">
- <property name="transactionIdFactory" value="org.apache.oodt.cas.catalog.struct.impl.transaction.UuidTransactionIdFactory" />
- <property name="catalogRepositoryFactory" ref="SerializedCatalogRepositoryFactory" />
- <property name="ingestMapperFactory" ref="InMemoryIngestMapperFactory" />
- <property name="pluginStorageDir" value="${pcs.support.home}/cas-catalog/plugin-jars/" />
- <property name="restrictQueryPermissions" value="false" />
- <property name="restrictIngestPermissions" value="false" />
- <property name="oneCatalogFailsAllFail" value="true" />
- <property name="simplifyQueries" value="true" />
- <property name="disableIntersectingCrossCatalogQueries" value="false" />
- <property name="crossCatalogResultSortingThreshold" value="200" />
- </bean>
-
- <!-- Communication Channels -->
- <bean id="XmlRpcServerFactory" lazy-init="true" class="org.apache.oodt.cas.catalog.server.channel.xmlrpc.XmlRpcCommunicationChannelServerFactory">
- <property name="port" value="${catalog.port}" />
- <property name="catalogServiceFactory" ref="CatalogServiceLocalFactory" />
- </bean>
-
- <!-- Catalog Repositories -->
- <bean id="SpringCatalogRepositoryFactory" lazy-init="true" class="org.apache.oodt.cas.catalog.repository.SpringCatalogRepositoryFactory">
- <property name="catalogBeanRepo" value="${catalog.home}/policy/filemgr-catalog-beans.xml" />
- </bean>
- <bean id="WorkflowManagerRepositoryFactory" lazy-init="true" class="org.apache.oodt.cas.catalog.repository.SpringCatalogRepositoryFactory">
- <property name="catalogBeanRepo" value="${catalog.home}/policy/workflow-manager-beans.xml" />
- </bean>
- <bean id="SerializedCatalogRepositoryFactory" lazy-init="true" class="org.apache.oodt.cas.catalog.repository.SerializedCatalogRepositoryFactory">
- <property name="storageDir" value="${pcs.support.home}/cas-catalog/catalog-repo" />
- </bean>
-
- <!-- Mapper Indexes -->
- <bean id="DataSourceIngestMapperFactory" lazy-init="true" class="org.apache.oodt.cas.catalog.mapping.DataSourceIngestMapperFactory">
- <property name="jdbcUrl" value="jdbc:oracle:thin:@dew.jpl.nasa.gov:1521:npptest" />
- <property name="user" value="sa" />
- <property name="pass" value="" />
- <property name="driver" value="oracle.jdbc.driver.OracleDriver" />
- </bean>
- <bean id="InMemoryIngestMapperFactory" lazy-init="true" class="org.apache.oodt.cas.catalog.mapping.InMemoryIngestMapperFactory">
- <property name="jdbcUrl" value="jdbc:hsqldb:file:${pcs.support.home}/hsqldb;shutdown=true" />
- <property name="user" value="sa" />
- <property name="pass" value="" />
- <property name="driver" value="org.hsqldb.jdbcDriver" />
- <property name="tablesFile" value="${catalog.home}/policy/in-memory-ingest-mapper.sql" />
- </bean>
- <bean id="MemoryBasedIngestMapperFactory" lazy-init="true" class="org.apache.oodt.cas.catalog.mapping.MemoryBasedIngestMapperFactory" />
-
-</beans>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/resources/policy/catserv-client-action-beans.xml
----------------------------------------------------------------------
diff --git a/catalog/src/main/resources/policy/catserv-client-action-beans.xml b/catalog/src/main/resources/policy/catserv-client-action-beans.xml
deleted file mode 100644
index bd767d5..0000000
--- a/catalog/src/main/resources/policy/catserv-client-action-beans.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:p="http://www.springframework.org/schema/p"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
- <bean class="org.apache.oodt.commons.spring.postprocessor.SetIdBeanPostProcessor"/>
-
- <bean id="shutdown" class="org.apache.oodt.cas.catalog.server.action.ShutdownServerAction">
- <property name="description" value="Shuts down the server for which the given client connects"/>
- </bean>
- <bean id="query_all" class="org.apache.oodt.cas.catalog.server.action.QueryServerAction">
- <property name="description" value="Performs a un-paged query to the server which the given client connects"/>
- </bean>
- <bean id="reduced_query_all" class="org.apache.oodt.cas.catalog.server.action.ReducedQueryServerAction">
- <property name="description" value="Performs a un-paged query to the server which the given client connects"/>
- </bean>
- <bean id="query_paged" class="org.apache.oodt.cas.catalog.server.action.PagedQueryServerAction">
- <property name="description" value="Performs a paged query to the server which the given client connects"/>
- </bean>
- <bean id="reduced_query_paged" class="org.apache.oodt.cas.catalog.server.action.ReducedPagedQueryServerAction">
- <property name="description" value="Performs a paged query to the server which the given client connects"/>
- </bean>
- <bean id="load_catalogs" class="org.apache.oodt.cas.catalog.server.action.LoadCatalogsServerAction">
- <property name="description" value="Loads the catalogs from the given spring xml file into the server for which the given client connects"/>
- </bean>
- <bean id="load_catalog_repo" class="org.apache.oodt.cas.catalog.server.action.LoadCatalogRepositoryServerAction">
- <property name="description" value="Loads the catalogs from the given repository from the given spring xml file into the server for which the given client connects"/>
- </bean>
- <bean id="get_catalog_ids" class="org.apache.oodt.cas.catalog.server.action.GetSupportedCatalogIds">
- <property name="description" value="Gets a list of supported catalog ids from the server which the given client connects"/>
- </bean>
-
-</beans>
-
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/resources/policy/catserv-client-cmd-line-beans.xml
----------------------------------------------------------------------
diff --git a/catalog/src/main/resources/policy/catserv-client-cmd-line-beans.xml b/catalog/src/main/resources/policy/catserv-client-cmd-line-beans.xml
deleted file mode 100644
index a07f191..0000000
--- a/catalog/src/main/resources/policy/catserv-client-cmd-line-beans.xml
+++ /dev/null
@@ -1,302 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:p="http://www.springframework.org/schema/p"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
- <bean class="org.apache.oodt.commons.spring.postprocessor.SetIdBeanPostProcessor"/>
-
- <!-- CAS-Catalog Cmd-Line-Options -->
- <bean id="action" class="org.apache.oodt.commons.option.CmdLineOption">
- <property name="shortOption" value="a"/>
- <property name="longOption" value="action"/>
- <property name="description" value="The CatalogService Action Bean to run"/>
- <property name="hasArgs" value="true"/>
- <property name="optionArgName" value="bean id"/>
- <property name="required" value="true"/>
- </bean>
-
- <bean id="clientFactoryBeanId" class="org.apache.oodt.commons.option.CmdLineOption">
- <property name="shortOption" value="cfb"/>
- <property name="longOption" value="clientFactoryBeanId"/>
- <property name="description" value="CatalogServiceClientFactory Bean Id"/>
- <property name="hasArgs" value="true"/>
- <property name="optionArgName" value="bean id"/>
- <property name="required" value="true"/>
- </bean>
-
- <bean id="query" class="org.apache.oodt.commons.option.CmdLineOption">
- <property name="shortOption" value="q"/>
- <property name="longOption" value="query"/>
- <property name="description" value="CatalogService String Query"/>
- <property name="hasArgs" value="true"/>
- <property name="optionArgName" value="query"/>
- <property name="requiredOptions">
- <list>
- <bean class="org.apache.oodt.commons.option.required.RequiredOption">
- <property name="optionLongName" value="action"/>
- <property name="requireAllValues" value="false"/>
- <property name="optionValues">
- <list>
- <value>query_all</value>
- <value>reduced_query_all</value>
- <value>query_paged</value>
- <value>reduced_query_paged</value>
- </list>
- </property>
- </bean>
- </list>
- </property>
- <property name="handler">
- <bean class="org.apache.oodt.commons.option.handler.CmdLineOptionBeanHandler">
- <property name="applyToBeans">
- <list>
- <bean class="org.apache.oodt.commons.option.handler.BeanInfo"
- p:bean-ref="query_all"/>
- <bean class="org.apache.oodt.commons.option.handler.BeanInfo"
- p:bean-ref="reduced_query_all"/>
- <bean class="org.apache.oodt.commons.option.handler.BeanInfo"
- p:bean-ref="query_paged"/>
- <bean class="org.apache.oodt.commons.option.handler.BeanInfo"
- p:bean-ref="reduced_query_paged"/>
- </list>
- </property>
- </bean>
- </property>
- </bean>
-
- <bean id="pageSize" class="org.apache.oodt.commons.option.CmdLineOption">
- <property name="shortOption" value="ps"/>
- <property name="longOption" value="pageSize"/>
- <property name="description" value="Paged Query PageSize"/>
- <property name="hasArgs" value="true"/>
- <property name="optionArgName" value="integer"/>
- <property name="type" value="int"/>
- <property name="requiredOptions">
- <list>
- <bean class="org.apache.oodt.commons.option.required.RequiredOption">
- <property name="optionLongName" value="action"/>
- <property name="requireAllValues" value="false"/>
- <property name="optionValues">
- <list>
- <value>query_paged</value>
- <value>reduced_query_paged</value>
- </list>
- </property>
- </bean>
- </list>
- </property>
- <property name="handler">
- <bean class="org.apache.oodt.commons.option.handler.CmdLineOptionBeanHandler">
- <property name="applyToBeans">
- <list>
- <bean class="org.apache.oodt.commons.option.handler.BeanInfo"
- p:bean-ref="query_paged"/>
- <bean class="org.apache.oodt.commons.option.handler.BeanInfo"
- p:bean-ref="reduced_query_paged"/>
- </list>
- </property>
- </bean>
- </property>
- </bean>
-
- <bean id="pageNum" class="org.apache.oodt.commons.option.CmdLineOption">
- <property name="shortOption" value="pn"/>
- <property name="longOption" value="pageNum"/>
- <property name="description" value="Paged Query PageNum"/>
- <property name="hasArgs" value="true"/>
- <property name="optionArgName" value="integer"/>
- <property name="type" value="int"/>
- <property name="requiredOptions">
- <list>
- <bean class="org.apache.oodt.commons.option.required.RequiredOption">
- <property name="optionLongName" value="action"/>
- <property name="requireAllValues" value="false"/>
- <property name="optionValues">
- <list>
- <value>query_paged</value>
- <value>reduced_query_paged</value>
- </list>
- </property>
- </bean>
- </list>
- </property>
- <property name="handler">
- <bean class="org.apache.oodt.commons.option.handler.CmdLineOptionBeanHandler">
- <property name="applyToBeans">
- <list>
- <bean class="org.apache.oodt.commons.option.handler.BeanInfo"
- p:bean-ref="query_paged"/>
- <bean class="org.apache.oodt.commons.option.handler.BeanInfo"
- p:bean-ref="reduced_query_paged"/>
- </list>
- </property>
- </bean>
- </property>
- </bean>
-
- <bean id="reducedTerms" class="org.apache.oodt.commons.option.CmdLineOption">
- <property name="shortOption" value="rt"/>
- <property name="longOption" value="reducedTerms"/>
- <property name="description" value="Term filter for query results"/>
- <property name="hasArgs" value="true"/>
- <property name="optionArgName" value="list"/>
- <property name="type" value="java.util.List"/>
- <property name="requiredOptions">
- <list>
- <bean class="org.apache.oodt.commons.option.required.RequiredOption">
- <property name="optionLongName" value="action"/>
- <property name="requireAllValues" value="false"/>
- <property name="optionValues">
- <list>
- <value>reduced_query_all</value>
- <value>reduced_query_paged</value>
- </list>
- </property>
- </bean>
- </list>
- </property>
- <property name="handler">
- <bean class="org.apache.oodt.commons.option.handler.CmdLineOptionBeanHandler">
- <property name="applyToBeans">
- <list>
- <bean class="org.apache.oodt.commons.option.handler.BeanInfo"
- p:bean-ref="reduced_query_all"/>
- <bean class="org.apache.oodt.commons.option.handler.BeanInfo"
- p:bean-ref="reduced_query_paged"/>
- </list>
- </property>
- </bean>
- </property>
- </bean>
-
- <bean id="beanId" class="org.apache.oodt.commons.option.CmdLineOption">
- <property name="shortOption" value="bid"/>
- <property name="longOption" value="beanId"/>
- <property name="description" value="Spring Bean Id"/>
- <property name="hasArgs" value="true"/>
- <property name="optionArgName" value="bean id"/>
- <property name="requiredOptions">
- <list>
- <bean class="org.apache.oodt.commons.option.required.RequiredOption">
- <property name="optionLongName" value="action"/>
- <property name="requireAllValues" value="false"/>
- <property name="optionValues">
- <list>
- <value>load_catalog_repo</value>
- </list>
- </property>
- </bean>
- </list>
- </property>
- <property name="handler">
- <bean class="org.apache.oodt.commons.option.handler.CmdLineOptionBeanHandler">
- <property name="applyToBeans">
- <list>
- <bean class="org.apache.oodt.commons.option.handler.BeanInfo" p:bean-ref="load_catalog_repo"/>
- </list>
- </property>
- </bean>
- </property>
- </bean>
-
- <bean id="catalogIds" class="org.apache.oodt.commons.option.CmdLineOption">
- <property name="shortOption" value="cid"/>
- <property name="longOption" value="catalogIds"/>
- <property name="description" value="List of Catalog IDs to query"/>
- <property name="hasArgs" value="true"/>
- <property name="optionArgName" value="catalog ids"/>
- <property name="type" value="java.util.List"/>
- <property name="handler">
- <bean class="org.apache.oodt.commons.option.handler.CmdLineOptionBeanHandler">
- <property name="applyToBeans">
- <list>
- <bean class="org.apache.oodt.commons.option.handler.BeanInfo" p:bean-ref="query_all"/>
- <bean class="org.apache.oodt.commons.option.handler.BeanInfo" p:bean-ref="reduced_query_all"/>
- <bean class="org.apache.oodt.commons.option.handler.BeanInfo" p:bean-ref="query_paged"/>
- <bean class="org.apache.oodt.commons.option.handler.BeanInfo" p:bean-ref="reduced_query_paged"/>
- </list>
- </property>
- </bean>
- </property>
- </bean>
-
- <bean id="beanRepo" class="org.apache.oodt.commons.option.CmdLineOption">
- <property name="shortOption" value="br"/>
- <property name="longOption" value="beanRepo"/>
- <property name="description" value="Spring Bean XML File"/>
- <property name="hasArgs" value="true"/>
- <property name="optionArgName" value="file path"/>
- <property name="requiredOptions">
- <list>
- <bean class="org.apache.oodt.commons.option.required.RequiredOption">
- <property name="optionLongName" value="action"/>
- <property name="requireAllValues" value="false"/>
- <property name="optionValues">
- <list>
- <value>load_catalogs</value>
- <value>load_catalog_repo</value>
- </list>
- </property>
- </bean>
- </list>
- </property>
- <property name="handler">
- <bean class="org.apache.oodt.commons.option.handler.CmdLineOptionBeanHandler">
- <property name="applyToBeans">
- <list>
- <bean class="org.apache.oodt.commons.option.handler.BeanInfo" p:bean-ref="load_catalogs"/>
- <bean class="org.apache.oodt.commons.option.handler.BeanInfo" p:bean-ref="load_catalog_repo"/>
- </list>
- </property>
- </bean>
- </property>
- </bean>
-
- <bean id="printSupportedActions" class="org.apache.oodt.commons.option.CmdLineOption">
- <property name="shortOption" value="psa"/>
- <property name="longOption" value="printSupportedActions"/>
- <property name="description" value="Prints a list and description of all supported CatalogServiceServerActions"/>
- <property name="hasArgs" value="false"/>
- <property name="required" value="false"/>
- <property name="performAndQuit" value="true"/>
- <property name="handler">
- <bean class="org.apache.oodt.cas.catalog.server.option.PrintSupportedActionsHandler">
- <property name="beanRepo" value="/${catalog.home}/policy/catserv-client-config.xml"/>
- </bean>
- </property>
- </bean>
-
- <bean id="printSupportedClients" class="org.apache.oodt.commons.option.CmdLineOption">
- <property name="shortOption" value="psc"/>
- <property name="longOption" value="printSupportedClients"/>
- <property name="description" value="Prints a list and description of all supported CatalogServiceClientFactories"/>
- <property name="hasArgs" value="false"/>
- <property name="required" value="false"/>
- <property name="performAndQuit" value="true"/>
- <property name="handler">
- <bean class="org.apache.oodt.cas.catalog.server.option.PrintSupportedClientsHandler">
- <property name="beanRepo" value="/${catalog.home}/policy/catserv-client-config.xml"/>
- </bean>
- </property>
- </bean>
-
-</beans>
-
-
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/resources/policy/catserv-client-config.xml
----------------------------------------------------------------------
diff --git a/catalog/src/main/resources/policy/catserv-client-config.xml b/catalog/src/main/resources/policy/catserv-client-config.xml
deleted file mode 100644
index af0281a..0000000
--- a/catalog/src/main/resources/policy/catserv-client-config.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:p="http://www.springframework.org/schema/p"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
- <import resource="catserv-properties.xml"/>
- <import resource="catserv-beans.xml"/>
- <import resource="catserv-client-action-beans.xml"/>
- <import resource="catserv-client-cmd-line-beans.xml"/>
-
-</beans>
-
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/resources/policy/catserv-properties.xml
----------------------------------------------------------------------
diff --git a/catalog/src/main/resources/policy/catserv-properties.xml b/catalog/src/main/resources/policy/catserv-properties.xml
deleted file mode 100644
index a6b625c..0000000
--- a/catalog/src/main/resources/policy/catserv-properties.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:p="http://www.springframework.org/schema/p"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
- <bean class="org.apache.oodt.cas.catalog.util.CasPropertyPlaceholderConfigurer">
-
- <!-- Allow for system-level properties to override all properties below -->
- <property name="systemPropertiesMode" value="2"/>
-
- <!-- Properties -->
- <property name="properties">
- <props>
- <prop key="catalog.url">[CATALOG_URL];http://localhost:10000</prop>
- <prop key="catalog.port">[CATALOG_PORT];10000</prop>
- <prop key="pcs.support.home">[PCS_SUPPORT_HOME];/tmp</prop>
- <!--prop key="filemgr.home">[FILEMGR_HOME];/tmp</prop-->
- <prop key="workflowmgr.home">[WORKFLOWMGR_HOME];/tmp</prop>
- <prop key="catalog.home">[CATALOG_HOME];/tmp</prop>
- </props>
- </property>
-
- </bean>
-
-</beans>
-
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/resources/policy/catserv-server-cmd-line-beans.xml
----------------------------------------------------------------------
diff --git a/catalog/src/main/resources/policy/catserv-server-cmd-line-beans.xml b/catalog/src/main/resources/policy/catserv-server-cmd-line-beans.xml
deleted file mode 100644
index dd27395..0000000
--- a/catalog/src/main/resources/policy/catserv-server-cmd-line-beans.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:p="http://www.springframework.org/schema/p"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
- <bean class="org.apache.oodt.commons.spring.postprocessor.SetIdBeanPostProcessor"/>
-
- <!-- CAS-Catalog Cmd-Line-Options -->
- <bean id="serverFactoryBeanId" class="org.apache.oodt.commons.option.CmdLineOption">
- <property name="shortOption" value="sfb"/>
- <property name="longOption" value="serverFactoryBeanId"/>
- <property name="description" value="CommunicationChannelServerFactory Bean Id"/>
- <property name="hasArgs" value="true"/>
- <property name="optionArgName" value="bean id"/>
- <property name="required" value="true"/>
- </bean>
-
- <bean id="printSupportedServers" class="org.apache.oodt.commons.option.CmdLineOption">
- <property name="shortOption" value="pss"/>
- <property name="longOption" value="printSupportedServers"/>
- <property name="description" value="Prints a list and description of all supported CommunicationChannelServerFactories"/>
- <property name="hasArgs" value="false"/>
- <property name="required" value="false"/>
- <property name="performAndQuit" value="true"/>
- <property name="handler">
- <bean class="org.apache.oodt.cas.catalog.server.option.PrintSupportedServersHandler">
- <property name="beanRepo" value="/${catalog.home}/policy/catserv-server-config.xml"/>
- </bean>
- </property>
- </bean>
-
-</beans>
-
-
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/resources/policy/catserv-server-config.xml
----------------------------------------------------------------------
diff --git a/catalog/src/main/resources/policy/catserv-server-config.xml b/catalog/src/main/resources/policy/catserv-server-config.xml
deleted file mode 100644
index c7f9292..0000000
--- a/catalog/src/main/resources/policy/catserv-server-config.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:p="http://www.springframework.org/schema/p"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
- <import resource="catserv-properties.xml"/>
- <import resource="catserv-beans.xml"/>
- <import resource="catserv-server-cmd-line-beans.xml"/>
-
-</beans>
-
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/resources/policy/cmd-line-actions.xml
----------------------------------------------------------------------
diff --git a/catalog/src/main/resources/policy/cmd-line-actions.xml b/catalog/src/main/resources/policy/cmd-line-actions.xml
deleted file mode 100644
index 0316f88..0000000
--- a/catalog/src/main/resources/policy/cmd-line-actions.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:p="http://www.springframework.org/schema/p"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
- <bean class="org.apache.oodt.commons.spring.postprocessor.SetIdBeanPostProcessor" />
-
- <!-- Command Line Actions -->
- <bean id="shutdown" class="org.apache.oodt.cas.catalog.cli.action.ShutdownCliAction">
- <property name="description" value="Shuts down the server for which the given client connects" />
- </bean>
- <bean id="query_all" class="org.apache.oodt.cas.catalog.cli.action.QueryCliAction">
- <property name="description" value="Performs a un-paged query to the server which the given client connects" />
- </bean>
- <bean id="reduced_query_all" class="org.apache.oodt.cas.catalog.cli.action.ReducedQueryCliAction">
- <property name="description" value="Performs a un-paged query to the server which the given client connects" />
- </bean>
- <bean id="query_paged" class="org.apache.oodt.cas.catalog.cli.action.PagedQueryCliAction">
- <property name="description" value="Performs a paged query to the server which the given client connects" />
- </bean>
- <bean id="reduced_query_paged" class="org.apache.oodt.cas.catalog.cli.action.ReducedPagedQueryCliAction">
- <property name="description" value="Performs a paged query to the server which the given client connects" />
- </bean>
- <bean id="load_catalogs" class="org.apache.oodt.cas.catalog.cli.action.LoadCatalogsCliAction">
- <property name="description" value="Loads the catalogs from the given spring xml file into the server for which the given client connects" />
- </bean>
- <bean id="load_catalog_repo" class="org.apache.oodt.cas.catalog.cli.action.LoadCatalogRepositoryCliAction">
- <property name="description" value="Loads the catalogs from the given repository from the given spring xml file into the server for which the given client connects" />
- </bean>
- <bean id="get_catalog_ids" class="org.apache.oodt.cas.catalog.cli.action.GetSupportedCatalogIdsCliAction">
- <property name="description" value="Gets a list of supported catalog ids from the server which the given client connects" />
- </bean>
-
-</beans>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/resources/policy/cmd-line-options.xml
----------------------------------------------------------------------
diff --git a/catalog/src/main/resources/policy/cmd-line-options.xml b/catalog/src/main/resources/policy/cmd-line-options.xml
deleted file mode 100644
index 28253ee..0000000
--- a/catalog/src/main/resources/policy/cmd-line-options.xml
+++ /dev/null
@@ -1,317 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:p="http://www.springframework.org/schema/p"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
- <bean id="url" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
- <property name="shortOption" value="u" />
- <property name="longOption" value="url" />
- <property name="description" value="Server URL" />
- <property name="hasArgs" value="true" />
- <property name="argsDescription" value="url" />
- <property name="required" value="true" />
- <property name="handler">
- <bean class="org.apache.oodt.cas.cli.option.handler.SetJavaPropertiesHandler">
- <property name="propertyNames">
- <list>
- <value>org.apache.oodt.cas.catalog.url</value>
- </list>
- </property>
- </bean>
- </property>
- <property name="validators">
- <list>
- <bean class="org.apache.oodt.cas.cli.option.validator.ArgRegExpCmdLineOptionValidator">
- <property name="allowedArgs">
- <list>
- <value>http://.*:\d*</value>
- </list>
- </property>
- </bean>
- </list>
- </property>
- </bean>
-
- <bean id="chunkSize" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
- <property name="shortOption" value="cs" />
- <property name="longOption" value="chunkSize" />
- <property name="description" value="XML-RPC data chunk size in bytes" />
- <property name="hasArgs" value="true" />
- <property name="argsDescription" value="int" />
- <property name="required" value="false" />
- <property name="handler">
- <bean class="org.apache.oodt.cas.cli.option.handler.SetJavaPropertiesHandler">
- <property name="propertyNames">
- <list>
- <value>org.apache.oodt.cas.catalog.chunkSize</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
-
- <bean id="requestTimeout" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
- <property name="shortOption" value="rqt" />
- <property name="longOption" value="requestTimeout" />
- <property name="description" value="XML-RPC request timeout in seconds" />
- <property name="hasArgs" value="true" />
- <property name="argsDescription" value="int" />
- <property name="required" value="false" />
- <property name="handler">
- <bean class="org.apache.oodt.cas.cli.option.handler.SetJavaPropertiesHandler">
- <property name="propertyNames">
- <list>
- <value>org.apache.oodt.cas.catalog.requestTimeout</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
-
- <bean id="connectionTimeout" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
- <property name="shortOption" value="ct" />
- <property name="longOption" value="connectionTimeout" />
- <property name="description" value="XML-RPC connection timeout in seconds" />
- <property name="hasArgs" value="true" />
- <property name="argsDescription" value="int" />
- <property name="required" value="false" />
- <property name="handler">
- <bean class="org.apache.oodt.cas.cli.option.handler.SetJavaPropertiesHandler">
- <property name="propertyNames">
- <list>
- <value>org.apache.oodt.cas.catalog.connectionTimeout</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
-
- <bean id="query" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
- <property name="shortOption" value="q" />
- <property name="longOption" value="query" />
- <property name="description" value="CatalogService String Query" />
- <property name="hasArgs" value="true" />
- <property name="argsDescription" value="query" />
- <property name="requirementRules">
- <list>
- <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
- p:actionName="query_all" p:relation="REQUIRED" />
- <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
- p:actionName="reduced_query_all" p:relation="REQUIRED" />
- <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
- p:actionName="query_paged" p:relation="REQUIRED" />
- <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
- p:actionName="reduced_query_paged" p:relation="REQUIRED" />
- </list>
- </property>
- <property name="handler">
- <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler">
- <property name="applyToActions">
- <list>
- <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
- p:actionName="query_all" />
- <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
- p:actionName="reduced_query_all" />
- <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
- p:actionName="query_paged" />
- <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
- p:actionName="reduced_query_paged" />
- </list>
- </property>
- </bean>
- </property>
- </bean>
-
- <bean id="pageSize" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
- <property name="shortOption" value="ps" />
- <property name="longOption" value="pageSize" />
- <property name="description" value="Paged Query PageSize" />
- <property name="hasArgs" value="true" />
- <property name="argsDescription" value="integer" />
- <property name="type" value="int" />
- <property name="requirementRules">
- <list>
- <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
- p:actionName="query_paged" p:relation="REQUIRED" />
- <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
- p:actionName="reduced_query_paged" p:relation="REQUIRED" />
- </list>
- </property>
- <property name="handler">
- <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler">
- <property name="applyToActions">
- <list>
- <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
- p:actionName="query_paged" />
- <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
- p:actionName="reduced_query_paged" />
- </list>
- </property>
- </bean>
- </property>
- </bean>
-
- <bean id="pageNum" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
- <property name="shortOption" value="pn" />
- <property name="longOption" value="pageNum" />
- <property name="description" value="Paged Query PageNum" />
- <property name="hasArgs" value="true" />
- <property name="argsDescription" value="integer" />
- <property name="type" value="int" />
- <property name="requirementRules">
- <list>
- <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
- p:actionName="query_paged" p:relation="REQUIRED" />
- <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
- p:actionName="reduced_query_paged" p:relation="REQUIRED" />
- </list>
- </property>
- <property name="handler">
- <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler">
- <property name="applyToActions">
- <list>
- <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
- p:actionName="query_paged" />
- <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
- p:actionName="reduced_query_paged" />
- </list>
- </property>
- </bean>
- </property>
- </bean>
-
- <bean id="reducedTerms" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
- <property name="shortOption" value="rt" />
- <property name="longOption" value="reducedTerms" />
- <property name="description" value="Term filter for query results" />
- <property name="hasArgs" value="true" />
- <property name="argsDescription" value="list" />
- <property name="type" value="java.util.List" />
- <property name="requirementRules">
- <list>
- <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
- p:actionName="reduced_query_all" p:relation="REQUIRED" />
- <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
- p:actionName="reduced_query_paged" p:relation="REQUIRED" />
- </list>
- </property>
- <property name="handler">
- <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler">
- <property name="applyToActions">
- <list>
- <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
- p:actionName="reduced_query_all" />
- <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
- p:actionName="reduced_query_paged" />
- </list>
- </property>
- </bean>
- </property>
- </bean>
-
- <bean id="catalogRepositoryId" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
- <property name="shortOption" value="crid" />
- <property name="longOption" value="catalogRepositoryId" />
- <property name="description" value="CatalogRepository Spring Bean Id" />
- <property name="hasArgs" value="true" />
- <property name="argsDescription" value="bean id" />
- <property name="requirementRules">
- <list>
- <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
- p:actionName="load_catalog_repo" p:relation="REQUIRED" />
- </list>
- </property>
- <property name="handler">
- <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler">
- <property name="applyToActions">
- <list>
- <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
- p:actionName="load_catalog_repo" />
- </list>
- </property>
- </bean>
- </property>
- </bean>
-
- <bean id="catalogIds" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
- <property name="shortOption" value="cid" />
- <property name="longOption" value="catalogIds" />
- <property name="description" value="List of Catalog IDs to query" />
- <property name="hasArgs" value="true" />
- <property name="argsDescription" value="catalog ids" />
- <property name="type" value="java.util.List" />
- <property name="requirementRules">
- <list>
- <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
- p:actionName="query_all" p:relation="OPTIONAL" />
- <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
- p:actionName="reduced_query_all" p:relation="OPTIONAL" />
- <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
- p:actionName="query_paged" p:relation="OPTIONAL" />
- <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
- p:actionName="reduced_query_paged" p:relation="OPTIONAL" />
- </list>
- </property>
- <property name="handler">
- <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler">
- <property name="applyToActions">
- <list>
- <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
- p:actionName="query_all" />
- <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
- p:actionName="reduced_query_all" />
- <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
- p:actionName="query_paged" />
- <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
- p:actionName="reduced_query_paged" />
- </list>
- </property>
- </bean>
- </property>
- </bean>
-
- <bean id="beanRepo" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
- <property name="shortOption" value="br" />
- <property name="longOption" value="beanRepo" />
- <property name="description" value="Spring Bean XML File" />
- <property name="hasArgs" value="true" />
- <property name="argsDescription" value="file path" />
- <property name="requirementRules">
- <list>
- <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
- p:actionName="load_catalogs" p:relation="REQUIRED" />
- <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
- p:actionName="load_catalog_repo" p:relation="REQUIRED" />
- </list>
- </property>
- <property name="handler">
- <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler">
- <property name="applyToActions">
- <list>
- <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
- p:actionName="load_catalogs" />
- <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
- p:actionName="load_catalog_repo" />
- </list>
- </property>
- </bean>
- </property>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/resources/policy/cmd-line-server-actions.xml
----------------------------------------------------------------------
diff --git a/catalog/src/main/resources/policy/cmd-line-server-actions.xml b/catalog/src/main/resources/policy/cmd-line-server-actions.xml
deleted file mode 100644
index 3c835ea..0000000
--- a/catalog/src/main/resources/policy/cmd-line-server-actions.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:p="http://www.springframework.org/schema/p"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
- <bean class="org.apache.oodt.commons.spring.postprocessor.SetIdBeanPostProcessor" />
-
- <!-- Command Line Actions -->
- <bean id="launchXmlRpcServer" class="org.apache.oodt.cas.catalog.server.cli.action.LaunchXmlRpcServerCliAction">
- <property name="description" value="Brings up a Catalog Service behind an XML-RPC server" />
- </bean>
-
-</beans>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/resources/policy/cmd-line-server-options.xml
----------------------------------------------------------------------
diff --git a/catalog/src/main/resources/policy/cmd-line-server-options.xml b/catalog/src/main/resources/policy/cmd-line-server-options.xml
deleted file mode 100644
index 0f8b139..0000000
--- a/catalog/src/main/resources/policy/cmd-line-server-options.xml
+++ /dev/null
@@ -1,207 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:p="http://www.springframework.org/schema/p"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
- <bean id="port" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
- <property name="shortOption" value="p" />
- <property name="longOption" value="port" />
- <property name="description" value="Port number to bring up server on" />
- <property name="hasArgs" value="true" />
- <property name="argsDescription" value="int" />
- <property name="required" value="true" />
- <property name="handler">
- <bean class="org.apache.oodt.cas.cli.option.handler.SetJavaPropertiesHandler">
- <property name="propertyNames">
- <list>
- <value>org.apache.oodt.cas.catalog.port</value>
- </list>
- </property>
- </bean>
- </property>
- <property name="validators">
- <list>
- <bean class="org.apache.oodt.cas.cli.option.validator.ArgRegExpCmdLineOptionValidator">
- <property name="allowedArgs">
- <list>
- <value>\d+</value>
- </list>
- </property>
- </bean>
- </list>
- </property>
- </bean>
-
- <bean id="transactionIdFactory" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
- <property name="shortOption" value="tidf" />
- <property name="longOption" value="transactionIdFactory" />
- <property name="description" value="TransactionIdFactory classpath" />
- <property name="hasArgs" value="true" />
- <property name="argsDescription" value="classpath" />
- <property name="required" value="false" />
- <property name="handler">
- <bean class="org.apache.oodt.cas.cli.option.handler.SetJavaPropertiesHandler">
- <property name="propertyNames">
- <list>
- <value>org.apache.oodt.cas.catalog.transactionid</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
-
- <bean id="repositoryFactory" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
- <property name="shortOption" value="rf" />
- <property name="longOption" value="repositoryFactory" />
- <property name="description" value="CatalogRepositoryFactory classpath" />
- <property name="hasArgs" value="true" />
- <property name="argsDescription" value="classpath" />
- <property name="required" value="false" />
- <property name="handler">
- <bean class="org.apache.oodt.cas.cli.option.handler.SetJavaPropertiesHandler">
- <property name="propertyNames">
- <list>
- <value>org.apache.oodt.cas.catalog.repository</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
-
- <bean id="ingestMapperFactory" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
- <property name="shortOption" value="imf" />
- <property name="longOption" value="ingestMapperFactory" />
- <property name="description" value="IngestMapperFactory classpath" />
- <property name="hasArgs" value="true" />
- <property name="argsDescription" value="int" />
- <property name="required" value="false" />
- <property name="handler">
- <bean class="org.apache.oodt.cas.cli.option.handler.SetJavaPropertiesHandler">
- <property name="propertyNames">
- <list>
- <value>org.apache.oodt.cas.catalog.ingestmapper</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
-
- <bean id="restrictQueries" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
- <property name="shortOption" value="rq" />
- <property name="longOption" value="restrictQueries" />
- <property name="description" value="Restrict query permissions" />
- <property name="hasArgs" value="false" />
- <property name="required" value="false" />
- <property name="handler">
- <bean class="org.apache.oodt.cas.cli.option.handler.SetJavaPropertiesHandler">
- <property name="propertyNames">
- <list>
- <value>org.apache.oodt.cas.catalog.restrict.query.permissions</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
-
- <bean id="restrictIngest" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
- <property name="shortOption" value="ri" />
- <property name="longOption" value="restrictIngest" />
- <property name="description" value="Restrict ingest permissions" />
- <property name="hasArgs" value="false" />
- <property name="required" value="false" />
- <property name="handler">
- <bean class="org.apache.oodt.cas.cli.option.handler.SetJavaPropertiesHandler">
- <property name="propertyNames">
- <list>
- <value>org.apache.oodt.cas.catalog.restrict.ingest.permissions</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
-
- <bean id="oneCatalogFailsAllFail" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
- <property name="shortOption" value="ofaf" />
- <property name="longOption" value="oneCatalogFailsAllFail" />
- <property name="description" value="" />
- <property name="hasArgs" value="false" />
- <property name="required" value="false" />
- <property name="handler">
- <bean class="org.apache.oodt.cas.cli.option.handler.SetJavaPropertiesHandler">
- <property name="propertyNames">
- <list>
- <value>org.apache.oodt.cas.catalog.oneCatalogFailsAllFail</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
-
- <bean id="simplifyQuery" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
- <property name="shortOption" value="sq" />
- <property name="longOption" value="simplifyQuery" />
- <property name="description" value="Will optimize your query if true" />
- <property name="hasArgs" value="false" />
- <property name="required" value="false" />
- <property name="handler">
- <bean class="org.apache.oodt.cas.cli.option.handler.SetJavaPropertiesHandler">
- <property name="propertyNames">
- <list>
- <value>org.apache.oodt.cas.catalog.simplifyQueries</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
-
- <bean id="disableCrossCatalogJoins" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
- <property name="shortOption" value="dccj" />
- <property name="longOption" value="disableCrossCatalogJoins" />
- <property name="description" value="Will disable queries from joining metadata that has been split across multiple catalogs" />
- <property name="hasArgs" value="false" />
- <property name="required" value="false" />
- <property name="handler">
- <bean class="org.apache.oodt.cas.cli.option.handler.SetJavaPropertiesHandler">
- <property name="propertyNames">
- <list>
- <value>org.apache.oodt.cas.catalog.disableIntersectingCrossCatalogQueries</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
-
- <bean id="sortingThreshold" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
- <property name="shortOption" value="st" />
- <property name="longOption" value="sortingThreshold" />
- <property name="description" value="Threshold of query results at which sorting is turned off so query return time can be optimized" />
- <property name="hasArgs" value="false" />
- <property name="required" value="false" />
- <property name="handler">
- <bean class="org.apache.oodt.cas.cli.option.handler.SetJavaPropertiesHandler">
- <property name="propertyNames">
- <list>
- <value>org.apache.oodt.cas.catalog.crossCatalogResultSortingThreshold</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/resources/policy/in-memory-index-cat.sql
----------------------------------------------------------------------
diff --git a/catalog/src/main/resources/policy/in-memory-index-cat.sql b/catalog/src/main/resources/policy/in-memory-index-cat.sql
deleted file mode 100644
index fbbd46e..0000000
--- a/catalog/src/main/resources/policy/in-memory-index-cat.sql
+++ /dev/null
@@ -1,32 +0,0 @@
- -- Licensed to the Apache Software Foundation (ASF) under one or more
- -- contributor license agreements. See the NOTICE file distributed with
- -- this work for additional information regarding copyright ownership.
- -- The ASF licenses this file to You under the Apache License, Version 2.0
- -- (the "License"); you may not use this file except in compliance with
- -- the License. You may obtain a copy of the License at
- --
- -- http://www.apache.org/licenses/LICENSE-2.0
- --
- -- Unless required by applicable law or agreed to in writing, software
- -- distributed under the License is distributed on an "AS IS" BASIS,
- -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- -- See the License for the specific language governing permissions and
- -- limitations under the License.
-
-DROP TABLE transactions IF EXISTS;
-DROP TABLE transaction_terms IF EXISTS;
-
-CREATE TABLE transactions
-(
- transaction_id varchar(256) NOT NULL,
- transaction_date varchar(256) NOT NULL
-);
-
-CREATE TABLE transaction_terms
-(
- transaction_id varchar(256) NOT NULL,
- bucket_name varchar(256) NOT NULL,
- term_name varchar(256) NOT NULL,
- term_value varchar(1000) NOT NULL
-);
-
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/resources/policy/in-memory-ingest-mapper.sql
----------------------------------------------------------------------
diff --git a/catalog/src/main/resources/policy/in-memory-ingest-mapper.sql b/catalog/src/main/resources/policy/in-memory-ingest-mapper.sql
deleted file mode 100644
index 571a36e..0000000
--- a/catalog/src/main/resources/policy/in-memory-ingest-mapper.sql
+++ /dev/null
@@ -1,26 +0,0 @@
- -- Licensed to the Apache Software Foundation (ASF) under one or more
- -- contributor license agreements. See the NOTICE file distributed with
- -- this work for additional information regarding copyright ownership.
- -- The ASF licenses this file to You under the Apache License, Version 2.0
- -- (the "License"); you may not use this file except in compliance with
- -- the License. You may obtain a copy of the License at
- --
- -- http://www.apache.org/licenses/LICENSE-2.0
- --
- -- Unless required by applicable law or agreed to in writing, software
- -- distributed under the License is distributed on an "AS IS" BASIS,
- -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- -- See the License for the specific language governing permissions and
- -- limitations under the License.
-
-DROP TABLE CatalogServiceMapper IF EXISTS;
-
-CREATE TABLE CatalogServiceMapper (
- CAT_SERV_TRANS_ID VARCHAR(255) NOT NULL ,
- CAT_SERV_TRANS_FACTORY VARCHAR(255) NOT NULL ,
- CAT_TRANS_ID VARCHAR(255) NOT NULL ,
- CAT_TRANS_FACTORY VARCHAR(255) NOT NULL ,
- CAT_TRANS_DATE VARCHAR(255) NOT NULL ,
- CATALOG_ID VARCHAR(255) NOT NULL
-);
-
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/resources/policy/workflow-catalog-beans.xml
----------------------------------------------------------------------
diff --git a/catalog/src/main/resources/policy/workflow-catalog-beans.xml b/catalog/src/main/resources/policy/workflow-catalog-beans.xml
deleted file mode 100644
index b641b8d..0000000
--- a/catalog/src/main/resources/policy/workflow-catalog-beans.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:p="http://www.springframework.org/schema/p"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
- <bean id="WorkflowManagerCatalog" factory-bean="WorkflowManagerCatalogFactory" factory-method="createCatalog"/>
- <bean id="WorkflowManagerCatalogFactory" class="org.apache.oodt.cas.catalog.system.CatalogFactory">
- <property name="catalogId" value="urn:PEATE:WorkflowInstancesCatalog"/>
- <property name="indexFactory" ref="WorkflowManagerDataSourceIndexFactory"/>
- <property name="dictionaryFactories">
- <list>
- <ref bean="WorkflowManagerDictionaryFactory"/>
- </list>
- </property>
- <property name="restrictQueryPermissions" value="false"/>
- <property name="restrictIngestPermissions" value="false"/>
- </bean>
-
- <!-- WorkflowManager Indexes -->
- <bean id="WorkflowManagerDataSourceIndexFactory" class="org.apache.oodt.cas.catalog.struct.impl.index.WorkflowManagerDataSourceIndexFactory">
- <property name="jdbcUrl" value="jdbc:oracle:thin:@dew.jpl.nasa.gov:1521:npptest"/>
- <property name="user" value="nppint"/>
- <property name="pass" value="Peate"/>
- <property name="driver" value="oracle.jdbc.driver.OracleDriver"/>
- </bean>
- <bean id="InMemoryIndexFactory" class="org.apache.oodt.cas.catalog.struct.impl.index.InMemoryIndexFactory">
- <property name="jdbcUrl" value="jdbc:hsqldb:file:${pcs.support.home}/hsqldb;shutdown=true"/>
- <property name="user" value="sa"/>
- <property name="pass" value=""/>
- <property name="driver" value="org.hsqldb.jdbcDriver"/>
- <property name="tablesFile" value="${workflowmgr.home}/policy/in-memory-index-cat.sql"/>
- </bean>
-
- <!-- WorkflowManager Dictionary -->
- <bean id="WorkflowManagerDictionaryFactory" class="org.apache.oodt.cas.catalog.struct.impl.dictionary.WorkflowManagerDictionaryFactory"/>
-
-</beans>
-
-
[34/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/static/js/puny.js
----------------------------------------------------------------------
diff --git a/balance/modules/puny/static/js/puny.js b/balance/modules/puny/static/js/puny.js
deleted file mode 100644
index a49888a..0000000
--- a/balance/modules/puny/static/js/puny.js
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Puny - A light-weight content editor for Balance applications
- *
- * This library depends on JQuery v 1.4.1 or higher (http://www.jquery.com)
- */
-$(document).ready(function() {
-
- // Support click-to-edit on puny elements
- $('[puny]').live('click',function(event) {
- punyInitEditor($(this));
- });
- // Enable the editor save button
- $('#gollum-editor-submit').live('click', punyPersistChanges);
- // Enable the editor cancel button
- $('#gollum-editor-cancel').live('click', punyCancel);
-
-});
-
-var editingResourceId = false;
-
-
-function punyInitEditor ( elmt ) {
- editingResourceId = elmt.attr('puny');
- window.location = puny_module_root + '/edit/' + editingResourceId;
-};
-
-function punyCancel() {
- window.location = puny_current_url;
-}
-
-function punyPersistChanges(event) {
- editingResourceId = $('#punyResourceId').val();
- $.post( puny_module_root + '/store.do',{
- 'resourceId' : editingResourceId
- , 'content' : $('#gollum-editor-body').val()
- },function( data ) {
- window.location = puny_current_url;
- }, 'json');
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/views/edit.php
----------------------------------------------------------------------
diff --git a/balance/modules/puny/views/edit.php b/balance/modules/puny/views/edit.php
deleted file mode 100644
index 0c4ed32..0000000
--- a/balance/modules/puny/views/edit.php
+++ /dev/null
@@ -1,141 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-$module = App::Get()->loadModule();
-
-// Pass the installed site root to javascript
-App::Get()->response->addJavascript("var site_root = '" . SITE_ROOT . "';",true);
-
-// Don't show a header or footer on this view
-App::Get()->response->useHeaderFile(false);
-App::Get()->response->useFooterFile(false);
-
-// Include the main Puny class
-require_once(App::Get()->settings['puny_module_path'] . '/classes/Puny.class.php');
-
-// Load the requested resource
-$resource = Puny::load(App::Get()->request->segments[0]);
-
-// Get the raw contents
-$content = $resource->getContent(true);
-?>
-
-<!-- JAVASCRIPTS -->
-<!-- STYLESHEETS -->
-<script type="text/javascript">
- $(document).ready(function() {
- $.GollumEditor();
- });
-</script>
-
-
-<div id="wiki-wrapper" class="edit outer">
- <div id="head">
- <h1>Editing <strong><?php echo $resource->getId();?></strong></h1>
- <p>(latest version: <?php echo $resource->getVersion();?>)</p>
- </div>
- <div id="wiki-content">
- <div id="gollum-editor" data-escaped-name="Home" class="edit">
- <input type="hidden" id="punyResourceId" name="punyResourceId" value="<?php echo $resource->getId()?>"/>
-
- <div id="gollum-editor-function-bar">
- <div id="gollum-editor-function-buttons">
- <a href="#" id="function-h1" class="function-button" title="Header 1" tabindex="-1">
- <span>Header 1</span> </a>
- <a href="#" id="function-h2" class="function-button" title="Header 2" tabindex="-1">
- <span>Header 2</span> </a>
- <a href="#" id="function-h3" class="function-button" title="Header 3" tabindex="-1">
- <span>Header 3</span> </a>
- <span class="function-divider"> </span>
- <a href="#" id="function-internal-link" class="function-button" title="Wiki Link" tabindex="-1">
- <span>Wiki Link</span> </a>
- <a href="#" id="function-link" class="function-button" title="Link" tabindex="-1">
- <span>Link</span> </a>
- <a href="#" id="function-image" class="function-button" title="Image" tabindex="-1">
- <span>Image</span> </a>
- <span class="function-divider"> </span>
- <a href="#" id="function-bold" class="function-button" title="Bold" tabindex="-1">
- <span>Bold</span> </a>
- <a href="#" id="function-italic" class="function-button" title="Italic" tabindex="-1">
- <span>Italic</span> </a>
- <a href="#" id="function-code" class="function-button" title="Code" tabindex="-1">
- <span>Code</span> </a>
- <span class="function-divider"> </span>
- <a href="#" id="function-ul" class="function-button" title="Unordered List" tabindex="-1">
- <span>Unordered List</span> </a>
- <a href="#" id="function-ol" class="function-button" title="Ordered List" tabindex="-1">
- <span>Ordered List</span> </a>
- <a href="#" id="function-blockquote" class="function-button" title="Blockquote" tabindex="-1">
- <span>Blockquote</span> </a>
- <a href="#" id="function-hr" class="function-button" title="Horizontal Rule" tabindex="-1">
- <span>Horizontal Rule</span> </a>
- <span class="function-divider"> </span>
- <a href="#" id="function-help" class="function-button" title="Help" tabindex="-1">
- <span>Help</span> </a>
- </div>
-
- <div id="gollum-editor-format-selector">
- <!-- <select id="wiki_format" name="wiki[format]">
- <option value="asciidoc">AsciiDoc</option>
- <option value="creole">Creole</option>
- <option value="markdown" selected="selected">Markdown</option>
- <option value="mediawiki">MediaWiki</option>
- <option value="org">Org-mode</option>
- <option value="pod">Pod</option>
- <option value="rdoc">RDoc</option>
- <option value="textile">Textile</option>
- <option value="rest">reStructuredText</option>
- </select> -->
- <label id="wiki_format" name="wiki[format]">Markdown</label>
- <label for="wiki_format">Edit Mode</label>
- </div>
- </div>
-
- <div id="gollum-editor-help" class="jaws" data-autodisplay="true">
- <ul id="gollum-editor-help-parent">
- <li></li>
- </ul>
- <ul id="gollum-editor-help-list">
- <li></li>
- </ul>
- <div id="gollum-editor-help-wrapper">
- <div id="gollum-editor-help-content">
- <p></p>
- </div>
- </div>
- </div>
-
- <div id="gollum-error-message"></div>
- <textarea data-markup-lang="markdown" format="markdown"
- id="gollum-editor-body" name="punyContent"><?php echo stripslashes($content)?></textarea>
-<!-- Edit Message -->
- <!--<div id="gollum-editor-edit-summary" class="singleline">
- <label class="jaws" for="wiki_commit">Edit Message</label>
- <input id="gollum-editor-message-field" name="wiki[commit]"
- placeholder="Write a small message here explaining this change. (Optional)"
- type="text" />
- </div> -->
-
- <span class="jaws"><br> </span>
- <input id="gollum-editor-submit" class="gollum-editor-input" name="commit"
- title="Save current changes" type="submit" value="Save" />
- <input id="gollum-editor-cancel" class="gollum-editor-input" name="cancel"
- title="Cancel changes" type="submit" value="Cancel" />
- </div>
- </div>
-</div>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/views/error.php
----------------------------------------------------------------------
diff --git a/balance/modules/puny/views/error.php b/balance/modules/puny/views/error.php
deleted file mode 100644
index 4576634..0000000
--- a/balance/modules/puny/views/error.php
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
- // Grab the most recent error from the session
- $errorText = $_SESSION['puny_error'];
- unset($_SESSION['puny_error']);
-
- // Don't show a header or footer for this view
- App::Get()->response->useHeaderFile(false);
- App::Get()->response->useFooterFile(false);
-
-?>
-
-<h1>Puny</h1>
-<h2>An error has occurred:</h2>
-<p><?php echo $errorText;?></p>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/views/login.php
----------------------------------------------------------------------
diff --git a/balance/modules/puny/views/login.php b/balance/modules/puny/views/login.php
deleted file mode 100644
index 66f9ee8..0000000
--- a/balance/modules/puny/views/login.php
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Parse the Puny config file
-$module = App::Get()->loadModule();
-
-App::Get()->response->useHeaderFile(false);
-App::Get()->response->useFooterFile(false);
-
-?>
-<style type="text/css">
-div#login {
- padding:15px;
- width:800px;
- background-color:#dfdfdf;
- margin-bottom:none;
- border:solid 5px #888;
- font-size:1.2em;
- color:#333;
- -webkit-border-radius: 8px;
- -moz-border-radius: 8px;
- border-radius: 8px;
-}
-form {
- margin:30px;
-}
-input {
- padding:5px;
- margin-right:5px;
-}
-label {
- padding-right:5px;
-}
-</style>
-<center>
-<p> </p>
-<div id="login">
-<form method="POST" action="<?php echo $module->moduleRoot?>/login.do">
-<label>Username:</label>
-<input type="text" alt="username input" name="username"/>
-<label>Password:</label>
-<input type="password" alt="password input" name="password"/>
-<input type="submit" value="Login"/>
-</form>
-</div>
-</center>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/views/logout.php
----------------------------------------------------------------------
diff --git a/balance/modules/puny/views/logout.php b/balance/modules/puny/views/logout.php
deleted file mode 100644
index fc2459c..0000000
--- a/balance/modules/puny/views/logout.php
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Parse the Puny config file
-$module = App::Get()->loadModule();
-
-// Include the main Puny class
-require_once($module->modulePath . '/classes/Puny.class.php');
-
-// Instantiate Puny
-$puny = new Puny();
-
-// Destroy the editor session
-$puny->destroyEditorSession();
-
-// Redirect home
-App::Get()->redirect(SITE_ROOT . '/');
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/views/preview.php
----------------------------------------------------------------------
diff --git a/balance/modules/puny/views/preview.php b/balance/modules/puny/views/preview.php
deleted file mode 100644
index f14c92c..0000000
--- a/balance/modules/puny/views/preview.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Parse the Puny config file
-$module = App::Get()->loadModule();
-
-// Include the main Puny class
-require_once($module->modulePath . '/classes/Puny.class.php');
-
-// Instantiate Puny
-$puny = new Puny();
-
-// Obtain the parameters from the request
-$resourceId = App::Get()->request->segments[0];
-$versionId = isset(App::Get()->request->segments[1]) ? App::Get()->request->segments[1] : null;
-
-// Load, parse, and display the requested resource
-echo $puny->load($resourceId, $versionId)->getContent();
-
-// we're done :)
-?>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/.gitignore
----------------------------------------------------------------------
diff --git a/catalog/.gitignore b/catalog/.gitignore
deleted file mode 100644
index b54523f..0000000
--- a/catalog/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/maven-eclipse.xml
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/pom.xml
----------------------------------------------------------------------
diff --git a/catalog/pom.xml b/catalog/pom.xml
deleted file mode 100644
index a957174..0000000
--- a/catalog/pom.xml
+++ /dev/null
@@ -1,236 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.oodt</groupId>
- <artifactId>oodt-core</artifactId>
- <version>1.1-SNAPSHOT</version>
- <relativePath>../core/pom.xml</relativePath>
- </parent>
- <artifactId>cas-catalog</artifactId>
- <name>OODT CAS Virtual Catalog and Integration Service.</name>
- <description>CAS Catalog is an effort to virtualize underlying
- catalogs for use in the CAS system. Heterogeneous catalog models
- are mapped to a common dictionary, and then integrated locally so that
- they may be queried across and ingested into.</description>
- <!-- All dependencies should be listed in core/pom.xml and be ordered alphabetically by package and artifact.
- Once the dependency is in the core pom, it can then be used in other modules without the version tags.
- For example, within core/pom.xml:
-
- <dependency>
- <groupId>com.amazonaws</groupId>
- <artifactId>aws-java-sdk</artifactId>
- <version>1.7.4</version>
- </dependency>
-
- Elsewhere in the platform:
- <dependency>
- <groupId>com.amazonaws</groupId>
- <artifactId>aws-java-sdk</artifactId>
- </dependency>
-
- Where possible the same dependency version should be used across the whole platform but if required the version
- can be overridden in a specific pom and should have a comment explaing why the version has been overridden
- -->
- <dependencies>
- <dependency>
- <groupId>com.thoughtworks.xstream</groupId>
- <artifactId>xstream</artifactId>
- <exclusions>
- <exclusion>
- <!-- xom is an optional dependency of xstream. Its also an Apache incompatible license -->
- <groupId>xom</groupId>
- <artifactId>xom</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.solr</groupId>
- <artifactId>solr-solrj</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.apache.lucene</groupId>
- <artifactId>lucene-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.solr</groupId>
- <artifactId>solr-lucene-core</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </dependency>
- <dependency>
- <groupId>hsqldb</groupId>
- <artifactId>hsqldb</artifactId>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.lucene</groupId>
- <artifactId>lucene-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.oodt</groupId>
- <artifactId>cas-cli</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.oodt</groupId>
- <artifactId>cas-metadata</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.oodt</groupId>
- <artifactId>oodt-commons</artifactId>
- </dependency>
- <dependency>
- <groupId>xmlrpc</groupId>
- <artifactId>xmlrpc</artifactId>
- </dependency>
- </dependencies>
- <build>
- <resources>
- <resource>
- <targetPath>org/apache/oodt/cas/catalog/config</targetPath>
- <directory>${basedir}/src/main/resources/policy</directory>
- <includes>
- <include>catserv-properties.xml</include>
- <include>catserv-beans.xml</include>
- <include>catserv-server-config.xml</include>
- <include>catserv-server-cmd-line-beans.xml</include>
- <include>catserv-client-config.xml</include>
- <include>catserv-client-action-beans.xml</include>
- <include>catserv-client-cmd-line-beans.xml</include>
- </includes>
- </resource>
- </resources>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>2.2-beta-2</version>
- <configuration>
- <descriptors>
- <descriptor>src/main/assembly/assembly.xml</descriptor>
- </descriptors>
- <archive />
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>single</goal>
- </goals>
- <phase>package</phase>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- <scm>
- <!--<connection>scm:svn:https://svn.apache.org/repos/asf/oodt/trunk/catalog</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/oodt/trunk/catalog</developerConnection>
- <url>http://svn.apache.org/viewvc/oodt/trunk/catalog</url>-->
- <tag>0.13-SNAPSHOT</tag>
- </scm>
- <ciManagement>
- <notifiers>
- <notifier>
- <configuration>
- <address>chris.mattmann@jpl.nasa.gov</address>
- </configuration>
- </notifier>
- </notifiers>
- </ciManagement>
- <profiles>
- <profile>
- <id>audit</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>rat-maven-plugin</artifactId>
- <configuration>
- <excludes>
- <exclude>**/src/main/java/org/apache/oodt/cas/catalog/query/parser/*.java</exclude>
- </excludes>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>check</goal>
- </goals>
- <phase>verify</phase>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>tmpdir</id>
- <activation>
- <property>
- <name>test.tmpdir</name>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.4.3</version>
- <configuration>
- <systemProperties>
- <property>
- <name>java.io.tmpdir</name>
- <value>${test.tmpdir}</value>
- </property>
- </systemProperties>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
- <!--
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-project-info-reports-plugin</artifactId>
- <version>2.4</version>
- <configuration>
- <checkoutDirectoryName>catalog</checkoutDirectoryName>
- </configuration>
- </plugin>
- </plugins>
- </reporting>
--->
-</project>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/assembly/assembly.xml
----------------------------------------------------------------------
diff --git a/catalog/src/main/assembly/assembly.xml b/catalog/src/main/assembly/assembly.xml
deleted file mode 100644
index 28e832f..0000000
--- a/catalog/src/main/assembly/assembly.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<assembly>
- <id>dist</id>
- <formats>
- <format>tar.gz</format>
- <format>zip</format>
- </formats>
- <includeBaseDirectory>true</includeBaseDirectory>
- <baseDirectory>${project.artifactId}-${project.version}</baseDirectory>
- <includeSiteDirectory>false</includeSiteDirectory>
- <fileSets>
- <fileSet>
- <directory>${basedir}</directory>
- <outputDirectory>.</outputDirectory>
- <includes>
- <include>LICENSE.txt</include>
- <include>CHANGES.txt</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>${basedir}/src/main/bin</directory>
- <outputDirectory>bin</outputDirectory>
- <includes/>
- <fileMode>755</fileMode>
- </fileSet>
- <fileSet>
- <directory>${basedir}/src/main/resources</directory>
- <outputDirectory>etc</outputDirectory>
- <includes>
- <include>**.properties</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>${basedir}/src/main/resources</directory>
- <outputDirectory>logs</outputDirectory>
- <includes>
- <include>REMOVE.log</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>${basedir}/src/main/resources</directory>
- <outputDirectory>etc</outputDirectory>
- <includes>
- <include>**.properties</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>${basedir}/src/main/resources/policy</directory>
- <outputDirectory>policy</outputDirectory>
- <includes/>
- </fileSet>
- </fileSets>
- <dependencySets>
- <dependencySet>
- <outputDirectory>lib</outputDirectory>
- <unpack>false</unpack>
- <useProjectArtifact>true</useProjectArtifact>
- <useTransitiveDependencies>true</useTransitiveDependencies>
- <unpackOptions/>
- </dependencySet>
- </dependencySets>
-</assembly>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/bin/catserv-client
----------------------------------------------------------------------
diff --git a/catalog/src/main/bin/catserv-client b/catalog/src/main/bin/catserv-client
deleted file mode 100644
index babfd25..0000000
--- a/catalog/src/main/bin/catserv-client
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/csh
-
-###########################################################################
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-###########################################################################
-
-set args
-
-if ( $#args > 0 ) then
- set args = "$*"
-endif
-
-setenv CATALOG_HOME `pwd`/..
-
-${JAVA_HOME}/bin/java \
- -Djava.ext.dirs=../lib \
- -Djava.util.logging.config.file=../etc/logging.properties \
- -Dorg.apache.oodt.cas.cli.action.spring.config=../policy/cmd-line-actions.xml \
- -Dorg.apache.oodt.cas.cli.option.spring.config=../policy/cmd-line-options.xml \
- org.apache.oodt.cas.catalog.server.CatalogServiceCommandLineClient ${args}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/bin/catserv-server
----------------------------------------------------------------------
diff --git a/catalog/src/main/bin/catserv-server b/catalog/src/main/bin/catserv-server
deleted file mode 100644
index bd21233..0000000
--- a/catalog/src/main/bin/catserv-server
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/csh
-
-###########################################################################
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-###########################################################################
-
-set args
-
-if ( $#args > 0 ) then
- set args = "$*"
-endif
-
-setenv CATALOG_HOME `pwd`/..
-
-${JAVA_HOME}/bin/java \
- -Djava.ext.dirs=../lib \
- -Djava.util.logging.config.file=../etc/logging.properties \
- -Dorg.apache.oodt.cas.cli.action.spring.config=../policy/cmd-line-server-actions.xml \
- -Dorg.apache.oodt.cas.cli.option.spring.config=../policy/cmd-line-server-options.xml \
- org.apache.oodt.cas.catalog.server.CatalogServiceServerLauncher ${args}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/CatalogServiceCliAction.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/CatalogServiceCliAction.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/CatalogServiceCliAction.java
deleted file mode 100644
index 90ed978..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/CatalogServiceCliAction.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.cli.action;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.server.channel.CommunicationChannelClientFactory;
-import org.apache.oodt.cas.catalog.server.channel.xmlrpc.XmlRpcCommunicationChannelClientFactory;
-import org.apache.oodt.cas.catalog.system.impl.CatalogServiceClient;
-import org.apache.oodt.cas.catalog.system.impl.CatalogServiceClientFactory;
-import org.apache.oodt.cas.cli.action.CmdLineAction;
-
-/**
- * Base Catalog Service {@link CmdLineAction}.
- *
- * @author bfoster (Brian Foster)
- */
-public abstract class CatalogServiceCliAction extends CmdLineAction {
-
- public static final int VAL = 1024;
- public static final int VAL1 = 20;
- public static final int VAL2 = 60;
- private CatalogServiceClient client;
-
- private String getUrl() {
- return System.getProperty("org.apache.oodt.cas.catalog.url");
- }
-
- private int getChunkSize() {
- return Integer.getInteger("org.apache.oodt.cas.catalog.chunkSize", VAL);
- }
-
- private int getRequestTimeout() {
- return Integer.getInteger("org.apache.oodt.cas.catalog.requestTimeout", VAL1);
- }
-
- private int getConnectionTimeout() {
- return Integer.getInteger("org.apache.oodt.cas.catalog.connectionTimeout", VAL2);
- }
-
- private int getAutoPagerSize() {
- return Integer.getInteger("org.apache.oodt.cas.catalog.autoPagerSize", 1000);
- }
-
- public CatalogServiceClient getClient() {
- if (client == null) {
- CatalogServiceClientFactory factory = new CatalogServiceClientFactory();
- factory.setCommunicationChannelClientFactory(getCommunicationChannelFactory());
- factory.setAutoPagerSize(getAutoPagerSize());
- return client = factory.createCatalogService();
- } else {
- return client;
- }
- }
-
- private CommunicationChannelClientFactory getCommunicationChannelFactory() {
- XmlRpcCommunicationChannelClientFactory factory = new XmlRpcCommunicationChannelClientFactory();
- factory.setServerUrl(getUrl());
- factory.setChunkSize(getChunkSize());
- factory.setRequestTimeout(getRequestTimeout());
- factory.setConnectionTimeout(getConnectionTimeout());
- return factory;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/GetSupportedCatalogIdsCliAction.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/GetSupportedCatalogIdsCliAction.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/GetSupportedCatalogIdsCliAction.java
deleted file mode 100644
index f8adad2..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/GetSupportedCatalogIdsCliAction.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.cli.action;
-
-//OODT imports
-import org.apache.oodt.cas.cli.exception.CmdLineActionException;
-
-/**
- * A {@link org.apache.oodt.cas.cli.action.CmdLineAction} which get a list of supported {@link org.apache.oodt.cas.catalog.system.Catalog;}
- * IDs for given {@link org.apache.oodt.cas.catalog.system.impl.CatalogServiceClient}.
- *
- * @author bfoster (Brian Foster)
- */
-public class GetSupportedCatalogIdsCliAction extends CatalogServiceCliAction {
-
- @Override
- public void execute(ActionMessagePrinter printer)
- throws CmdLineActionException {
- try {
- printer.println("CatalogIDs: " + getClient().getCurrentCatalogIds());
- } catch (Exception e) {
- throw new CmdLineActionException(
- "Failed to get supported Catalog IDs : " + e.getMessage(), e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/LoadCatalogRepositoryCliAction.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/LoadCatalogRepositoryCliAction.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/LoadCatalogRepositoryCliAction.java
deleted file mode 100644
index 82cdddb..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/LoadCatalogRepositoryCliAction.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.cli.action;
-
-//JDK imports
-import java.util.Set;
-
-//Apache imports
-import org.apache.commons.lang.Validate;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.repository.CatalogRepository;
-import org.apache.oodt.cas.catalog.repository.CatalogRepositoryFactory;
-import org.apache.oodt.cas.catalog.system.Catalog;
-import org.apache.oodt.cas.catalog.util.Serializer;
-import org.apache.oodt.cas.cli.exception.CmdLineActionException;
-
-//Spring imports
-import org.springframework.context.support.FileSystemXmlApplicationContext;
-
-/**
- * A {@link CmdLineAction} which allows {@link Catalog}s to be loaded from
- * an existing {@link CatalogRepositoryFactory} and to be add to a running
- * Catalog Service from an existing Spring bean XML file.
- *
- * @author bfoster (Brian Foster)
- */
-public class LoadCatalogRepositoryCliAction extends CatalogServiceCliAction {
-
- protected String catalogRepositoryId;
- protected String beanRepo;
-
- @Override
- public void execute(ActionMessagePrinter printer)
- throws CmdLineActionException {
- try {
- Validate.notNull(catalogRepositoryId, "Must specify catalogRepositoryId");
- Validate.notNull(beanRepo, "Must specify beanRepo");
-
- FileSystemXmlApplicationContext appContext = new FileSystemXmlApplicationContext(
- new String[] { this.beanRepo }, false);
- appContext.setClassLoader(new Serializer().getClassLoader());
- appContext.refresh();
- CatalogRepositoryFactory factory = (CatalogRepositoryFactory) appContext
- .getBean(this.catalogRepositoryId, CatalogRepositoryFactory.class);
- CatalogRepository catalogRepository = factory.createRepository();
- Set<Catalog> catalogs = catalogRepository.deserializeAllCatalogs();
- printer.println("Deserialized Catalogs: " + catalogs.toString());
- for (Catalog catalog : catalogs) {
- printer.println("Adding Catalog: " + catalog);
- getClient().addCatalog(catalog);
- }
- } catch (Exception e) {
- throw new CmdLineActionException(
- "Failed to load catalogs from bean repo : " + e.getMessage(), e);
- }
- }
-
- public void setCatalogRepositoryId(String catalogRepositoryId) {
- this.catalogRepositoryId = catalogRepositoryId;
- }
-
- public void setBeanRepo(String beanRepo) {
- this.beanRepo = beanRepo;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/LoadCatalogsCliAction.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/LoadCatalogsCliAction.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/LoadCatalogsCliAction.java
deleted file mode 100644
index 72637b2..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/LoadCatalogsCliAction.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.cli.action;
-
-//JDK imports
-import java.util.Map;
-
-//Apache imports
-import org.apache.commons.lang.Validate;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.system.Catalog;
-import org.apache.oodt.cas.catalog.util.Serializer;
-import org.apache.oodt.cas.cli.exception.CmdLineActionException;
-
-//Spring imports
-import org.springframework.context.support.FileSystemXmlApplicationContext;
-
-/**
- * A {@link CmdLineAction} which loads {@link Catalog}s from a Spring XML file
- * and adds them to the running Catalog Service.
- *
- * @author bfoster (Brian Foster)
- */
-public class LoadCatalogsCliAction extends CatalogServiceCliAction {
-
- protected String beanRepo;
-
- @Override
- public void execute(ActionMessagePrinter printer)
- throws CmdLineActionException {
- try {
- Validate.notNull(beanRepo, "Must specify beanRepo");
-
- FileSystemXmlApplicationContext repoAppContext =
- new FileSystemXmlApplicationContext(
- new String[] { this.beanRepo }, false);
- repoAppContext.setClassLoader(new Serializer().getClassLoader());
- repoAppContext.refresh();
- @SuppressWarnings("unchecked")
- Map<String, Catalog> catalogs = repoAppContext
- .getBeansOfType(Catalog.class);
- for (Catalog catalog : catalogs.values()) {
- printer.println("Adding catalog: " + catalog.getId());
- getClient().addCatalog(catalog);
- }
- } catch (Exception e) {
- throw new CmdLineActionException("Failed to load catalogs : "
- + e.getMessage(), e);
- }
- }
-
- public void setBeanRepo(String beanRepo) {
- this.beanRepo = beanRepo;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/PagedQueryCliAction.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/PagedQueryCliAction.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/PagedQueryCliAction.java
deleted file mode 100644
index 8af24a0..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/PagedQueryCliAction.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.cli.action;
-
-//JDK imports
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-//Apache imports
-import org.apache.commons.lang.Validate;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.metadata.TransactionalMetadata;
-import org.apache.oodt.cas.catalog.page.Page;
-import org.apache.oodt.cas.catalog.page.PageInfo;
-import org.apache.oodt.cas.catalog.query.QueryExpression;
-import org.apache.oodt.cas.catalog.query.parser.QueryParser;
-import org.apache.oodt.cas.cli.exception.CmdLineActionException;
-
-
-/**
- * @author bfoster (Brian Foster)
- */
-public class PagedQueryCliAction extends CatalogServiceCliAction {
-
- private int pageNum = -1;
- private int pageSize = -1;
- private String query;
- private Set<String> catalogIds;
-
- public void execute(ActionMessagePrinter printer)
- throws CmdLineActionException {
- try {
- Validate.isTrue(pageNum != -1, "Must specify pageNum");
- Validate.isTrue(pageSize != -1, "Must specify pageSize");
- Validate.notNull(query, "Must specify query");
-
- QueryExpression queryExpression = QueryParser
- .parseQueryExpression(query);
- Page page;
- if (catalogIds == null) {
- page = getClient().getPage(new PageInfo(pageSize, pageNum),
- queryExpression);
- } else {
- page = getClient().getPage(new PageInfo(pageSize, pageNum),
- queryExpression, catalogIds);
- }
- List<TransactionalMetadata> transactionMetadatas = getClient()
- .getMetadata(page);
- for (TransactionalMetadata tMet : transactionMetadatas) {
- printer.print("ID: " + tMet.getTransactionId() + " ; CatalogIDs: "
- + tMet.getCatalogIds() + " ; Metadata: (");
- StringBuilder sb = new StringBuilder("");
- for (Object metKey : tMet.getMetadata().getMap().keySet()) {
- sb.append(metKey).append("=").append(tMet.getMetadata().getAllMetadata((String) metKey)
- .toString().replaceAll("[\\[\\]]", "'")).append(", ");
- }
- printer.println(sb.substring(0, sb.length() - 2) + ")");
- }
- } catch (Exception e) {
- throw new CmdLineActionException("Failed to perform query '" + query
- + "' : " + e.getMessage(), e);
- }
- }
-
- public void setPageSize(int pageSize) {
- this.pageSize = pageSize;
- }
-
- public void setPageNum(int pageNum) {
- this.pageNum = pageNum;
- }
-
- public void setQuery(String query) {
- this.query = query;
- }
-
- public void setCatalogIds(List<String> catalogIds) {
- this.catalogIds = new HashSet<String>(catalogIds);
- }
-
- public int getPageNum() {
- return pageNum;
- }
-
- public int getPageSize() {
- return pageSize;
- }
-
- public String getQuery() {
- return query;
- }
-
- public Set<String> getCatalogIds() {
- return catalogIds;
- }
-
- public void setCatalogIds(Set<String> catalogIds) {
- this.catalogIds = catalogIds;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/QueryCliAction.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/QueryCliAction.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/QueryCliAction.java
deleted file mode 100644
index 0a8eaf2..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/QueryCliAction.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.cli.action;
-
-//JDK imports
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-//Apache imports
-import org.apache.commons.lang.Validate;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.metadata.TransactionalMetadata;
-import org.apache.oodt.cas.catalog.page.QueryPager;
-import org.apache.oodt.cas.catalog.query.QueryExpression;
-import org.apache.oodt.cas.catalog.query.parser.QueryParser;
-import org.apache.oodt.cas.cli.exception.CmdLineActionException;
-
-/**
- * A {@link CmdLineAction} which queries Catalog Service.
- *
- * @author bfoster (Brian Foster)
- */
-public class QueryCliAction extends CatalogServiceCliAction {
-
- private String query;
- private Set<String> catalogIds;
-
- @Override
- public void execute(ActionMessagePrinter printer)
- throws CmdLineActionException {
- try {
- Validate.notNull(query, "Must specify query");
-
- QueryExpression queryExpression = QueryParser
- .parseQueryExpression(query);
- QueryPager queryPager;
- if (catalogIds == null) {
- queryPager = getClient().query(queryExpression);
- } else {
- queryPager = getClient().query(queryExpression, catalogIds);
- }
- List<TransactionalMetadata> transactionMetadatas = getClient()
- .getAllPages(queryPager);
- for (TransactionalMetadata tMet : transactionMetadatas) {
- printer.print("ID: " + tMet.getTransactionId() + " ; CatalogIDs: "
- + tMet.getCatalogIds() + " ; Metadata: (");
- StringBuilder sb = new StringBuilder("");
- for (Object metKey : tMet.getMetadata().getMap().keySet()) {
- sb.append(metKey).append("=").append(tMet.getMetadata().getAllMetadata((String) metKey)
- .toString().replaceAll("[\\[\\]]", "'")).append(", ");
- }
- printer.println(sb.substring(0, sb.length() - 2) + ")");
- }
- } catch (Exception e) {
- throw new CmdLineActionException("Failed to perform query '" + query
- + "' : " + e.getMessage(), e);
- }
- }
-
- public void setQuery(String query) {
- this.query = query;
- }
-
- public void setCatalogIds(List<String> catalogIds) {
- this.catalogIds = new HashSet<String>(catalogIds);
- }
-
- public String getQuery() {
- return query;
- }
-
- public Set<String> getCatalogIds() {
- return catalogIds;
- }
-
- public void setCatalogIds(Set<String> catalogIds) {
- this.catalogIds = catalogIds;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedPagedQueryCliAction.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedPagedQueryCliAction.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedPagedQueryCliAction.java
deleted file mode 100644
index b62a535..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedPagedQueryCliAction.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.cli.action;
-
-//JDK imports
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-//Apache imports
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.Validate;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.metadata.TransactionalMetadata;
-import org.apache.oodt.cas.catalog.page.Page;
-import org.apache.oodt.cas.catalog.page.PageInfo;
-import org.apache.oodt.cas.catalog.query.QueryExpression;
-import org.apache.oodt.cas.catalog.query.parser.QueryParser;
-import org.apache.oodt.cas.cli.exception.CmdLineActionException;
-
-/**
- * A {@link CmdLineAction} which queries Catalog Service.
- *
- * @author bfoster (Brian Foster)
- */
-public class ReducedPagedQueryCliAction extends CatalogServiceCliAction {
-
- private int pageNum = -1;
- private int pageSize = -1;
- private String query;
- private Set<String> catalogIds;
- private List<String> termNames;
-
- @Override
- public void execute(ActionMessagePrinter printer)
- throws CmdLineActionException {
- try {
- Validate.isTrue(pageNum != -1, "Must specify pageNum");
- Validate.isTrue(pageSize != -1, "Must specify pageSize");
- Validate.notNull(query, "Must specify query");
- Validate.notNull(termNames, "Must specify termNames");
-
- QueryExpression queryExpression = QueryParser
- .parseQueryExpression(query);
- Page page;
- if (catalogIds == null) {
- page = getClient().getPage(new PageInfo(pageSize, pageNum),
- queryExpression);
- } else {
- page = getClient().getPage(new PageInfo(pageSize, pageNum),
- queryExpression, catalogIds);
- }
- List<TransactionalMetadata> transactionMetadatas = getClient()
- .getMetadata(page);
- for (TransactionalMetadata tMet : transactionMetadatas) {
- StringBuilder sb = new StringBuilder("");
- for (String termName : this.termNames) {
- List<String> values = tMet.getMetadata().getAllMetadata(
- (String) termName);
- sb.append(termName).append(" = '").append(values == null ? "null" : StringUtils.join(
- values.iterator(), ",")).append("', ");
- }
- printer.println(sb.substring(0, sb.length() - 2));
- }
- } catch (Exception e) {
- throw new CmdLineActionException("Failed to perform query '" + query
- + "' : " + e.getMessage(), e);
- }
- }
-
- public void setPageSize(int pageSize) {
- this.pageSize = pageSize;
- }
-
- public void setPageNum(int pageNum) {
- this.pageNum = pageNum;
- }
-
- public void setQuery(String query) {
- this.query = query;
- }
-
- public void setCatalogIds(List<String> catalogIds) {
- this.catalogIds = new HashSet<String>(catalogIds);
- }
-
- public void setReducedTerms(List<String> termNames) {
- this.termNames = termNames;
- }
-
- public int getPageNum() {
- return pageNum;
- }
-
- public int getPageSize() {
- return pageSize;
- }
-
- public String getQuery() {
- return query;
- }
-
- public Set<String> getCatalogIds() {
- return catalogIds;
- }
-
- public void setCatalogIds(Set<String> catalogIds) {
- this.catalogIds = catalogIds;
- }
-
- public List<String> getTermNames() {
- return termNames;
- }
-
- public void setTermNames(List<String> termNames) {
- this.termNames = termNames;
- }
-}
-
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedQueryCliAction.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedQueryCliAction.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedQueryCliAction.java
deleted file mode 100644
index dd42147..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedQueryCliAction.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.cli.action;
-
-//JDK imports
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-//Apache imports
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.Validate;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.metadata.TransactionalMetadata;
-import org.apache.oodt.cas.catalog.page.QueryPager;
-import org.apache.oodt.cas.catalog.query.QueryExpression;
-import org.apache.oodt.cas.catalog.query.parser.QueryParser;
-import org.apache.oodt.cas.cli.exception.CmdLineActionException;
-
-/**
- * A {@link CmdLineAction} which queries the Catalog Service and limits the
- * results to a subset of given terms.
- *
- * @author bfoster (Brian Foster)
- */
-public class ReducedQueryCliAction extends CatalogServiceCliAction {
-
- private String query;
- private Set<String> catalogIds;
- private List<String> termNames;
-
- @Override
- public void execute(ActionMessagePrinter printer)
- throws CmdLineActionException {
- try {
- Validate.notNull(query, "Must specify query");
- Validate.notNull(termNames, "Must specify termNames");
-
- QueryExpression queryExpression = QueryParser
- .parseQueryExpression(query);
- QueryPager queryPager;
- if (catalogIds == null) {
- queryPager = getClient().query(queryExpression);
- } else {
- queryPager = getClient().query(queryExpression, catalogIds);
- }
- List<TransactionalMetadata> transactionMetadatas = getClient()
- .getAllPages(queryPager);
- for (TransactionalMetadata tMet : transactionMetadatas) {
- StringBuilder sb = new StringBuilder("");
- for (String termName : this.termNames) {
- List<String> values = tMet.getMetadata().getAllMetadata(
- (String) termName);
- sb.append(termName).append(" = '").append(values == null ? "null" : StringUtils.join(
- values.iterator(), ",")).append("', ");
- }
- printer.println(sb.substring(0, sb.length() - 2));
- }
- } catch (Exception e) {
- throw new CmdLineActionException("", e);
- }
- }
-
- public void setQuery(String query) {
- this.query = query;
- }
-
- public void setCatalogIds(List<String> catalogIds) {
- this.catalogIds = new HashSet<String>(catalogIds);
- }
-
- public void setReducedTerms(List<String> termNames) {
- this.termNames = termNames;
- }
-
- public String getQuery() {
- return query;
- }
-
- public Set<String> getCatalogIds() {
- return catalogIds;
- }
-
- public void setCatalogIds(Set<String> catalogIds) {
- this.catalogIds = catalogIds;
- }
-
- public List<String> getTermNames() {
- return termNames;
- }
-
- public void setTermNames(List<String> termNames) {
- this.termNames = termNames;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ShutdownCliAction.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ShutdownCliAction.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ShutdownCliAction.java
deleted file mode 100644
index 384492f..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ShutdownCliAction.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.cli.action;
-
-//OODT imports
-import org.apache.oodt.cas.cli.exception.CmdLineActionException;
-
-/**
- * A {@link CmdLineAction} which shuts down Catalog Service server.
- * @author bfoster (Brian Foster)
- */
-public class ShutdownCliAction extends CatalogServiceCliAction {
-
- @Override
- public void execute(ActionMessagePrinter printer)
- throws CmdLineActionException {
- try {
- getClient().shutdown();
- } catch (Exception e) {
- throw new CmdLineActionException("Failed to shutdown server : "
- + e.getMessage(), e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/CatalogDictionaryException.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/CatalogDictionaryException.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/CatalogDictionaryException.java
deleted file mode 100644
index 899bedb..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/CatalogDictionaryException.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.catalog.exception;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- */
-public class CatalogDictionaryException extends Exception {
-
- private static final long serialVersionUID = 7734987410778199955L;
-
- public CatalogDictionaryException() {
- super();
- }
-
- public CatalogDictionaryException(String msg) {
- super(msg);
- }
-
- public CatalogDictionaryException(String msg, Throwable throwable) {
- super(msg, throwable);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/CatalogException.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/CatalogException.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/CatalogException.java
deleted file mode 100644
index 3225559..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/CatalogException.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.exception;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- */
-public class CatalogException extends Exception {
-
- private static final long serialVersionUID = 7734987410778199955L;
-
- public CatalogException() {
- super();
- }
-
- public CatalogException(String msg) {
- super(msg);
- }
-
- public CatalogException(String msg, Throwable throwable) {
- super(msg, throwable);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/CatalogIndexException.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/CatalogIndexException.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/CatalogIndexException.java
deleted file mode 100644
index 37529d8..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/CatalogIndexException.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.exception;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- */
-public class CatalogIndexException extends Exception {
-
- private static final long serialVersionUID = 7734987410778199955L;
-
- public CatalogIndexException() {
- super();
- }
-
- public CatalogIndexException(String msg) {
- super(msg);
- }
-
- public CatalogIndexException(String msg, Throwable throwable) {
- super(msg, throwable);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/CatalogRepositoryException.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/CatalogRepositoryException.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/CatalogRepositoryException.java
deleted file mode 100644
index ee9042f..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/CatalogRepositoryException.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.exception;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- */
-public class CatalogRepositoryException extends Exception {
-
- private static final long serialVersionUID = 7734987410778199955L;
-
- public CatalogRepositoryException() {
- super();
- }
-
- public CatalogRepositoryException(String msg) {
- super(msg);
- }
-
- public CatalogRepositoryException(String msg, Throwable throwable) {
- super(msg, throwable);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/CatalogServiceException.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/CatalogServiceException.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/CatalogServiceException.java
deleted file mode 100644
index 880ffba..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/CatalogServiceException.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.exception;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- */
-public class CatalogServiceException extends Exception {
-
- private static final long serialVersionUID = 7734987410778199955L;
-
- public CatalogServiceException() {
- super();
- }
-
- public CatalogServiceException(String msg) {
- super(msg);
- }
-
- public CatalogServiceException(String msg, Throwable throwable) {
- super(msg, throwable);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/IngestServiceException.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/IngestServiceException.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/IngestServiceException.java
deleted file mode 100644
index e61001b..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/IngestServiceException.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.exception;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- */
-public class IngestServiceException extends Exception {
-
- private static final long serialVersionUID = 7734987410778199955L;
-
- public IngestServiceException() {
- super();
- }
-
- public IngestServiceException(String msg) {
- super(msg);
- }
-
- public IngestServiceException(String msg, Throwable throwable) {
- super(msg, throwable);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/QueryServiceException.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/QueryServiceException.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/QueryServiceException.java
deleted file mode 100644
index 5e25883..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/exception/QueryServiceException.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.exception;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- */
-public class QueryServiceException extends Exception {
-
- private static final long serialVersionUID = 7734987410778199955L;
-
- public QueryServiceException() {
- super();
- }
-
- public QueryServiceException(String msg) {
- super(msg);
- }
-
- public QueryServiceException(String msg, Throwable throwable) {
- super(msg, throwable);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/DataSourceIngestMapper.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/DataSourceIngestMapper.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/DataSourceIngestMapper.java
deleted file mode 100644
index ca6e53c..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/DataSourceIngestMapper.java
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.mapping;
-
-//JDK imports
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.text.ParseException;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Set;
-//SQL imports
-import javax.sql.DataSource;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.exception.CatalogRepositoryException;
-import org.apache.oodt.cas.catalog.page.CatalogReceipt;
-import org.apache.oodt.cas.catalog.page.IndexPager;
-import org.apache.oodt.cas.catalog.page.IngestReceipt;
-import org.apache.oodt.cas.catalog.struct.TransactionId;
-import org.apache.oodt.cas.catalog.struct.TransactionIdFactory;
-import org.apache.oodt.commons.database.DatabaseConnectionBuilder;
-import org.apache.oodt.commons.date.DateUtils;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A Ingest Mapper that indexes to an DataSource Database
- * <p>
- */
-public class DataSourceIngestMapper implements IngestMapper {
-
- private DataSource dataSource;
-
- private static final String CATALOG_ID = "' AND CATALOG_ID = '";
-
- private static final String CAT_TRANS_FACTORY = "CAT_TRANS_FACTORY";
-
- private static final String CAT_TRANS_ID = "CAT_TRANS_ID";
-
- public DataSourceIngestMapper(String user, String pass, String driver,
- String jdbcUrl) {
- this.dataSource = DatabaseConnectionBuilder.buildDataSource(user, pass,
- driver, jdbcUrl);
- }
-
- @Override
- public synchronized void deleteAllMappingsForCatalog(String catalogId)
- throws CatalogRepositoryException, SQLException {
- try (Connection conn = this.dataSource.getConnection();
- Statement stmt = conn.createStatement()) {
- stmt.execute("DELETE FROM CatalogServiceMapper WHERE CATALOG_ID = '" + catalogId + "'");
- }
- }
-
- @Override
- public synchronized void deleteAllMappingsForCatalogServiceTransactionId(
- TransactionId<?> catalogServiceTransactionId)
- throws CatalogRepositoryException, SQLException {
- try (Connection conn = this.dataSource.getConnection();
- Statement stmt = conn.createStatement()){
- stmt.execute("DELETE FROM CatalogServiceMapper WHERE CAT_SERV_TRANS_ID = '" + catalogServiceTransactionId + "'");
- conn.commit();
- }
- }
-
- @Override
- public synchronized void deleteTransactionIdMapping(
- TransactionId<?> catalogTransactionId, String catalogId)
- throws CatalogRepositoryException, SQLException {
- try (Connection conn = this.dataSource.getConnection();
- Statement stmt = conn.createStatement()){
- stmt.execute("DELETE FROM CatalogServiceMapper WHERE CAT_TRANS_ID = '" + catalogTransactionId + CATALOG_ID + catalogId + "'");
- conn.commit();
- }
- }
-
- @Override
- public synchronized TransactionId<?> getCatalogServiceTransactionId(
- TransactionId<?> catalogTransactionId, String catalogId)
- throws CatalogRepositoryException, SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException {
- ResultSet rs = null;
- String query = "SELECT CAT_SERV_TRANS_ID,CAT_SERV_TRANS_FACTORY FROM CatalogServiceMapper WHERE CAT_TRANS_ID = '"+ catalogTransactionId + CATALOG_ID + catalogId + "'";
- try (Connection conn = this.dataSource.getConnection();
- PreparedStatement pstmt = conn.prepareStatement(query)){
- rs = pstmt.executeQuery();
- while(rs.next()) {
- return ((TransactionIdFactory) Class.forName(rs.getString("CAT_SERV_TRANS_FACTORY")).newInstance())
- .createTransactionId(rs.getString("CAT_SERV_TRANS_ID"));
- }
- return null;
- }finally {
- if (rs != null) {
- rs.close();
- }
- }
- }
-
- @Override
- public synchronized TransactionId<?> getCatalogTransactionId(
- TransactionId<?> catalogServiceTransactionId, String catalogId)
- throws CatalogRepositoryException, SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException {
- ResultSet rs = null;
- String query = "SELECT CAT_TRANS_ID,CAT_TRANS_FACTORY FROM CatalogServiceMapper WHERE CAT_SERV_TRANS_ID = '"+ catalogServiceTransactionId + CATALOG_ID + catalogId + "'";
- try (Connection conn = this.dataSource.getConnection();
- PreparedStatement pstmt = conn.prepareStatement(query)){
- rs = pstmt.executeQuery();
- while(rs.next()) {
- return ((TransactionIdFactory) Class.forName(rs.getString(CAT_TRANS_FACTORY)).newInstance())
- .createTransactionId(rs.getString(CAT_TRANS_ID));
- }
- return null;
- }finally {
- if (rs != null) {
- rs.close();
- }
- }
- }
-
- @Override
- public synchronized Set<String> getCatalogIds(
- TransactionId<?> catalogServiceTransactionId)
- throws CatalogRepositoryException, SQLException {
- ResultSet rs = null;
- String query = "SELECT CATALOG_ID FROM CatalogServiceMapper WHERE CAT_SERV_TRANS_ID = '"+ catalogServiceTransactionId + "'";
- try (Connection conn = this.dataSource.getConnection();
- PreparedStatement pstmt = conn.prepareStatement(query)){
- rs = pstmt.executeQuery();
- Set<String> catalogIds = new HashSet<>();
- while(rs.next()) {
- catalogIds.add(rs.getString("CATALOG_ID"));
- }
- return catalogIds;
- }finally {
- if (rs != null) {
- rs.close();
- }
- }
- }
-
- @Override
- public synchronized Set<TransactionId<?>> getPageOfCatalogTransactionIds(
- IndexPager indexPager, String catalogId)
- throws CatalogRepositoryException, SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException {
- ResultSet rs = null;
- String query = "SELECT * FROM "
- +"( SELECT a.*, ROWNUM r FROM "
- + "( SELECT CAT_TRANS_FACTORY,CAT_TRANS_ID FROM CatalogServiceMapper WHERE CatalogServiceMapper.CATALOG_ID = '"
- + catalogId + "' ORDER BY CatalogServiceMapper.CAT_SERV_TRANS_ID DESC ) a "
- + "WHERE ROWNUM <= " + (indexPager.getPageSize() * (indexPager.getPageNum() + 1)) + " ) "
- + "WHERE r >= " + ((indexPager.getPageSize() * indexPager.getPageNum()) + 1);
- try (Connection conn = this.dataSource.getConnection();
- PreparedStatement pstmt = conn.prepareStatement(query)){
- rs = pstmt.executeQuery();
- Set<TransactionId<?>> transactionIds = new HashSet<>();
- while(rs.next()) {
- transactionIds.add(((TransactionIdFactory) Class.forName(rs.getString(CAT_TRANS_FACTORY)).newInstance())
- .createTransactionId(rs.getString(CAT_TRANS_ID)));
- }
- return transactionIds;
- }finally {
- if (rs != null) {
- rs.close();
- }
- }
- }
-
- @Override
- public synchronized boolean hasCatalogServiceTransactionId(
- TransactionId<?> catalogServiceTransactionId)
- throws CatalogRepositoryException, SQLException {
- ResultSet rs = null;
- String query = "SELECT CAT_SERV_TRANS_ID FROM CatalogServiceMapper WHERE CAT_SERV_TRANS_ID = '"+ catalogServiceTransactionId + "'";
- try (Connection conn = this.dataSource.getConnection();
- PreparedStatement pstmt = conn.prepareStatement(query)){
- rs = pstmt.executeQuery();
- return rs.next();
- }finally {
- if (rs != null) {
- rs.close();
- }
- }
- }
-
- @Override
- public synchronized void storeTransactionIdMapping(
- TransactionId<?> catalogServiceTransactionId,
- TransactionIdFactory catalogServiceTransactionIdFactory,
- CatalogReceipt catalogReceipt,
- TransactionIdFactory catalogTransactionIdFactory)
- throws CatalogRepositoryException, SQLException {
- Calendar calTime = DateUtils.getCurrentUtcTime();
- calTime.setTime(catalogReceipt.getTransactionDate());
- String query = "INSERT INTO CatalogServiceMapper (CAT_SERV_TRANS_ID, CAT_SERV_TRANS_FACTORY, CAT_TRANS_ID, CAT_TRANS_FACTORY,"
- + " CAT_TRANS_DATE, CATALOG_ID) VALUES ('"
- + catalogServiceTransactionId + "', '"
- + catalogServiceTransactionIdFactory.getClass().getName() + "', '"
- + catalogReceipt.getTransactionId() + "', '"
- + catalogTransactionIdFactory.getClass().getName() + "', '"
- + DateUtils.toString(calTime) + "', '"
- + catalogReceipt.getCatalogId() + "')";
- try (Connection conn = this.dataSource.getConnection();
- PreparedStatement pstmt = conn.prepareStatement(query)){
- pstmt.execute();
- conn.commit();
- }
- }
-
- @Override
- public CatalogReceipt getCatalogReceipt(
- TransactionId<?> catalogServiceTransactionId, String catalogId)
- throws CatalogRepositoryException, SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException, ParseException {
- ResultSet rs = null;
- String query = "SELECT CAT_TRANS_ID, CAT_TRANS_FACTORY, CAT_TRANS_DATE FROM CatalogServiceMapper WHERE CAT_SERV_TRANS_ID = '"+ catalogServiceTransactionId + CATALOG_ID + catalogId + "'";
- try (Connection conn = this.dataSource.getConnection();
- PreparedStatement pstmt = conn.prepareStatement(query)){
- rs = pstmt.executeQuery();
- if(rs.next()) {
- TransactionId<?> catalogTransactionId = ((TransactionIdFactory) Class.forName(rs.getString(CAT_TRANS_FACTORY)).newInstance()).createTransactionId(rs.getString(CAT_TRANS_ID));
- Date transactionDate = DateUtils.toCalendar(rs.getString("CAT_TRANS_DATE"), DateUtils.FormatType.UTC_FORMAT).getTime();
- return new CatalogReceipt(new IngestReceipt(catalogTransactionId, transactionDate), catalogId);
- }else {
- return null;
- }
- }finally {
- if (rs != null) {
- rs.close();
- }
- }
- }
-
- public DataSource getDataSource() {
- return dataSource;
- }
-
- public void setDataSource(DataSource dataSource) {
- this.dataSource = dataSource;
- }
-}
[46/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/IconLoader.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/IconLoader.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/IconLoader.java
deleted file mode 100644
index f5dfd0b..0000000
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/IconLoader.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.workflow.gui.util;
-
-//JDK imports
-import java.awt.Image;
-import java.io.IOException;
-import javax.imageio.ImageIO;
-
-/**
- *
- *
- * Loads the appropriate classpath-level icon image for Tools, etc., that are
- * part of the Workflow Editor GUI.
- *
- * @author mattmann
- * @version $Revision$
- *
- */
-public class IconLoader {
-
- public static final int CREATE = 0;
- public static final int CREATE_SELECTED = 1;
- public static final int DELETE = 2;
- public static final int DELETE_SELECTED = 3;
- public static final int EDIT = 4;
- public static final int EDIT_SELECTED = 5;
- public static final int MOVE = 6;
- public static final int MOVE_SELECTED = 7;
- public static final int ZOOM_IN = 8;
- public static final int ZOOM_IN_SELECTED = 9;
- public static final int ZOOM_OUT = 10;
- public static final int ZOOM_OUT_SELECTED = 11;
- public static final int ZOOM_CURSOR = 12;
-
- private IconLoader() {
- }
-
- public static Image getIcon(int icon) throws IOException {
- switch (icon) {
- case DELETE:
- return ImageIO.read(IconLoader.class.getResource("delete.jpg"));
- case DELETE_SELECTED:
- return ImageIO.read(IconLoader.class.getResource("delete-sel.jpg"));
- case EDIT:
- return ImageIO.read(IconLoader.class.getResource("edit.jpg"));
- case EDIT_SELECTED:
- return ImageIO.read(IconLoader.class.getResource("edit-sel.jpg"));
- case MOVE:
- return ImageIO.read(IconLoader.class.getResource("move.jpg"));
- case MOVE_SELECTED:
- return ImageIO.read(IconLoader.class.getResource("move-sel.jpg"));
- case ZOOM_IN:
- return ImageIO.read(IconLoader.class.getResource("zoom-in.jpg"));
- case ZOOM_IN_SELECTED:
- return ImageIO.read(IconLoader.class.getResource("zoom-in-sel.jpg"));
- case ZOOM_OUT:
- return ImageIO.read(IconLoader.class.getResource("zoom-out.jpg"));
- case ZOOM_OUT_SELECTED:
- return ImageIO.read(IconLoader.class.getResource("zoom-out-sel.jpg"));
- case ZOOM_CURSOR:
- return ImageIO.read(IconLoader.class.getResource("cursor-zoom.png"));
- default:
- return null;
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/Line.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/Line.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/Line.java
deleted file mode 100644
index 69d5fd3..0000000
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/Line.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.workflow.gui.util;
-
-//OODT imports
-import org.apache.oodt.cas.workflow.gui.model.ModelNode;
-
-/**
- *
- *
- * Wrapper class for representing a line between two {@link ModelNode}s.
- *
- * @author bfoster
- * @author mattmann
- *
- */
-public class Line {
-
- private ModelNode fromModel;
- private ModelNode toModel;
-
- public Line(ModelNode fromModel, ModelNode toModel) {
- this.fromModel = fromModel;
- this.toModel = toModel;
- }
-
- public ModelNode getFromModel() {
- return fromModel;
- }
-
- public ModelNode getToModel() {
- return toModel;
- }
-
- public boolean equals(Object obj) {
- if (obj instanceof Line) {
- if (this.fromModel == null && this.toModel == null) {
- return ((Line) obj).fromModel == null && ((Line) obj).toModel == null;
- } else if (this.fromModel == null) {
- return ((Line) obj).fromModel == null
- && ((Line) obj).toModel.equals(this.toModel);
- } else if (this.toModel == null) {
- return ((Line) obj).fromModel.equals(this.fromModel)
- && ((Line) obj).toModel == null;
- } else {
- return ((Line) obj).fromModel.equals(this.fromModel)
- && ((Line) obj).toModel.equals(this.toModel);
- }
- } else {
- return false;
- }
- }
-
- public String toString() {
- return this.fromModel.getModelId() + " -> " + this.toModel.getModelId();
- }
-
- @Override
- public int hashCode() {
- int result = fromModel != null ? fromModel.hashCode() : 0;
- result = 31 * result + (toModel != null ? toModel.hashCode() : 0);
- return result;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/exceptions/WorkflowException.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/exceptions/WorkflowException.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/exceptions/WorkflowException.java
deleted file mode 100644
index 87edb1a..0000000
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/exceptions/WorkflowException.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.workflow.gui.util.exceptions;
-
-/**
- * Workflow Exception for internal Exceptions.
- */
-public class WorkflowException extends Exception {
-
- public WorkflowException(String message){
- super(message);
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/resources/REMOVE.log
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/resources/REMOVE.log b/app/weditor/src/main/resources/REMOVE.log
deleted file mode 100755
index dadf8b1..0000000
--- a/app/weditor/src/main/resources/REMOVE.log
+++ /dev/null
@@ -1,18 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-This file only exists to ensure that Maven creates
-this output directory.You may safely remove this
-file.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/resources/examples/GranuleMaps.xml
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/resources/examples/GranuleMaps.xml b/app/weditor/src/main/resources/examples/GranuleMaps.xml
deleted file mode 100644
index b7ce68d..0000000
--- a/app/weditor/src/main/resources/examples/GranuleMaps.xml
+++ /dev/null
@@ -1,238 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more contributor
-license agreements. See the NOTICE.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.
--->
-<cas:workflows
- xmlns="http://oodt.jpl.nasa.gov/2.0/cas"
- xmlns:cas="http://oodt.jpl.nasa.gov/2.0/cas"
- xmlns:p="http://oodt.jpl.nasa.gov/2.0/cas/property">
-
- <sequential id="urn:npp:GranuleMaps" name="GranuleMaps">
- <configuration>
-
- <!-- PCS properties -->
- <property name="PGETask/Query/FileManagerUrl" value="[FILEMGR_URL]" envReplace="true"/>
- <property name="PGETask/Ingest/FileManagerUrl" value="[FILEMGR_URL]" envReplace="true"/>
- <property name="PGETask/Ingest/ClientTransferServiceFactory" value="gov.nasa.jpl.oodt.cas.filemgr.datatransfer.LocalDataTransferFactory"/>
- <property name="PGETask/Ingest/MetFileExtension" value="cas"/>
- <property name="PGETask/Ingest/CrawlerCrawlForDirs" value="false"/>
- <property name="PGETask/Ingest/CrawlerRecur" value="false"/>
- <property name="PGETask/Ingest/ActionsIds" value="RmDataFile"/>
- <property name="PGETask/Ingest/ActionRepoFile" value="file:[PCS_HOME]/core/pge/policy/action-beans.xml" envReplace="true"/>
-
- <!-- Timeout properties -->
- <property name="PGETask/Condition/Timeout" value="30000"/>
-
- <!-- query properties -->
- <property name="PGETask/Condition/StartDateTimeKey" value="StartDateTime"/>
- <property name="PGETask/Condition/EndDateTimeKey" value="EndDateTime"/>
- <property name="PGETask/Condition/SortByKey" value="StartDateTime"/>
- <property name="PGETask/Condition/VersioningKey" value="ProductionDateTime"/>
- <property name="PGETask/Condition/FilterAlgorClass" value="gov.nasa.jpl.oodt.cas.filemgr.structs.query.filter.WeightedHashFilterAlgor"/>
- <property name="PGETask/Condition/MinNumOfFiles" value="1"/>
- <property name="PGETask/Condition/MaxGapSize" value="-1"/>
- <property name="PGETask/Condition/EpsilonInMillis" value="0"/>
-
- <!-- Wait time between block and unblock in minutes -->
- <property name="BlockTimeElapse" value="1"/>
-
- </configuration>
-
- <conditions execution="parallel" type="pre">
- <condition id-ref="urn:npp:MOA_IASI_L1C_Daily"/>
- <condition id-ref="urn:npp:MOA_MHS_L1B_Daily"/>
- <condition id-ref="urn:npp:MOA_AMSUA_L1B_Daily"/>
- </conditions>
-
- <parallel>
- <task id-ref="urn:npp:Orbits"/>
- <task id-ref="urn:npp:MoaIasiGPolygon"/>
- <task id-ref="urn:npp:MoaMhsGPolygon"/>
- <task id-ref="urn:npp:MoaAmsuaGPolygon"/>
- </parallel>
-
- <parallel>
- <conditions execution="sequential" type="pre">
- <condition id-ref="urn:npp:MOA_ORBITS_FileBased"/>
- </conditions>
-
- <task id-ref="urn:npp:MoaIasiMap"/>
- <task id-ref="urn:npp:MoaMhsMap"/>
- <task id-ref="urn:npp:MoaAmsuaMap"/>
-
- <!--conditions execution="sequential" type="post">
- <condition id-ref="urn:npp:VerifyMapsExist" name="VerifyMapsExist"/>
- </conditions-->
-
- </parallel>
-
- <workflow id-ref="MSPI_L1_Workflow"/>
-
- </sequential>
-
-
- <!-- CONDITIONS -->
- <condition id="urn:npp:MOA_IASI_L1C_Daily" name="MOA_IASI_L1C_Daily" class="gov.nasa.jpl.oodt.cas.pge.condition.PGETaskWorkflowCondition">
- <configuration>
- <property name="PGETask/Condition/ProductTypeNames" value="MOA_IASI_L1C"/>
- <property name="PGETask/Condition/ExpectedNumOfFiles" value="480"/>
- <property name="PGETask/Condition/EpsilonInMillis" value="30000"/>
- <property name="PGETask/Condition/SqlQueryKey" value="Runtime/Condition/IASI_L1_Query"/>
- <property name="PGETask/Condition/ResultKeyFormats" value="{Runtime/Condition/IASI_L1_FormattedMetadata | $FileLocation/$Filename},{Runtime/Condition/IASI_L1_Filenames | $Filename}"/>
- <property name="QueueName" value="java"/>
- </configuration>
- </condition>
- <condition id="urn:npp:MOA_MHS_L1B_Daily" name="MOA_MHS_L1B_Daily" class="gov.nasa.jpl.oodt.cas.pge.condition.PGETaskWorkflowCondition">
- <configuration>
- <property name="PGETask/Condition/ProductTypeNames" value="MOA_MHS_L1B"/>
- <property name="PGETask/Condition/ExpectedNumOfFiles" value="15"/>
- <property name="PGETask/Condition/EpsilonInMillis" value="60000"/> <!--2mins-->
- <property name="PGETask/Condition/SqlQueryKey" value="Runtime/Condition/MHS_L1_Query"/>
- <property name="PGETask/Condition/ResultKeyFormats" value="{Runtime/Condition/MHS_L1_FormattedMetadata | $FileLocation/$Filename},{Runtime/Condition/MHS_L1_Filenames | $Filename}"/>
- <property name="QueueName" value="java"/>
- </configuration>
- </condition>
- <condition id="urn:npp:MOA_AMSUA_L1B_Daily" name="MOA_MHS_L1B_Daily" class="gov.nasa.jpl.oodt.cas.pge.condition.PGETaskWorkflowCondition">
- <configuration>
- <property name="PGETask/Condition/ProductTypeNames" value="MOA_AMSUA_L1B"/>
- <property name="PGETask/Condition/ExpectedNumOfFiles" value="15"/>
- <property name="PGETask/Condition/EpsilonInMillis" value="60000"/> <!--2mins-->
- <property name="PGETask/Condition/SqlQueryKey" value="Runtime/Condition/AMSUA_L1_Query"/>
- <property name="PGETask/Condition/ResultKeyFormats" value="{Runtime/Condition/AMSUA_L1_FormattedMetadata | $FileLocation/$Filename},{Runtime/Condition/AMSUA_L1_Filenames | $Filename}"/>
- <property name="QueueName" value="java"/>
- </configuration>
- </condition>
- <condition id="urn:npp:MOA_ORBITS_FileBased" name="MOA_ORBITS_FileBased" class="gov.nasa.jpl.oodt.cas.pge.condition.PGETaskWorkflowCondition">
- <configuration>
- <property name="PGETask/Condition/ProductTypeNames" value="MOA_ORBITS"/>
- <property name="PGETask/Condition/ExpectedNumOfFiles" value="1"/>
- <property name="PGETask/Condition/SqlQueryKey" value="Runtime/Condition/OrbitsQuery"/>
- <property name="PGETask/Condition/ResultKeyFormats" value="{Runtime/Condition/OrbitsFormattedMetadata | $FileLocation/$Filename},{Runtime/Condition/OrbitsFilenames | $Filename}"/>
- <property name="QueueName" value="java"/>
- </configuration>
- </condition>
- <condition id="urn:npp:MOA_IASI_POLY_FileBased" name="MOA_IASI_POLY_FileBased" class="gov.nasa.jpl.oodt.cas.pge.condition.PGETaskWorkflowCondition">
- <configuration>
- <property name="PGETask/Condition/ProductTypeNames" value="MOA_IASI_POLY"/>
- <property name="PGETask/Condition/ExpectedNumOfFiles" value="1"/>
- <property name="PGETask/Condition/SqlQueryKey" value="Runtime/Condition/IASI_GPolyQuery"/>
- <property name="PGETask/Condition/ResultKeyFormats" value="{Runtime/Condition/IASI_GPolyFormattedMetadata | $FileLocation/$Filename},{Runtime/Condition/IASI_GPolyFilenames | $Filename}"/>
- <property name="QueueName" value="java"/>
- </configuration>
- </condition>
- <condition id="urn:npp:MOA_MHS_POLY_FileBased" name="MOA_MHS_POLY_FileBased" class="gov.nasa.jpl.oodt.cas.pge.condition.PGETaskWorkflowCondition">
- <configuration>
- <property name="PGETask/Condition/ProductTypeNames" value="MOA_MHS_POLY"/>
- <property name="PGETask/Condition/ExpectedNumOfFiles" value="1"/>
- <property name="PGETask/Condition/SqlQueryKey" value="Runtime/Condition/MHS_GPolyQuery"/>
- <property name="PGETask/Condition/ResultKeyFormats" value="{Runtime/Condition/MHS_GPolyFormattedMetadata | $FileLocation/$Filename},{Runtime/Condition/MHS_GPolyFilenames | $Filename}"/>
- <property name="QueueName" value="java"/>
- </configuration>
- </condition>
- <condition id="urn:npp:MOA_AMSUA_POLY_FileBased" name="MOA_AMSUA_POLY_FileBased" class="gov.nasa.jpl.oodt.cas.pge.condition.PGETaskWorkflowCondition">
- <configuration>
- <property name="PGETask/Condition/ProductTypeNames" value="MOA_AMSUA_POLY"/>
- <property name="PGETask/Condition/ExpectedNumOfFiles" value="1"/>
- <property name="PGETask/Condition/SqlQueryKey" value="Runtime/Condition/AMSUA_GPolyQuery"/>
- <property name="PGETask/Condition/ResultKeyFormats" value="{Runtime/Condition/AMSUA_GPolyFormattedMetadata | $FileLocation/$Filename},{Runtime/Condition/AMSUA_GPolyFilenames | $Filename}"/>
- <property name="QueueName" value="java"/>
- </configuration>
- </condition>
- <!--condition id="urn:npp:VerifyMapsExist" name="VerifyMapsExist" class="gov.nasa.jpl.oodt.cas.pge.condition.PGETaskWorkflowCondition"/-->
-
-
- <!-- TASKS -->
- <task id="urn:npp:Orbits" name="MoaOrbits" class="gov.nasa.jpl.oodt.cas.pge.StdPGETaskInstance">
- <configuration>
- <property name="PGETask/Name" value="MoaOrbits" />
- <property name="PGETask/ConfigFilePath" value="[SPSS_CONFIG_HOME]/[MoaOrbits/SPSS_Version]/config/PgeConfig_MoaOrbits.xml"/>
- <property name="Runtime/Condition/L1FormattedMetadata" value="[Runtime/Condition/IASI_L1_FormattedMetadata]"/>
- <property name="Runtime/Condition/L1Filenames" value="[Runtime/Condition/IASI_L1_Filenames]"/>
- <property name="Instrument" value="MetOpS"/>
- <property name="QueueName" value="idl"/>
- </configuration>
- </task>
- <task id="urn:npp:MoaIasiGPolygon" name="MoaIasiGPolygon" class="gov.nasa.jpl.oodt.cas.pge.StdPGETaskInstance">
- <configuration>
- <property name="PGETask/Name" value="MoaIasiGPolygon"/>
- <property name="PGETask/ConfigFilePath" value="[SPSS_CONFIG_HOME]/[MoaIasiGPolygon/SPSS_Version]/config/PgeConfig_MoaGPolygon.xml"/>
- <property name="Runtime/Condition/L1FormattedMetadata" value="[Runtime/Condition/IASI_L1_FormattedMetadata]"/>
- <property name="Runtime/Condition/L1Filenames" value="[Runtime/Condition/IASI_L1_Filenames]"/>
- <property name="Instrument" value="IASI"/>
- <property name="QueueName" value="idl"/>
- </configuration>
- </task>
- <task id="urn:npp:MoaMhsGPolygon" name="MoaMhsGPolygon" class="gov.nasa.jpl.oodt.cas.pge.StdPGETaskInstance">
- <configuration>
- <property name="PGETask/Name" value="MoaAmsuaGPolygon"/>
- <property name="PGETask/ConfigFilePath" value="[SPSS_CONFIG_HOME]/[MoaAmsuaGPolygon/SPSS_Version]/config/PgeConfig_MoaGPolygon.xml"/>
- <property name="Runtime/Condition/L1FormattedMetadata" value="[Runtime/Condition/AMSUA_L1_FormattedMetadata]"/>
- <property name="Runtime/Condition/L1Filenames" value="[Runtime/Condition/AMSUA_L1_Filenames]"/>
- <property name="Instrument" value="AMSUA"/>
- <property name="QueueName" value="idl"/>
- </configuration>
- </task>
- <task id="urn:npp:MoaAmsuaGPolygon" name="MoaAmsuaGPolygon" class="gov.nasa.jpl.oodt.cas.pge.StdPGETaskInstance">
- <configuration>
- <property name="PGETask/Name" value="MoaMhsGPolygon"/>
- <property name="PGETask/ConfigFilePath" value="[SPSS_CONFIG_HOME]/[MoaMhsGPolygon/SPSS_Version]/config/PgeConfig_MoaGPolygon.xml"/>
- <property name="Runtime/Condition/L1FormattedMetadata" value="[Runtime/Condition/MHS_L1_FormattedMetadata]"/>
- <property name="Runtime/Condition/L1Filenames" value="[Runtime/Condition/MHS_L1_Filenames]"/>
- <property name="Instrument" value="MHS"/>
- <property name="QueueName" value="idl"/>
- </configuration>
- </task>
- <task id="urn:npp:MoaIasiMap" name="MoaIasiMap" class="gov.nasa.jpl.oodt.cas.pge.StdPGETaskInstance">
- <conditions execution="sequential" type="pre">
- <condition id-ref="urn:npp:MOA_IASI_POLY_FileBased"/>
- </conditions>
- <configuration>
- <property name="PGETask/Name" value="MoaIasiMap"/>
- <property name="PGETask/ConfigFilePath" value="[SPSS_CONFIG_HOME]/[MoaIasiMap/SPSS_Version]/config/PgeConfig_MoaMap.xml"/>
- <property name="Runtime/Condition/GPolyFormattedMetadata" value="[Runtime/Condition/IASI_GPolyFormattedMetadata]"/>
- <property name="Runtime/Condition/GPolyFilenames" value="[Runtime/Condition/IASI_GPolyFilenames]"/>
- <property name="Instrument" value="IASI"/>
- <property name="QueueName" value="idl"/>
- </configuration>
- </task>
- <task id="urn:npp:MoaMhsMap" name="MoaMhsMap" class="gov.nasa.jpl.oodt.cas.pge.StdPGETaskInstance">
- <conditions execution="sequential" type="pre">
- <condition id-ref="urn:npp:MOA_MHS_POLY_FileBased"/>
- </conditions>
- <configuration>
- <property name="PGETask/Name" value="MoaMhsMap"/>
- <property name="PGETask/ConfigFilePath" value="[SPSS_CONFIG_HOME]/[MoaMhsMap/SPSS_Version]/config/PgeConfig_MoaMap.xml"/>
- <property name="Runtime/Condition/GPolyFormattedMetadata" value="[Runtime/Condition/MHS_GPolyFormattedMetadata]"/>
- <property name="Runtime/Condition/GPolyFilenames" value="[Runtime/Condition/MHS_GPolyFilenames]"/>
- <property name="Instrument" value="MHS"/>
- <property name="QueueName" value="idl"/>
- </configuration>
- </task>
- <task id="urn:npp:MoaAmsuaMap" name="MoaAmsuaMap" class="gov.nasa.jpl.oodt.cas.pge.StdPGETaskInstance">
- <conditions execution="sequential" type="pre">
- <condition id-ref="urn:npp:MOA_AMSUA_POLY_FileBased"/>
- </conditions>
- <configuration>
- <property name="PGETask/Name" value="MoaAmsuaMap"/>
- <property name="PGETask/ConfigFilePath" value="[SPSS_CONFIG_HOME]/[MoaAmsuaMap/SPSS_Version]/config/PgeConfig_MoaMap.xml"/>
- <property name="Runtime/Condition/GPolyFormattedMetadata" value="[Runtime/Condition/AMSUA_GPolyFormattedMetadata]"/>
- <property name="Runtime/Condition/GPolyFilenames" value="[Runtime/Condition/AMSUA_GPolyFilenames]"/>
- <property name="Instrument" value="AMSUA"/>
- <property name="QueueName" value="idl"/>
- </configuration>
- </task>
-
-</cas:workflows>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/resources/examples/mspi-workflow.xml
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/resources/examples/mspi-workflow.xml b/app/weditor/src/main/resources/examples/mspi-workflow.xml
deleted file mode 100644
index 52313f0..0000000
--- a/app/weditor/src/main/resources/examples/mspi-workflow.xml
+++ /dev/null
@@ -1,124 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more contributor
-license agreements. See the NOTICE.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.
--->
-<workflows>
-
- <sequential id="MSPI_L1_Workflow" name="MSPI L1 Workflow">
-
- <configuration extends="global,workflows"/>
-
- <task id-ref="MSPI_L1A1_Task"/>
- <task id-ref="MSPI_L1A2_Task"/>
- <task id-ref="MSPI_L1B1_Task"/>
- <task id-ref="MSPI_L1B2_Task"/>
-
- </sequential>
-
- <!-- CONDITIONS -->
- <condition id="MSPI_L0_Condition" name="MSPI L0 Condition" class="gov.nasa.jpl.oodt.cas.pge.condition.PGETaskWorkflowCondition">
- <configuration extends="global,conditions,1-file">
- <property name="PGETask/Condition/ProductTypeNames" value="MSPI_L0"/>
- <property name="PGETask/Condition/ResultKeyFormats" value="{Runtime/Condition/L0/Formatted | $FileLocation/$Filename},{Runtime/Condition/L0/Filenames | $Filename},{Runtime/Condition/L0/StartDateTime | $StartDateTime},{Runtime/Condition/L0/EndDat
- eTime | $EndDateTime},{Runtime/Condition/L0/Latitude | $Latitude},{Runtime/Condition/L0/Longitude | $Longitude},{Runtime/Condition/L0/Azimuth | $Azimuth},{Runtime/Condition/L0/Elevation | $Elevation}"/>
- <property name="PGETask/Condition/SqlQueryKey" value="Runtime/Condition/L0_Query"/>
- </configuration>
- </condition>
- <condition id="MSPI_L1A1_Condition" name="MSPI L1A1 Condition" class="gov.nasa.jpl.oodt.cas.pge.condition.PGETaskWorkflowCondition">
- <configuration extends="global,conditions,1-file">
- <property name="PGETask/Condition/ProductTypeNames" value="MSPI_L1A1"/>
- <property name="PGETask/Condition/ResultKeyFormats" value="{Runtime/Condition/L1A1/Formatted | $FileLocation/$Filename},{Runtime/Condition/L1A1/Filenames | $Filename},{Runtime/Condition/L1A1/StartDateTime | $StartDateTime},{Runtime/Condition/L1A
- 1/EndDateTime | $EndDateTime},{Runtime/Condition/L1A1/Latitude | $Latitude},{Runtime/Condition/L1A1/Longitude | $Longitude},{Runtime/Condition/L1A1/Azimuth | $Azimuth},{Runtime/Condition/L1A1/Elevation | $Elevation}"/>
- <property name="PGETask/Condition/SqlQueryKey" value="Runtime/Condition/L1A1_Query"/>
- </configuration>
- </condition>
- <condition id="MSPI_L1A2_Condition" name="MSPI L1A2 Condition" class="gov.nasa.jpl.oodt.cas.pge.condition.PGETaskWorkflowCondition">
- <configuration name="MSPI_L1A2_Condition" extends="global,conditions,1-file">
- <property name="PGETask/Condition/ProductTypeNames" value="MSPI_L1A2"/>
- <property name="PGETask/Condition/ResultKeyFormats" value="{Runtime/Condition/L1A2/Formatted | $FileLocation/$Filename},{Runtime/Condition/L1A2/Filenames | $Filename},{Runtime/Condition/L1A2/StartDateTime | $StartDateTime},{Runtime/Condition/L1A
- 2/EndDateTime | $EndDateTime},{Runtime/Condition/L1A2/Latitude | $Latitude},{Runtime/Condition/L1A2/Longitude | $Longitude},{Runtime/Condition/L1A2/Azimuth | $Azimuth},{Runtime/Condition/L1A2/Elevation | $Elevation}"/>
- <property name="PGETask/Condition/SqlQueryKey" value="Runtime/Condition/L1A2_Query"/>
- </configuration>
- </condition>
- <condition id="MSPI_L1B1_Condition" name="MSPI L1B1 Condition" class="gov.nasa.jpl.oodt.cas.pge.condition.PGETaskWorkflowCondition">
- <configuration extends="global,conditions,1-file">
- <property name="PGETask/Condition/ProductTypeNames" value="MSPI_L1B1"/>
- <property name="PGETask/Condition/ResultKeyFormats" value="{Runtime/Condition/L1B1/Formatted | $FileLocation/$Filename},{Runtime/Condition/L1B1/Filenames | $Filename},{Runtime/Condition/L1B1/StartDateTime | $StartDateTime},{Runtime/Condition/L1B
- 1/EndDateTime | $EndDateTime},{Runtime/Condition/L1B1/Latitude | $Latitude},{Runtime/Condition/L1B1/Longitude | $Longitude},{Runtime/Condition/L1B1/Azimuth | $Azimuth},{Runtime/Condition/L1B1/Elevation | $Elevation},{Runtime/Condition/L1B1/ref_row | 32}"
- />
- <property name="PGETask/Condition/SqlQueryKey" value="Runtime/Condition/L1B1_Query"/>
- </configuration>
- </condition>
- <condition id="MSPI_L1B1_Diag_Condition" name="MSPI L1B1 Diag Condition" class="gov.nasa.jpl.oodt.cas.pge.condition.PGETaskWorkflowCondition">
- <configuration extends="global,conditions,1-file">
- <property name="PGETask/Condition/ProductTypeNames" value="MSPI_L1B1_Diag"/>
- <property name="PGETask/Condition/ResultKeyFormats" value="{Runtime/Condition/L1B1_Diag/Formatted | $FileLocation/$Filename},{Runtime/Condition/L1B1_Diag/Filenames | $Filename}"/>
- <property name="PGETask/Condition/SqlQueryKey" value="Runtime/Condition/L1B1_Diag_Query"/>
- </configuration>
- </condition>
-
- <!-- TASKS -->
- <task id="MSPI_L1A1_Task" name="MSPI L1A1 Task" class="gov.nasa.jpl.oodt.cas.pge.StdPGETaskInstance">
- <conditions execution="sequential" type="pre">
- <condition id-ref="MSPI_L0_Condition"/>
- </conditions>
- <configuration>
- <property name="PGETask/Name" value="MSPI_L1A1_Task"/>
- <property name="PGETask/FileBasedConfig/StageConfigFile" value="true"/>
- <property name="PGETask/FileBasedConfig/ConfigFilePath" value="[PCS_HOME]/core/pge/policy/mspi/PgeConfig_MSPI_L1.xml" envReplace="true"/>
- <property name="MSPI/L1Type" value="L1A1"/>
- <property name="MSPI/L1InputType" value="L0"/>
- </configuration>
- </task>
- <task id="MSPI_L1A2_Task" name="MSPI L1A2 Task" class="gov.nasa.jpl.oodt.cas.pge.StdPGETaskInstance">
- <conditions execution="sequential" type="pre">
- <condition id-ref="MSPI_L1A1_Condition"/>
- </conditions>
- <configuration>
- <property name="PGETask/Name" value="MSPI_L1A2_Task"/>
- <property name="PGETask/FileBasedConfig/StageConfigFile" value="true"/>
- <property name="PGETask/FileBasedConfig/ConfigFilePath" value="[PCS_HOME]/core/pge/policy/mspi/PgeConfig_MSPI_L1.xml" envReplace="true"/>
- <property name="MSPI/L1Type" value="L1A2"/>
- <property name="MSPI/L1InputType" value="L1A1"/>
- </configuration>
- </task>
- <task id="MSPI_L1B1_Task" name="MSPI L1B1 Task" class="gov.nasa.jpl.oodt.cas.pge.StdPGETaskInstance">
- <conditions execution="sequential" type="pre">
- <condition id-ref="MSPI_L1A2_Condition"/>
- </conditions>
- <configuration>
- <property name="PGETask/Name" value="MSPI_L1B1_Task"/>
- <property name="PGETask/FileBasedConfig/StageConfigFile" value="true"/>
- <property name="PGETask/FileBasedConfig/ConfigFilePath" value="[PCS_HOME]/core/pge/policy/mspi/PgeConfig_MSPI_L1.xml" envReplace="true"/>
- <property name="MSPI/L1Type" value="L1B1"/>
- <property name="MSPI/L1InputType" value="L1A2"/>
- </configuration>
- </task>
- <task id="MSPI_L1B2_Task" name="MSPI L1B2 Task" class="gov.nasa.jpl.oodt.cas.pge.StdPGETaskInstance">
- <conditions execution="parallel" type="pre">
- <condition id-ref="MSPI_L1B1_Condition"/>
- <condition id-ref="MSPI_L1B1_Diag_Condition"/>
- </conditions>
- <configuration>
- <property name="PGETask/Name" value="MSPI_L1B2_Task"/>
- <property name="PGETask/FileBasedConfig/StageConfigFile" value="true"/>
- <property name="PGETask/FileBasedConfig/ConfigFilePath" value="[PCS_HOME]/core/pge/policy/mspi/PgeConfig_MSPI_L1.xml" envReplace="true"/>
- <property name="MSPI/L1Type" value="L1B2"/>
- <property name="MSPI/L1InputType" value="L1B1"/>
- </configuration>
- </task>
-
-</workflows>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/resources/examples/shared-properties.xml
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/resources/examples/shared-properties.xml b/app/weditor/src/main/resources/examples/shared-properties.xml
deleted file mode 100644
index 73ae732..0000000
--- a/app/weditor/src/main/resources/examples/shared-properties.xml
+++ /dev/null
@@ -1,85 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more contributor
-license agreements. See the NOTICE.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.
--->
-<workflows>
- <configuration name="global">
- <property name="PGETask/Query/FileManagerUrl" value="[FILEMGR_URL]" envReplace="true"/>
- <property name="BlockTimeElapse" value="10"/> <!--10mins-->
- </configuration>
- <configuration name="workflows">
- <property name="PGETask/Ingest/FileManagerUrl" value="[FILEMGR_URL]" envReplace="true"/>
- <property name="PGETask/Ingest/ClientTransferServiceFactory" value="gov.nasa.jpl.oodt.cas.filemgr.datatransfer.LocalDataTransferFactory"/>
- <property name="PGETask/Ingest/MetFileExtension" value="cas"/>
- <property name="PGETask/Ingest/CrawlerCrawlForDirs" value="false"/>
- <property name="PGETask/Ingest/CrawlerRecur" value="false"/>
- <!--property name="PGETask/Ingest/ActionsIds" value="RmDataFile"/>
- <property name="PGETask/Ingest/ActionRepoFile" value="file:[PCS_HOME]/cas/pge/policy/action-beans.xml" envReplace="true"/-->
-
- <!-- resource runner properties -->
- <property name="QueueName" value="exe"/>
- <property name="Load" value="2"/>
- </configuration>
- <configuration name="conditions">
- <property name="PGETask/Condition/Timeout" value="28800"/> <!--8hrs-->
- <property name="PGETask/Condition/StartDateTimeKey" value="StartDateTime"/>
- <property name="PGETask/Condition/EndDateTimeKey" value="EndDateTime"/>
- <property name="PGETask/Condition/SortByKey" value="StartDateTime"/>
- <property name="PGETask/Condition/VersioningKey" value="ProductionDateTime"/>
- <property name="PGETask/Condition/MinNumOfFiles" value="1"/>
- <property name="PGETask/Condition/MaxGap/Size" value="-1"/>
- <property name="PGETask/Condition/EpsilonInMillis" value="0"/>
- <property name="PGETask/Condition/FilterAlgorClass" value="gov.nasa.jpl.oodt.cas.filemgr.structs.query.filter.WeightedHashFilterAlgor"/>
-
- <!-- resource runner properties -->
- <property name="QueueName" value="conds"/>
- <property name="Load" value="1"/>
- </configuration>
- <configuration name="airs">
- <property name="PGETask/Condition/StartDateTimeKey" value="UTC_start_time"/>
- <property name="PGETask/Condition/EndDateTimeKey" value="UTC_stop_time"/>
- <property name="PGETask/Condition/SortByKey" value="UTC_start_time"/>
- <property name="PGETask/Condition/VersioningKey" value="ProductionDatetime"/>
- <property name="PGETask/Condition/ExpectedNumOfFiles" value="240"/>
- <property name="PGETask/Condition/EpsilonInMillis" value="10000"/> <!--10secs-->
- </configuration>
- <configuration name="14-files">
- <!-- filter properties -->
- <property name="PGETask/Condition/ExpectedNumOfFiles" value="14"/>
- <property name="PGETask/Condition/EpsilonInMillis" value="1000000"/> <!--1000secs-->
-
- <!-- gap analysis properties -->
- <property name="PGETask/Condition/MaxGap/Size" value="6000000"/> <!--100mins-->
- <property name="PGETask/Condition/MaxGap/StartDateTime" value="[NominalDate]T00:00:00.000Z"/>
- <property name="PGETask/Condition/MaxGap/EndDateTime" value="[NominalDate]T23:59:59.999Z"/>
- </configuration>
- <configuration name="480-files">
- <!-- filter properties -->
- <property name="PGETask/Condition/ExpectedNumOfFiles" value="480"/>
- <property name="PGETask/Condition/EpsilonInMillis" value="30000"/> <!--30secs-->
- </configuration>
- <configuration name="1-file">
- <property name="PGETask/Condition/FilterAlgorClass" value="gov.nasa.jpl.oodt.cas.filemgr.structs.query.filter.TakeEarliestEventFilterAlgor"/>
- <property name="PGETask/Condition/ExpectedNumOfFiles" value="1"/>
- </configuration>
- <configuration name="concat-files">
- <!-- filter properties -->
- <property name="PGETask/Condition/ExpectedNumOfFiles" value="28"/>
- <property name="PGETask/Condition/EpsilonInMillis" value="21600000"/> <!--6hours-->
- <property name="PGETask/Condition/MinNumOfFiles" value="2"/>
- </configuration>
-</workflows>
-
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/resources/examples/test.xml
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/resources/examples/test.xml b/app/weditor/src/main/resources/examples/test.xml
deleted file mode 100644
index f2bf057..0000000
--- a/app/weditor/src/main/resources/examples/test.xml
+++ /dev/null
@@ -1,78 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more contributor
-license agreements. See the NOTICE.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.
--->
-<cas:workflows
- xmlns="http://oodt.jpl.nasa.gov/2.0/cas"
- xmlns:cas="http://oodt.jpl.nasa.gov/2.0/cas"
- xmlns:p="http://oodt.jpl.nasa.gov/2.0/cas/property">
-
- <workflow id="TestWorkflow" execution="sequential">
- <task id-ref="Orbit"/>
- <workflow id="tester" execution="sequential">
- <conditions execution="parallel">
- <condition id-ref="cond1"/>
- <condition id-ref="cond2"/>
- </conditions>
-
- <parallel>
- <workflow id="L0" execution="sequential">
- <task id-ref="L0a"/>
- <task id-ref="L0b"/>
- <task id-ref="L0c"/>
- <task id-ref="L0d"/>
- </workflow>
- <workflow id-ref="L1a"/>
- </parallel>
- <sequential>
- <task id-ref="Ane"/>
- <parallel>
- <workflow id-ref="GeoCal"/>
- <workflow id-ref="Geo"/>
- </parallel>
- </sequential>
-
- <conditions execution="sequential">
- <condition id-ref="cond3"/>
- </conditions>
- </workflow>
- <workflow id-ref="MSPI_L1_Workflow"/>
- </workflow>
-
- <task id="Orbit" class="gov.nasa.jpl.oodt.cas.workflow.instance.ValidateMetadataInstance"/>
- <task id="L0a" class="gov.nasa.jpl.oodt.cas.workflow.instance.ValidateMetadataInstance" p:validateKey="Orbit_key,cond1_key,cond2_key"/>
- <task id="L0b" class="gov.nasa.jpl.oodt.cas.workflow.instance.ValidateMetadataInstance" p:validateKey="Orbit_key,cond1_key,cond2_key,L0a_key"/>
- <task id="L0c" class="gov.nasa.jpl.oodt.cas.workflow.instance.ValidateMetadataInstance" p:validateKey="Orbit_key,cond1_key,cond2_key,L0a_key,L0b_key"/>
- <task id="L0d" class="gov.nasa.jpl.oodt.cas.workflow.instance.ValidateMetadataInstance" p:validateKey="Orbit_key,cond1_key,cond2_key,L0a_key,L0b_key,L0c_key"/>
- <task id="Ane" class="gov.nasa.jpl.oodt.cas.workflow.instance.ValidateMetadataInstance" p:validateKey="Orbit_key,cond1_key,cond2_key,L0a_key,L0b_key,L0c_key,L0d_key"/>
-
- <condition id="cond1" p:timeout="200" class="gov.nasa.jpl.oodt.cas.workflow.instance.ValidateMetadataInstance"/>
- <condition id="cond2" class="gov.nasa.jpl.oodt.cas.workflow.instance.ValidateMetadataInstance"/>
- <condition id="cond3" class="gov.nasa.jpl.oodt.cas.workflow.instance.ValidateMetadataInstance" p:validateKey="L0a_key,L0b_key,L0c_key,L0d_key,L1aTask_key,Ane_key,GeoCalTask_key,GeoTask_key,cond1_key,cond2_key"/>
-
- <sequential id="L1a">
- <task id="L1aTask" class="gov.nasa.jpl.oodt.cas.workflow.instance.ValidateMetadataInstance" p:validateKey="Orbit_key,cond1_key,cond2_key"/>
- </sequential>
-
- <workflow id="GeoCal" execution="sequential">
- <task id="GeoCalTask" class="gov.nasa.jpl.oodt.cas.workflow.instance.ValidateMetadataInstance" p:validateKey="Orbit_key,Ane_key,cond1_key,cond2_key,L0b_key,L0c_key,L0d_key"/>
- </workflow>
-
- <workflow id="Geo" execution="sequential">
- <task id="GeoTask" class="gov.nasa.jpl.oodt.cas.workflow.instance.ValidateMetadataInstance" p:validateKey="Orbit_key,Ane_key,cond1_key,cond2_key,L0b_key,L0c_key,L0d_key"/>
- </workflow>
-
-</cas:workflows>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/resources/icons/cursor-zoom.png
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/resources/icons/cursor-zoom.png b/app/weditor/src/main/resources/icons/cursor-zoom.png
deleted file mode 100644
index e47f879..0000000
Binary files a/app/weditor/src/main/resources/icons/cursor-zoom.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/resources/icons/delete-sel.jpg
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/resources/icons/delete-sel.jpg b/app/weditor/src/main/resources/icons/delete-sel.jpg
deleted file mode 100644
index 3144ab6..0000000
Binary files a/app/weditor/src/main/resources/icons/delete-sel.jpg and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/resources/icons/delete.jpg
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/resources/icons/delete.jpg b/app/weditor/src/main/resources/icons/delete.jpg
deleted file mode 100644
index 876c80c..0000000
Binary files a/app/weditor/src/main/resources/icons/delete.jpg and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/resources/icons/edit-sel.jpg
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/resources/icons/edit-sel.jpg b/app/weditor/src/main/resources/icons/edit-sel.jpg
deleted file mode 100644
index ef262a4..0000000
Binary files a/app/weditor/src/main/resources/icons/edit-sel.jpg and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/resources/icons/edit.jpg
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/resources/icons/edit.jpg b/app/weditor/src/main/resources/icons/edit.jpg
deleted file mode 100644
index e56d6d4..0000000
Binary files a/app/weditor/src/main/resources/icons/edit.jpg and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/resources/icons/move-sel.jpg
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/resources/icons/move-sel.jpg b/app/weditor/src/main/resources/icons/move-sel.jpg
deleted file mode 100644
index b54dcce..0000000
Binary files a/app/weditor/src/main/resources/icons/move-sel.jpg and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/resources/icons/move.jpg
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/resources/icons/move.jpg b/app/weditor/src/main/resources/icons/move.jpg
deleted file mode 100644
index d96e03d..0000000
Binary files a/app/weditor/src/main/resources/icons/move.jpg and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/resources/icons/zoom-in-sel.jpg
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/resources/icons/zoom-in-sel.jpg b/app/weditor/src/main/resources/icons/zoom-in-sel.jpg
deleted file mode 100644
index a072e15..0000000
Binary files a/app/weditor/src/main/resources/icons/zoom-in-sel.jpg and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/resources/icons/zoom-in.jpg
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/resources/icons/zoom-in.jpg b/app/weditor/src/main/resources/icons/zoom-in.jpg
deleted file mode 100644
index a61decf..0000000
Binary files a/app/weditor/src/main/resources/icons/zoom-in.jpg and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/resources/icons/zoom-out-sel.jpg
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/resources/icons/zoom-out-sel.jpg b/app/weditor/src/main/resources/icons/zoom-out-sel.jpg
deleted file mode 100644
index 5820b39..0000000
Binary files a/app/weditor/src/main/resources/icons/zoom-out-sel.jpg and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/resources/icons/zoom-out.jpg
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/resources/icons/zoom-out.jpg b/app/weditor/src/main/resources/icons/zoom-out.jpg
deleted file mode 100644
index 2996af1..0000000
Binary files a/app/weditor/src/main/resources/icons/zoom-out.jpg and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/resources/logging.properties
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/resources/logging.properties b/app/weditor/src/main/resources/logging.properties
deleted file mode 100644
index 8d72499..0000000
--- a/app/weditor/src/main/resources/logging.properties
+++ /dev/null
@@ -1,40 +0,0 @@
-# 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.
-
-
-# Specify the handlers to create in the root logger
-# (all loggers are children of the root logger)
-# The following creates two handlers
-handlers = java.util.logging.ConsoleHandler, java.util.logging.FileHandler
-
-# Set the default logging level for the root logger
-.level = INFO
-
-# Set the default logging level for new ConsoleHandler instances
-java.util.logging.ConsoleHandler.level = ALL
-java.util.logging.FileHandler.level = ALL
-
-# Set the default formatter for new ConsoleHandler instances
-java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
-
-# default file output is in user's home directory.
-java.util.logging.FileHandler.pattern = ../logs/cas_workflow_gui%g.log
-java.util.logging.FileHandler.limit = 50000
-java.util.logging.FileHandler.count = 5
-java.util.logging.FileHandler.append = true
-java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
-
-# Set the default logging level for the subsystems
-org.apache.oodt.cas.workflow.gui.level = INFO
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/etc/skel/.htaccess
----------------------------------------------------------------------
diff --git a/balance/etc/skel/.htaccess b/balance/etc/skel/.htaccess
deleted file mode 100644
index e3a557a..0000000
--- a/balance/etc/skel/.htaccess
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-# Rewrite rules for OODT Balance web applications.
-#
-# Enable the rewrite engine
-RewriteEngine On
-
-# Make sure that the value for RewriteBase exactly matches the
-# value for site_root in config.ini. This value should point to the
-# location (relative to the server's document root) of the
-# Balance webapp directory (the directory containing config.ini). For
-# example, if the application lives at the server's document root, then
-# RewriteBase should be set to '/'. If, on the other hand, the application
-# has been installed into a subdirectory 'foo' underneath the server's
-# document root, RewriteBase (and site_root in config.ini) should be set
-# to '/foo/'
-RewriteBase /
-
-# This section forwards all requests to the Balance application's front
-# controller. Unless you are modifying the low-level behavior of the
-# Balance application framework, there should be no need to make any
-# modifications below this line. -----------------------------------------
-#
-# Send all other non-static requests to the main controller
-RewriteCond %{REQUEST_URI} !/static/(.*)$
-RewriteCond %{REQUEST_URI} !/scripts/(.*)$
-RewriteCond %{REQUEST_URI} !/global/(.*)$
-RewriteCond %{REQUEST_URI} !index\.php/.+$
-RewriteRule ^(.+)$ ./index\.php/$1 [L,NC]
-
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/etc/skel/README.txt
----------------------------------------------------------------------
diff --git a/balance/etc/skel/README.txt b/balance/etc/skel/README.txt
deleted file mode 100644
index ce7b2fd..0000000
--- a/balance/etc/skel/README.txt
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-OODT Balance Web Application README File
-
-The OODT Balance web application skeleton is a quick way to get started
-developing a new Balance application. It provides the necessary directory
-structure and sane default configuration values that you can customize to
-suit your needs. These instructions assume you have the necessary access
-to install files into your web server's document root. These instructions
-will help you create an application called 'my-application' which will be
-accessed from http://localhost/my-application. Your environment and/or
-needs may differ, so adapt the following as necessary.
-
-
-1. Installing the OODT Balance PEAR package ("Balance library")
-
-The Balance library provides core classs that must be in place prior to
-developing a Balance application. The library only needs to be installed
-once per system. If you have previously installed the Balance library on
-your system, you can safely skip this step.
-
- a. Download the latest stable Balance library release (OODT_ROOT/balance/lib/pear)
- to a scratch directory on your system
- b. Build the pear package using the pear command line utility:
- $ pear package
- c. Install the resulting package (.tgz file) using the pear installer:
- $ pear install --force Org_Apache_Oodt_Balance-#.#.#.tgz
-
-2. Setting up the web application skeleton
-
-The files in this directory represent the Balance application skeleton. If
-you have not already done so, move the directory containing this file to
-your web server's directory root, noting the name you use for the path
-(e.g.: /path/to/document/root/my-application). The instructions below assume
-that you have named the directory 'my-application'. Adjust as necessary for
-your environment.
-
- a. In the config.ini file, set the url_base configuration variable to /my-application
- b. In the .htaccess file, set the RewriteBase directive to /my-application
- c. Visit http://localhost/my-application to see your skeletal Balance application. Note
- that the URL you use to visit your application may differ slightly from the above
- if you have set up virtual hosting or have a domain name other than localhost.
-
-3. Developing your web application
-
-The following is a very high level introduction to developing a web application using Balance.
-
-Balance operates on the concept of application 'views'. Each application url, e.g.:
-http://localhost/my-application/about, maps to exactly one view, e.g.: HOME/views/about.php,
-where HOME is the location of the Balance web application files. A view file is a plain vanilla
-PHP file, which, in its simplest form, might only contain static HTML. For more involved tasks,
-functions from the Balance core library can be invoked directly from within the view file.
-
-Most sites incorporate common, site-wide content at the top (header) and bottom (footer) of
-each page. Balance supports header and footer files, which get included with every view unless
-the view file itself explicitly modifies this behavior. By default, the header and footer file
-can be found at HOME/views/common/header.php and HOME/views/common/footer.php, respectively.
-
-Occasionally, such as when a form gets submitted via POST, a script needs to be invoked to handle
-the input. Scripts are generally located at HOME/scripts, and are named according to the url
-that will be used to invoke them. Scripts are differentiated from views from a url standpoint in
-that urls for scripts end in '.do' whereas urls for views generally do not have a file extension.
-As a concrete example, imagine a login view providing inputs for username and password. It might
-theoretically reside at HOME/views/login.php and be accessed via
-http://localhost/my-application/login. On submission, the login form's target might be set to a
-login script that processes the submitted user information. That script would reside at
-HOME/scripts/login.php and be accessed via http://localhost/my-application/login.do. In the
-event that the script is intended to handle GET parameters, they are appended after the .do using
-the standard url notation (e.g.: ...myscript.do?param1=value1¶m2=value2). The '.do' extension is
-merely a url routing convention meant to imply the execution of some action, the actual script
-file in HOME/scripts maintains the '.php' extension.
-
-More information can be obtained by visiting the OODT website (http://oodt.apache.org) or posing
-a question to the OODT user mailing list (user@oodt.apache.org).
-
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/etc/skel/config.ini
----------------------------------------------------------------------
diff --git a/balance/etc/skel/config.ini b/balance/etc/skel/config.ini
deleted file mode 100644
index 04391b1..0000000
--- a/balance/etc/skel/config.ini
+++ /dev/null
@@ -1,82 +0,0 @@
-;
-; Licensed to the Apache Software Foundation (ASF) under one or more
-; contributor license agreements. See the NOTICE file distributed with
-; this work for additional information regarding copyright ownership.
-; The ASF licenses this file to You under the Apache License, Version 2.0
-; (the "License"); you may not use this file except in compliance with
-; the License. You may obtain a copy of the License at
-;
-; http://www.apache.org/licenses/LICENSE-2.0
-;
-; Unless required by applicable law or agreed to in writing, software
-; distributed under the License is distributed on an "AS IS" BASIS,
-; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-; See the License for the specific language governing permissions and
-; limitations under the License.
-;
-
-;
-; OODT Balance
-; Web Application Base Framework
-;
-; Application Configuration File. This file should be called 'config.ini' and
-; should reside in the root directory of your site. This file follows standard
-; ini file conventions. Lines beginning with ';' are comments and are ignored.
-;
-
-[Application Environment]
-
-; site_root
-; If the site lives at the document root of the server, this will be '/'. On
-; the other hand, if the site lives in a sub-directory of the document root,
-; this will be the full path (starting from the document root) to the root
-; directory of the site. Always start with a slash (/) and always omit the
-; trailing slash.
-;
-; examples:
-; (document root) http://domain.com/ (site_root: '/')
-; (subdirectory) http://domain.com/apps/site (site_root: '/apps/site')
-;
-; Note: The value for site_root should always match the value for 'RewriteBase'
-; in the .htaccess file located in the site's root directory.
-;
-site_root = /
-
-
-[Application Content]
-
-; views_dir
-; This is the directory inside your site root where your application's views
-; reside. This should be a relative path (./). If you have set things up
-; according to the instructions, the framework will use the location of this
-; file (config.ini) as the base.
-;
-; Note: The value provided is simply an example. It is up to you to provide
-; valid paths for your environment.
-views_dir = ./views
-
-; header_file_path
-; This is the file that contains a site-wide header code/layout to be included
-; in each view. This should be a relative path (./). If you have set things up
-; according to the instructions, the framework will use the location of this
-; file (config.ini) as the base.
-;
-; Note: The value provided is simply an example. It is up to you to provide
-; valid paths for your environment.
-header_file_path = ./views/common/header.php
-
-; footer_file_path
-; This is the file that contains a site-wide footer code/layout to be included
-; in each view. This should be a relative path (./). If you have set things up
-; according to the instructions, the framework will use the location of this
-; file (config.ini) as the base.
-;
-; Note: The value provided is simply an example. It is up to you to provide
-; valid paths for your environment.
-footer_file_path = ./views/common/footer.php
-
-
-[AUTH & AUTH]
-
-; Authorization error redirect path to login page
-authorization_redirect_url = /
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/etc/skel/hooks.php
----------------------------------------------------------------------
diff --git a/balance/etc/skel/hooks.php b/balance/etc/skel/hooks.php
deleted file mode 100644
index b26dd94..0000000
--- a/balance/etc/skel/hooks.php
+++ /dev/null
@@ -1,98 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
-*/
-
-/**
- * HOOKS.PHP
- *
- * Hooks provide the ability, as the name implies, to hook into various parts of
- * the view rendering process and insert customizations. The contents of these
- * functions are run at the appropriate time *EVERY* time a view is rendered, i.e.
- * the content of the hooks is not by default view-specific but rather will be
- * applied to all views. (However, there is nothing that prevents developers from
- * inserting conditional logic inside a hook that then causes view-specific
- * them to exhibit view-specific behavior).
- *
- * As an example, consider a hook that adds the amount of time Balance took to render
- * the page as an inline HTML comment at the bottom of each page after it has been sent:
- *
- * function hook_after_send() {
- * $timeStart = $GLOBALS['balance_request_start'];
- * $timeNow = microtime(true);
- * $elapsed = $timeNow - $timeStart;
- * echo "<!-- page rendered in {$elapsed} seconds -->";
- * }
- *
- *
- * Take a look at the docblock descriptions of each hook to get a sense of where
- * in the view rendering process the hook is invoked.
- *
- */
-
-/**
- * hook_before_all
- *
- * This hook is executed before any other hooks. It can be used for any
- * pre-processing logic.
- */
-function hook_before_all() {}
-
-/**
- * hook_before_header
- *
- * This hook is executed before the contents of the header file are processed.
- */
-function hook_before_header() {}
-
-/**
- * hook_before_view
- *
- * This hook is executed before the contents of the main view are processed.
- */
-function hook_before_view() {}
-
-/**
- * hook_before_footer
- *
- * This hook is executed before the contents of the footer are processed
- */
-function hook_before_footer() {}
-
-/**
- * hook_before_send
- *
- * This hook is after all of the view components (header, view, footer) have been
- * processed but before the processed results are sent out across the wire to the
- * browser. HTTP headers have not yet been sent to the browser.
- */
-function hook_before_send() {}
-
-/**
- * hook_after_send
- *
- * This hook is after all of the view components (header, view, footer) have been
- * processed and sent out across the wire to the browser. It can be used for logging
- * or analytics purposes, or to append a common trailer to all content.
- */
-function hook_after_send() {
- $timeStart = $GLOBALS['balance_request_start'];
- $timeEnd = microtime(true);
- $elapsed = $timeEnd - $timeStart;
-
- echo "\r\n<!-- page rendered in {$elapsed} seconds -->";
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/etc/skel/index.php
----------------------------------------------------------------------
diff --git a/balance/etc/skel/index.php b/balance/etc/skel/index.php
deleted file mode 100644
index e02633d..0000000
--- a/balance/etc/skel/index.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * OODT Balance
- * Web Application Base Framework
- *
- * Front-controller
- * This file handles the marshalling of requests to the appropriate
- * application view.
- *
- */
-define ("DEBUG", true); // Change this to `false` when no longer debugging
-
-// Application root directory path (should never need to change this)
-define ("HOME", dirname(__FILE__));
-
-/* Set up application environment ***************************************/
-require_once("Org/Apache/Oodt/Balance/Boot/bootstrap.php");
-
-/* Initialize the application with the settings from config.ini *********/
-$app = $GLOBALS['app'] = App::Create(parse_ini_file(HOME . '/config.ini'));
-
-/* Initialize any globally required modules here ************************/
-// Example:
-// To load a module 'foo', located at ./modules/foo, on every request:
-// App::Get()->loadModule('foo');
-
-/* Generate and send a response to the browser **************************/
-$response = $app->getResponse()->send();
-
-/* Clean up after ourselves *********************************************/
-$app->cleanup();
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/etc/skel/scripts/widgets/BreadcrumbsWidget.php
----------------------------------------------------------------------
diff --git a/balance/etc/skel/scripts/widgets/BreadcrumbsWidget.php b/balance/etc/skel/scripts/widgets/BreadcrumbsWidget.php
deleted file mode 100644
index 571186e..0000000
--- a/balance/etc/skel/scripts/widgets/BreadcrumbsWidget.php
+++ /dev/null
@@ -1,101 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * BREADCRUMB DISPLAY WIDGET
- *
- * Widget to display basic information about the current page. It allows
- * users to keep track of their locations within the website.
- *
- * These breadcrumbs will allow the user to return to parent pages when a
- * a link is provided.
- *
- * Initialization BreadcrumbsWidget:
- * $bcw = new BreadcrumbsWidget( $options = array());
- *
- * supported options:
- * 'separator' => "(string) specifying the html that should separate breadcrumbs"
- *
- * *NOTE*: the class also recognizes the `breadcrumbs_separator` application config
- * setting. If this setting is present within the application config.ini file,
- * the value will be used as the separator;
- *
- *
- * Adding a label breadcrumb (no link):
- * $bcw->add('Label');
- *
- * Adding a linked label breadcrumb:
- * $bcw->add('Label','link_href');
- *
- *
- */
-
-class BreadcrumbsWidget
- implements Org_Apache_Oodt_Balance_Interfaces_IApplicationWidget {
-
- protected $separator = ' → ';
-
- public function __construct($options = array()) {
-
- // Check if the breadcrumbs_separator config setting has been set
- if (isset(App::Get()->settings['breadcrumbs_separator'])) {
- $this->separator = App::Get()->settings['breadcrumbs_separator'];
- }
-
- // If the 'separator' option has been passed, prefer it
- if (isset($options['separator'])) {
- $this->separator = $options['separator'];
- }
- }
-
- public function add( $label = null, $link = null) {
- $breadcrumbs = App::Get()->response->data('breadcrumbs');
- if ( $label != null && $link != null ) {
-
- // will show up as a linked label
- $breadcrumbs[] = array($label,$link);
- } elseif ( $label != null ) {
-
- // will show up as just text
- $breadcrumbs[] = $label;
- } else
- return 0;
-
- App::Get()->response->data("breadcrumbs",$breadcrumbs);
- }
-
- public function render($bEcho = true) {
- $str = '';
- $data = App::Get()->response->data('breadcrumbs');
- if ( !empty($data) ) {
- foreach ($data as $bc) {
- if (is_array($bc)) {
- $str .= '<span class="crumb link"><a href="'.$bc[1].'">'.$bc[0]."</a></span>{$this->separator}";
- } else {
- $str .= '<span class="crumb text">'.$bc.'</span>';
- }
- }
- }
-
- if($bEcho) {
- echo $str;
- } else {
- return $str;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/etc/skel/static/css/balance/balance.css
----------------------------------------------------------------------
diff --git a/balance/etc/skel/static/css/balance/balance.css b/balance/etc/skel/static/css/balance/balance.css
deleted file mode 100644
index e32eb68..0000000
--- a/balance/etc/skel/static/css/balance/balance.css
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/***** RESET *************************************************************/
-html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p,
-blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em,
-img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u,
-i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table,
-caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details,
-embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby,
-section, summary, time, mark, audio, video {
- margin: 0;
- padding: 0;
- border: 0;
- font-size: 100%;
- font: inherit;
- vertical-align: baseline;
-}
-/* HTML5 display-role reset for older browsers */
-article, aside, details, figcaption, figure,
-footer, header, hgroup, menu, nav, section {
- display: block;
-}
-body {
- line-height: 1;
-}
-ol, ul {
- list-style: none;
-}
-blockquote, q {
- quotes: none;
-}
-blockquote:before, blockquote:after,
-q:before, q:after {
- content: '';
- content: none;
-}
-table {
- border-collapse: collapse;
- border-spacing: 0;
-}
-
-/***** BALANCE DEFAULTS *********************************************/
-
-html,body {
- font-family:arial,verdana,sans-serif;
- font-size:1em;
- font-weight:normal;
- color:#000;
- line-height:1.5em;
-}
-
-h1, h2, h3, h4, h5 {
- margin:10px 0;
-}
-
-h1 {
- font-size:2.1em;
- font-weight:bold;
- margin:15px 0;
-}
-
-h2 {
- font-size:1.8em;
- font-weight:bold;
- margin:12px 0;
-}
-
-h3 {
- font-size:1.4em;
- font-weight:bold;
-}
-
-h4 {
- font-size:1.2em;
- font-weight:bold;
-}
-
-h5 {
- font-size:1em;
- font-weight:bold;
-}
-
-div.container {
- width:960px;
- margin:10px auto;
-}
-
-
-/**
- * Balance Widget Styling
- */
-
-div.bal_widget {
- border:solid 1px #ccc;
- padding:5px;
-}
-
-/**
- * Balance default footer styling
- */
-div.bal_footer {
- color:#888;
- font-size:80%;
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/etc/skel/static/css/site.css
----------------------------------------------------------------------
diff --git a/balance/etc/skel/static/css/site.css b/balance/etc/skel/static/css/site.css
deleted file mode 100644
index 37fd84b..0000000
--- a/balance/etc/skel/static/css/site.css
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * Place site CSS statements here
- **/
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/etc/skel/views/common/footer.php
----------------------------------------------------------------------
diff --git a/balance/etc/skel/views/common/footer.php b/balance/etc/skel/views/common/footer.php
deleted file mode 100644
index bb45547..0000000
--- a/balance/etc/skel/views/common/footer.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * Application Footer File
- *
- * This file represents a sample application footer file that will be displayed
- * with every application view (unless the view has explicitly requested
- * a different footer file, or no footer at all). To customize the footer
- * file, you have two options:
- *
- * 1) make changes to this file directly
- * 2) create a new footer file, and update config.ini to point to it, instead
- */
-?>
-
-<div class="bal_footer">
- Created with OODT Balance v.<?php echo BALANCE_VERSION ?>
-</div>
-<!-- html closing statements -->
-</div>
-</body>
-</html>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/etc/skel/views/common/header.php
----------------------------------------------------------------------
diff --git a/balance/etc/skel/views/common/header.php b/balance/etc/skel/views/common/header.php
deleted file mode 100644
index df5dc1f..0000000
--- a/balance/etc/skel/views/common/header.php
+++ /dev/null
@@ -1,56 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * Application Header File
- *
- * This file represents a sample application header file that will be displayed
- * with every application view (unless the view has explicitly requested
- * a different header file, or no header file at all). To customize the header
- * file, you have two options:
- *
- * 1) make changes to this file directly
- * 2) create a new header file, and update config.ini to point to it, instead
- */
-?>
-<!DOCTYPE html>
-<html>
-<head>
-<title>Untitled OODT Balance Application</title>
-
-<!-- Base stylesheets -->
-<link rel="stylesheet" type="text/css" href="<?php echo SITE_ROOT .'/static/css/balance/balance.css'?>"/>
-
-<!-- Base Javascript -->
-
-<!-- Dynamically Added Stylesheets -->
-<!-- STYLESHEETS -->
-
-<!-- Dynamically Added Javascripts -->
-<!-- JAVASCRIPTS -->
-
-<!-- Site specific stylesheet overrides -->
-<link rel="stylesheet" type="text/css" href="<?php echo SITE_ROOT .'/static/css/site.css'?>"/>
-
-</head>
-<body>
-<div class="container">
-<?php
- // This retrieves any 'flash' messages that should be displayed to the user
- echo App::Get()->GetMessages();
-?>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/etc/skel/views/errors/403.php
----------------------------------------------------------------------
diff --git a/balance/etc/skel/views/errors/403.php b/balance/etc/skel/views/errors/403.php
deleted file mode 100644
index 9e87eab..0000000
--- a/balance/etc/skel/views/errors/403.php
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Prepare BreadcrumbsWigdet
-require_once( HOME . '/scripts/widgets/BreadcrumbsWidget.php');
-$bcw = new BreadcrumbsWidget();
-$bcw->add('Home',SITE_ROOT . '/');
-$bcw->add('Access Forbidden');
-?>
-
-<div id="page_content">
- <h2> 403 Access Forbidden </h2>
- <h5> You are not authorized to view the requested resource. If you feel this is in error, please
- contact the webmaster for this site </h5>
-</div>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/etc/skel/views/errors/404.php
----------------------------------------------------------------------
diff --git a/balance/etc/skel/views/errors/404.php b/balance/etc/skel/views/errors/404.php
deleted file mode 100644
index 4f40a82..0000000
--- a/balance/etc/skel/views/errors/404.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Prepare BreadcrumbsWigdet
-require_once( HOME . '/scripts/widgets/BreadcrumbsWidget.php');
-$bcw = new BreadcrumbsWidget();
-$bcw->add('Home',SITE_ROOT . '/');
-$bcw->add('Not Found');
-?>
-
-<div id="page_content">
- <h2> 404 Not Found </h2>
- <h5> The requested resource (<?php echo App::Get()->request->uri?>) does not exist.</h5>
-</div>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/etc/skel/views/index.php
----------------------------------------------------------------------
diff --git a/balance/etc/skel/views/index.php b/balance/etc/skel/views/index.php
deleted file mode 100644
index 9d65e00..0000000
--- a/balance/etc/skel/views/index.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<!--
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
--->
-<p> </p>
-<h1>Hello from OODT Balance</h1>
-
-<div class="box">
- <h5>To configure your application:</h5>
- <code>file://<?php echo HOME?>/config.ini</code>
-</div>
-
-<div class="box">
- <h5>To edit this view:</h5>
- <code>file://<?php echo HOME?>/views/index.php</code>
-</div>
-
-<div class="box">
- <h5>For more information:</h5>
- <a href="http://oodt.apache.org">http://oodt.apache.org</a>
-</div>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/lib/pear/Boot/bootstrap.php
----------------------------------------------------------------------
diff --git a/balance/lib/pear/Boot/bootstrap.php b/balance/lib/pear/Boot/bootstrap.php
deleted file mode 100644
index abdcb9d..0000000
--- a/balance/lib/pear/Boot/bootstrap.php
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- *
- * OODT Balance
- * Web Application Base Framework
- *
- * Bootstrap file to provide all framework base files necessary to
- * satisfy a resource request.
- *
- * @author ahart
- *
- */
-
-define("BALANCE_VERSION", '0.3-SNAPSHOT');
-
-// Include Required Framework Interfaces
-include("Org/Apache/Oodt/Balance/Interfaces/IApplicationWidget.php");
-include("Org/Apache/Oodt/Balance/Interfaces/IApplicationDataProvider.php");
-include("Org/Apache/Oodt/Balance/Interfaces/IApplicationAuthenticationProvider.php");
-include("Org/Apache/Oodt/Balance/Interfaces/IApplicationAuthorizationProvider.php");
-
-// Include Required Framework Classes
-include("Org/Apache/Oodt/Balance/Core/Application.class.php");
-include("Org/Apache/Oodt/Balance/Core/ApplicationRequest.class.php");
-include("Org/Apache/Oodt/Balance/Core/ApplicationResponse.class.php");
-include("Org/Apache/Oodt/Balance/Core/ApplicationDataResponse.class.php");
-
-
-class App {
-
- protected static $app = null;
-
- public static function Create($config) {
- if (!self::$app) {
- self::$app = new Org_Apache_Oodt_Balance_Core_Application($config);
- }
- return self::$app;
- }
-
- public static function Get() {
- return self::$app;
- }
-}
[24/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/grid/src/main/java/org/apache/oodt/grid/ProfileQueryServlet.java
----------------------------------------------------------------------
diff --git a/grid/src/main/java/org/apache/oodt/grid/ProfileQueryServlet.java b/grid/src/main/java/org/apache/oodt/grid/ProfileQueryServlet.java
deleted file mode 100755
index 478202d..0000000
--- a/grid/src/main/java/org/apache/oodt/grid/ProfileQueryServlet.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.grid;
-
-import org.apache.oodt.profile.Profile;
-import org.apache.oodt.profile.handlers.ProfileHandler;
-import org.apache.oodt.xmlquery.QueryElement;
-import org.apache.oodt.xmlquery.XMLQuery;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
-import java.io.IOException;
-import java.util.*;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-
-/**
- * Profile query servlet handles profile queries. It returns every matching profile from
- * every query handler that provides matching profiles. If no handlers are installed,
- * then it returns an empty <profiles> document.
- *
- */
-public class ProfileQueryServlet extends QueryServlet {
- /** {@inheritDoc} */
- protected List getServers(Configuration config) {
- return config.getProfileServers();
- }
-
- /** {@inheritDoc} */
- protected void handleQuery(XMLQuery query, List handlers, HttpServletRequest req, HttpServletResponse res)
- throws IOException {
- // Find if the query should be targeted to specific handlers.
- Set ids = new HashSet();
- if (query.getFromElementSet() != null) {
- for (Object o : query.getFromElementSet()) {
- QueryElement qe = (QueryElement) o;
- if ("handler".equals(qe.getRole()) && qe.getValue() != null) {
- ids.add(qe.getValue());
- }
- }
- }
-
- res.setContentType("text/xml"); // XML, comin' at ya
- res.getWriter().println("<?xml version='1.0' encoding='UTF-8'?>"); // UTF-8 no less. Boo-ya.
- res.getWriter().println("<!DOCTYPE profiles PUBLIC '" // Get a doctype in there for the highly ...
- + Profile.PROFILES_DTD_FPI + "' '" // ... anal ...
- + Profile.PROFILES_DTD_URL + "'>"); // ... retentive.
- res.getWriter().println("<profiles>"); // Start tag for the whole /sbin/fsck mess
- Transformer transformer = null; // Start out w/no transformer and no doc
- Document doc = null; // Don't make 'em if we don't need 'em
- boolean sentAtLeastOne = false; // Track if we send any profiles at all
- Exception exception = null; // And save any exception
- for (Object handler1 : handlers) {
- try { // To iterate over each handler
- ProfileHandler handler = (ProfileHandler) handler1; // Get the handler
- String id = handler.getID(); // Get the ID, and if targeting to IDs
- if (!ids.isEmpty() && !ids.contains(id)) {
- continue; // ... and it's not one we want, skip it.
- }
- List results = handler.findProfiles(query); // Have it find profiles
- if (results == null) {
- results = Collections.EMPTY_LIST; // Assume nothing
- }
- for (Object result1 : results) { // For each matching profile
- Profile profile = (Profile) result1; // Get the profile
- if (transformer == null) { // No transformer/doc yet?
- transformer = createTransformer(); // Then make the transformer
- doc = Profile.createProfileDocument(); // And the doc
- } // And use the doc ...
- Node profileNode = profile.toXML(doc); // To render the profile into XML
- DOMSource source = new DOMSource(profileNode); // And the XML becomes is source
- StreamResult result = new StreamResult(res.getWriter()); // And the response is a result
- transformer.transform(source, result); // And serialize into glorious text
- sentAtLeastOne = true; // OK, we got at least one out the doo
- }
- } catch (Exception ex) { // Uh oh
- exception = ex; // OK, just hold onto it for now
- }
- }
- if (!sentAtLeastOne && exception != null) { // Got none out the door and had an error?
- res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, // Then we can report it.
- exception.getMessage());
- return;
- }
-
- // However, if we get here, we got at least one profile out the door. In
- // that case, hide any error that might've occurred from subsequent
- // handlers. (Or, if we get here, there were no errors. Yay.)
- res.getWriter().println("</profiles>"); // End tag for the whole fsck'n mess
- }
-
- /**
- * Create a transformer, properly configured for XML text serialization.
- *
- * @return a <code>Transformer</code> value.
- * @throws TransformerException if an error occurs.
- */
- private static Transformer createTransformer() throws TransformerException {
- Transformer transformer;
- synchronized (TRANSFORMER_FACTORY) {
- transformer = TRANSFORMER_FACTORY.newTransformer();
- }
- transformer.setOutputProperty(OutputKeys.METHOD, "xml");
- transformer.setOutputProperty(OutputKeys.VERSION, "1.0");
- transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
- transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
- transformer.setOutputProperty(OutputKeys.STANDALONE, "no");
- transformer.setOutputProperty(OutputKeys.INDENT, "yes");
- transformer.setOutputProperty(OutputKeys.MEDIA_TYPE, "text/xml");
- transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
-
- return transformer;
- }
-
- /** Sole transformer factory this class will ever need. */
- private static final TransformerFactory TRANSFORMER_FACTORY = TransformerFactory.newInstance();
-}
-
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/grid/src/main/java/org/apache/oodt/grid/ProfileServer.java
----------------------------------------------------------------------
diff --git a/grid/src/main/java/org/apache/oodt/grid/ProfileServer.java b/grid/src/main/java/org/apache/oodt/grid/ProfileServer.java
deleted file mode 100755
index f273fa6..0000000
--- a/grid/src/main/java/org/apache/oodt/grid/ProfileServer.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.grid;
-
-import org.apache.oodt.profile.handlers.ProfileHandler;
-
-/**
- * A profile server.
- *
- */
-public class ProfileServer extends Server {
- /**
- * Creates a new <code>ProfileServer</code> instance.
- *
- * @param configuration
- * System configuration.
- * @param className
- * Class name of profile handler.
- */
- public ProfileServer(Configuration configuration, String className) {
- super(configuration, className);
- }
-
- /** {@inheritDoc} */
- protected String getType() {
- return "profile";
- }
-
- public int hashCode() {
- return super.hashCode() ^ 0x55555555;
- }
-
- public boolean equals(Object obj) {
- return super.equals(obj) && obj instanceof ProfileServer;
- }
-
- public String toString() {
- return "ProfileServer[" + super.toString() + "]";
- }
-
- /**
- * Create a query handler from this server.
- *
- * @return a <code>ProfileHandler</code> value.
- * @throws ClassNotFoundException
- * if the class can't be found.
- * @throws InstantiationException
- * if the handler can't be instantiated.
- * @throws IllegalAccessException
- * if the handler has no public constructor.
- */
- public ProfileHandler createProfileHandler() throws ClassNotFoundException,
- InstantiationException, IllegalAccessException {
- return (ProfileHandler) createHandler();
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/grid/src/main/java/org/apache/oodt/grid/QueryServlet.java
----------------------------------------------------------------------
diff --git a/grid/src/main/java/org/apache/oodt/grid/QueryServlet.java b/grid/src/main/java/org/apache/oodt/grid/QueryServlet.java
deleted file mode 100755
index 13f902e..0000000
--- a/grid/src/main/java/org/apache/oodt/grid/QueryServlet.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.grid;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Properties;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import org.xml.sax.SAXException;
-import org.apache.oodt.xmlquery.XMLQuery;
-
-/**
- * Query servlet provides common query functionality for profile queries and product
- * queries. It treats GETs as POSTs, retrieves the complete XMLQuery (if the
- * <code>xmlq</code> request parameter appears) or constructs a new XMLQuery (using the
- * <code>q</code> request parameter, which contains just a query expression), updates
- * system properties for the handlers, instantiates any new handlers, and then runs the
- * query.
- *
- */
-public abstract class QueryServlet extends GridServlet {
- /**
- * Get a list of {@link Server}s that will provide handlers to handle the query.
- * Subclasses implement this by returning a list of either {@link ProductServer}s
- * or {@link ProfileServer}s.
- *
- * @param config a <code>Configuration</code> value.
- * @return a <code>List</code> value of {@link Server}s of some kind.
- */
- protected abstract List getServers(Configuration config);
-
- /**
- * Handle the query. Subclasses implement this by parsing the query and returning
- * some results.
- *
- * @param query The query to handle.
- * @param handlers A list of either product <code>QueryHandler</code>s or profile <code>ProfileHandler</code>s.
- * @param req a <code>HttpServletRequest</code> value.
- * @param res a <code>HttpServletResponse</code> value.
- * @throws IOException if an I/O error occurs.
- * @throws ServletException if a servlet error occurs.
- */
- protected abstract void handleQuery(XMLQuery query, List handlers, HttpServletRequest req, HttpServletResponse res)
- throws IOException;
-
- /**
- * Treat GETs as POSTs.
- *
- * @param req a <code>HttpServletRequest</code> value.
- * @param res a <code>HttpServletResponse</code> value.
- * @throws IOException if an error occurs.
- * @throws ServletException if an error occurs.
- */
- public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException {
- doPost(req, res);
- }
-
- /**
- * Handle the query.
- *
- * @param req a <code>HttpServletRequest</code> value.
- * @param res a <code>HttpServletResponse</code> value.
- * @throws IOException if an error occurs.
- * @throws ServletException if an error occurs.
- */
- public void doPost(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException {
- try {
- XMLQuery query = getQuery(req, res); // Get the query
- if (query == null) {
- return; // No query? My favorite case, right here!
- }
-
- Configuration config = getConfiguration(); // Get the current configuration.
- updateProperties(config); // Using it, update the system properties
- updateHandlers(getServers(config)); // And any servers.
-
- List handlerObjects = new ArrayList(handlers.size()); // Start with no handlers.
- for (Object handler : handlers) { // For each server
- InstantiedHandler ih = (InstantiedHandler) handler; // Get its handler
- handlerObjects.add(ih.getHandler()); // Add its handler
- }
- handleQuery(query, handlerObjects, req, res); // Handlers: handle query, please
- } catch (RuntimeException ex) {
- throw ex;
- } catch (Exception ex) {
- throw new ServletException(ex);
- }
- }
-
- /**
- * Get the query from an HTTP request. The request must have either a
- * <code>xmlq</code> parameter (which is given priority) or a <code>q</code>
- * parameter. We expect <code>xmlq</code> to contain the XML text format of an
- * XMLQuery object. <code>q</code> can contain just the query expression, from
- * which we'll construct a fresh <code>XMLQuery</code> with reasonable defaults.
- * If the user specifies the <code>q</code> paramater, we'll treat it as a parsed
- * query, letting the XMLQuery class parse it and build its various expression
- * stacks according to the DIS syntax. The user can specify the <code>unp</code>
- * parameter to control this behavior, though. Set to the string
- * <code>true</code> and we'll treat the query as <em>unparsed</em>, and the
- * XMLQuery class should leave it alone. Otherwise, an other value (or
- * unspecified) will be interpreted as <code>false</code>, meaning the query will
- * be parsed.
- *
- * @param req a <code>HttpServletRequest</code> value.
- * @param res a <code>HttpServletResponse</code> value.
- * @return a <code>XMLQuery</code> value.
- * @throws IOException if an error occurs.
- */
- protected XMLQuery getQuery(HttpServletRequest req, HttpServletResponse res) throws IOException {
- String xmlq = req.getParameter("xmlq"); // Grab any xmlq
- String q = req.getParameter("q"); // Grab any q
- String unp = req.getParameter("unp"); // And grab any unp (pronounced "unp")
- if (xmlq == null) {
- xmlq = ""; // No xmlq? Use epsilon
- }
- if (q == null) {
- q = ""; // No q? Use lambda
- }
- if (unp == null) {
- unp = ""; // Use some other greek letter for empty str
- }
- String[] mimes = req.getParameterValues("mime"); // Grab any mimes
- if (mimes == null) {
- mimes = EMPTY_STRING_ARRAY; // None? Use empty array
- }
-
- if (xmlq.length() > 0) {
- try { // Was there an xmlq?
- return new XMLQuery(xmlq); // Use it in its entirety, ignoring the rest
- } catch (SAXException ex) { // Can't parse it?
- res.sendError(HttpServletResponse.SC_BAD_REQUEST, // Then that's a bad ...
- "cannot parse xmlq: " + ex.getMessage()); // ... request, which I hate
- return null; // so flag it with a null
- }
- } else if (q.length() > 0) { // Was there a q?
- boolean unparsed = "true".equals(unp); // If so, was there also an unp?
- return new XMLQuery(q, "wgq", "Web Grid Query", // Use it to make an XMLQuery
- "Query from Web-Grid", /*ddID*/null, // And all of these extra
- /*resultModeId*/null, /*propType*/null, // parameters really annoy
- /*propLevels*/null, /*maxResults*/Integer.MAX_VALUE, // the poop out of me
- Arrays.asList(mimes), !unparsed); // It's just a query for /sbin/fsck sake!
- }
-
- res.sendError(HttpServletResponse.SC_BAD_REQUEST, "xmlq or q parameters required");
- return null;
- }
-
- /**
- * Update the query handlers instantiated.
- *
- * @param servers a <code>List</code> of {@link Server}s.
- * @throws ClassNotFoundException if a class can't be found.
- * @throws InstantiationException if a class can't be instantiated.
- * @throws IllegalAccessException if a constructor isn't public.
- */
- private synchronized void updateHandlers(List servers) throws ClassNotFoundException, InstantiationException,
- IllegalAccessException {
- eachServer:
- for (Object server1 : servers) { // For each server
- Server server = (Server) server1; // Grab the server
- for (Object handler1 : handlers) { // For each handler
- InstantiedHandler handler = (InstantiedHandler) handler1; // Grab the handler
- if (handler.getServer().equals(server)) // Have we already instantiated?
- {
- continue eachServer; // Yes, try the next server
- }
- }
- InstantiedHandler handler // No. Create ...
- = new InstantiedHandler(server, server.createHandler()); // ... a fresh handler
- handlers.add(handler); // Save it
- }
-
- for (Iterator i = handlers.iterator(); i.hasNext();) { // Now, for each handler
- InstantiedHandler handler = (InstantiedHandler) i.next(); // Grab the handler
- if (!servers.contains(handler.getServer())) // Does its server still exist?
- {
- i.remove(); // If not, remove the handler
- }
- }
- }
-
- /**
- * Update system properties used by query handlers, if any have changed.
- *
- * @param config a <code>Configuration</code> value.
- */
- private synchronized void updateProperties(Configuration config) {
- if (properties != null) { // Any old properties?
- if (properties.equals(config.getProperties())) {
- return; // Yes, any changes? No? Then done.
- }
- for (Object o : properties.keySet()) {
- System.getProperties().remove(o); // and remove it.
- }
- }
- properties = (Properties) config.getProperties().clone(); // Now copy the new settings
- System.getProperties().putAll(properties); // And set them!
- }
-
- /**
- * Instantiated query handlers.
- *
- * These are either <code>ProfileHandler</code>s or product <code>QueryHandler</code>s.
- */
- protected List handlers = new ArrayList();
-
- /** Current settings of system properties. */
- private Properties properties;
-
- /**
- * An instantiated handler. This is a <code>ProfileHandler</code> or a product
- * <code>QueryHandler</code> along with the {@link Server} that defined it.
- */
- private static class InstantiedHandler {
- /**
- * Creates a new <code>InstantiedHandler</code> instance.
- *
- * @param server a <code>Server</code>.
- * @param handler a <code>ProfileHandler</code> or a product <code>QueryHandler</code>.
- */
- InstantiedHandler(Server server, Object handler) {
- this.server = server;
- this.handler = handler;
- }
-
- /**
- * Get the server that defined this handler.
- *
- * @return a <code>Server</code> value.
- */
- public Server getServer() {
- return server;
- }
-
- /**
- * Get the handler.
- *
- * @return a <code>ProfileHandler</code> or a product <code>QueryHandler</code>.
- */
- public Object getHandler() {
- return handler;
- }
-
- /** Server that defines the handler. */
- private Server server;
-
- /** A <code>ProfileHandler</code> or a product <code>QueryHandler</code> */
- private Object handler;
- }
-
- /** So we don't create a bunch of empty string arrays, here's the only one we'll ever need. */
- private static final String[] EMPTY_STRING_ARRAY = new String[0];
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/grid/src/main/java/org/apache/oodt/grid/RestfulProductQueryServlet.java
----------------------------------------------------------------------
diff --git a/grid/src/main/java/org/apache/oodt/grid/RestfulProductQueryServlet.java b/grid/src/main/java/org/apache/oodt/grid/RestfulProductQueryServlet.java
deleted file mode 100644
index 4b7068b..0000000
--- a/grid/src/main/java/org/apache/oodt/grid/RestfulProductQueryServlet.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.grid;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Enumeration;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.oodt.xmlquery.XMLQuery;
-
-/**
- * The {@link RestfulProductQueryServlet} is an alternative to the standard {@link ProductQueryServlet}
- * that allows clients to use a more intuitive syntax for encoding query constraints, than the traditional
- * DIS-style syntax.
- * For example, instead of encoding a request as:
- * "?q=identifier+EQ+urn:nasa:pds:phx_lidar:reduced:LS075RLS_00902835894_1885M1+AND+package+EQ+TGZ"
- * a client could encode it as:
- * "?identifier=urn:nasa:pds:phx_lidar:reduced:LS075RLS_00902835894_1885M1&package=TGZ".
- * Note that this servlet is meant to be back-ward compatible, i.e. it will first process a request by
- * parsing the "xmlq=" and "q=" parameters. If those are not found, it will build a request by combining
- * all the available HTTP parameters in logical AND.
- * Note also that this servlet is NOT enabled by default
- * (i.e. it must be explicitly configured by changing the web-grid deployment descriptor web.xml).
- *
- * @author Luca Cinquini
- *
- */
-public class RestfulProductQueryServlet extends ProductQueryServlet {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * Overridden implementation that defaults to the standard behavior if the parameters "q" or "xmlq" are found,
- * otherwise it uses the available request parameters to build a constraint query with logical AND.
- */
- @Override
- protected XMLQuery getQuery(HttpServletRequest req, HttpServletResponse res) throws IOException {
-
- // if DIS-style parameters are found, default to standard processing
- if (req.getParameter("xmlq") !=null || req.getParameter("q")!=null) {
- return super.getQuery(req, res);
-
- // combine all HTTP (name, value) pairs into XML query string with logical AND
- } else {
-
- StringBuilder q = new StringBuilder("");
- Enumeration<String> parameterNames = req.getParameterNames();
- while (parameterNames.hasMoreElements()) {
- String paramName = parameterNames.nextElement();
- String[] paramValues = req.getParameterValues(paramName);
- for (String paramValue : paramValues) {
- if (q.length() > 0) {
- q.append(" AND ");
- }
- q.append(paramName).append(" EQ ").append(paramValue);
- }
- }
-
- // build XMLQuery object from HTTP parameters
- // no need to URL-encode since this request doesn't go over the network
- System.out.println("Executing query="+q.toString());
- return new XMLQuery(q.toString(), "wgq", "Web Grid Query",
- "Query from Web-Grid", /*ddID*/null,
- /*resultModeId*/null, /*propType*/null,
- /*propLevels*/null, /*maxResults*/Integer.MAX_VALUE,
- new ArrayList<String>(), true);
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/grid/src/main/java/org/apache/oodt/grid/Server.java
----------------------------------------------------------------------
diff --git a/grid/src/main/java/org/apache/oodt/grid/Server.java b/grid/src/main/java/org/apache/oodt/grid/Server.java
deleted file mode 100755
index 84185e1..0000000
--- a/grid/src/main/java/org/apache/oodt/grid/Server.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.grid;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.xml.sax.SAXException;
-
-import java.io.Serializable;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.List;
-
-/**
- * An abstract server defines the code base and class name of a query handler.
- *
- */
-public abstract class Server implements Serializable {
- /**
- * Creates a new <code>Server</code> instance.
- *
- * @param configuration
- * System configuration.
- * @param className
- * Class name of the query handler.
- */
- public Server(Configuration configuration, String className) {
- this.configuration = configuration;
- this.className = className;
- }
-
- /**
- * Render this server into XML.
- *
- * @param owner
- * Owning document.
- * @return This server, as XML.
- */
- public Node toXML(Document owner) {
- Element elem = owner.createElement("server");
- elem.setAttribute("className", className);
- elem.setAttribute("type", getType());
- return elem;
- }
-
- /**
- * Get the class name of the query handler.
- *
- * @return Class name of the query handler.
- */
- public String getClassName() {
- return className;
- }
-
- /**
- * Create the handler.
- *
- * @return an instantiated handlre.
- * @throws ClassNotFoundException
- * if the handler class can't be found.
- * @throws InstantiationException
- * if the handler object can't be created.
- * @throws IllegalAccessException
- * if the handler class doesn't provide a public no-args
- * constructor.
- */
- public Object createHandler() throws ClassNotFoundException,
- InstantiationException, IllegalAccessException {
- List urlList = configuration.getCodeBases();
- Class clazz;
- if (urlList.isEmpty()) {
- clazz = Class.forName(className);
- } else {
- URL[] urls = (URL[]) urlList.toArray(new URL[urlList.size()]);
- URLClassLoader loader = new URLClassLoader(urls, getClass()
- .getClassLoader());
- clazz = loader.loadClass(className);
- }
- return clazz.newInstance();
- }
-
- /**
- * Set the class name of the handler.
- *
- * @param className
- * Class name of the handler.
- */
- public void setClassName(String className) {
- this.className = className;
- }
-
- /**
- * Return the type of the handler.
- *
- * @return Either <code>product</code> or <code>profile</code>.
- */
- protected abstract String getType();
-
- public int hashCode() {
- return configuration.hashCode() ^ className.hashCode();
- }
-
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- }
- if (obj instanceof Server) {
- Server rhs = (Server) obj;
- return className.equals(rhs.className);
- }
- return false;
- }
-
- public String toString() {
- return "Server[className=" + className + "]";
- }
-
- /**
- * Create a server from an XML element.
- *
- * @param elem
- * XML element, presumed to be a <server> element.
- * @return a <code>Server</code> subclass.
- * @throws SAXException
- * if the element can't be properly parsed.
- */
- public static Server create(Configuration configuration, Element elem)
- throws SAXException {
- String type = elem.getAttribute("type");
-
- String className = elem.getAttribute("className");
-
- // Replace with a factory some day...
- if ("product".equals(type)) {
- return new ProductServer(configuration, className);
- } else if ("profile".equals(type)) {
- return new ProfileServer(configuration, className);
- } else {
- throw new SAXException("unknown server type `" + type + "'");
- }
- }
-
- /** Configuration. */
- protected Configuration configuration;
-
- /** Class name of the handler class. */
- protected String className;
-
- private static final URL[] EMPTY_URL_ARRAY = new URL[0];
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/grid/src/main/java/org/apache/oodt/grid/Utility.java
----------------------------------------------------------------------
diff --git a/grid/src/main/java/org/apache/oodt/grid/Utility.java b/grid/src/main/java/org/apache/oodt/grid/Utility.java
deleted file mode 100755
index e160e52..0000000
--- a/grid/src/main/java/org/apache/oodt/grid/Utility.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.grid;
-
-/**
- * Utility methods for web grid.
- *
- */
-public class Utility {
- /**
- * Provide XHTML-safe escaping for a string. Basically, this is the same as
- * XML-escaping, but since some user agents don't recognize
- * <code>&apos;</code>, we use <code>&#39;</code> instead.
- *
- * @param str
- * String to escape.
- * @return <var>str</var> escaped.
- */
- public static String esc(String str) {
- StringBuilder s = new StringBuilder(str.length()); // Assume at least the same
- // length
- for (int i = 0; i < str.length(); ++i) { // For each character
- char c = str.charAt(i); // Grab the character
- switch (c) { // Now consider what it is ...
- case '<': // A less than?
- s.append("<"); // Well, that's <
- break;
- case '>': // A greater than?
- s.append(">"); // That's >
- break;
- case '&': // An ampersand?
- s.append("&"); // We all know what that is
- break;
- case '\'': // A tick?
- s.append("'"); // Not ' ! TRICKY!
- break;
- case '\"': // A quote?
- s.append("""); // Yadda, yadda, yadda
- break;
- default: // Anything else may pass
- s.append(c); // ... through unchanged
- break;
- }
- }
- return s.toString(); // Donenacious.
- }
-
- /**
- * Tell if a host name refers to the localhost. This checks the standard IPv6
- * address, IPv4 address, and host name for localhost.
- *
- * @param host
- * Host name to check.
- * @return True if <var>host</var> names the localhost.
- */
- public static boolean isLocalhost(String host) {
- return "0:0:0:0:0:0:0:1".equals(host) || "127.0.0.1".equals(host)
- || "localhost".equals(host);
- }
-
- /**
- * Do not call.
- */
- private Utility() {
- throw new IllegalStateException("This is a \u00abutility\u00bb class");
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/grid/src/main/webapp/META-INF/context.xml
----------------------------------------------------------------------
diff --git a/grid/src/main/webapp/META-INF/context.xml b/grid/src/main/webapp/META-INF/context.xml
deleted file mode 100755
index a82645f..0000000
--- a/grid/src/main/webapp/META-INF/context.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more contributor
-license agreements. See the NOTICE.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.
--->
-<Context
- cookies='true'
- override='true'
- privileged='false'
- reloadable='false'
- unpackWAR='true'/>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/grid/src/main/webapp/WEB-INF/jetty-web.xml
----------------------------------------------------------------------
diff --git a/grid/src/main/webapp/WEB-INF/jetty-web.xml b/grid/src/main/webapp/WEB-INF/jetty-web.xml
deleted file mode 100755
index 52b2379..0000000
--- a/grid/src/main/webapp/WEB-INF/jetty-web.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more contributor
-license agreements. See the NOTICE.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.
--->
-<!DOCTYPE Configure PUBLIC '-//Mort Bay Consulting//DTD Configure 1.2//EN' 'http://jetty.mortbay.org/configure_1_2.dtd'>
-<Configure class='org.mortbay.jetty.servlet.WebApplicationContext'>
- <Set name='extractWAR'>true</Set>
-</Configure>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/grid/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/grid/src/main/webapp/WEB-INF/web.xml b/grid/src/main/webapp/WEB-INF/web.xml
deleted file mode 100755
index 98dfcef..0000000
--- a/grid/src/main/webapp/WEB-INF/web.xml
+++ /dev/null
@@ -1,86 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more contributor
-license agreements. See the NOTICE.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.
--->
-<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
-<web-app>
- <icon>
- <small-icon>images/webapp-small.png</small-icon>
- <large-icon>images/webapp-large.png</large-icon>
- </icon>
- <display-name>Web Grid</display-name>
- <description>
- Web Grid is an OODT web application that provides HTTP based
- access to OODT profile and product query handlers. It also
- includes web accessible configuration and updates with a simple
- administrative security policy.
- </description>
- <distributable/>
- <servlet>
- <servlet-name>product</servlet-name>
- <display-name>Product</display-name>
- <description>
- </description>
- <servlet-class>org.apache.oodt.grid.ProductQueryServlet</servlet-class>
- </servlet>
- <servlet>
- <servlet-name>profile</servlet-name>
- <display-name>Profile</display-name>
- <description>
- </description>
- <servlet-class>org.apache.oodt.grid.ProfileQueryServlet</servlet-class>
- </servlet>
- <servlet>
- <servlet-name>config</servlet-name>
- <display-name>Configure</display-name>
- <description>
- </description>
- <servlet-class>org.apache.oodt.grid.ConfigServlet</servlet-class>
- </servlet>
- <servlet>
- <servlet-name>login</servlet-name>
- <display-name>Login</display-name>
- <description>
- </description>
- <servlet-class>org.apache.oodt.grid.LoginServlet</servlet-class>
- </servlet>
- <servlet-mapping>
- <servlet-name>product</servlet-name>
- <url-pattern>/prod</url-pattern>
- </servlet-mapping>
- <servlet-mapping>
- <servlet-name>profile</servlet-name>
- <url-pattern>/prof</url-pattern>
- </servlet-mapping>
- <servlet-mapping>
- <servlet-name>config</servlet-name>
- <url-pattern>/conf</url-pattern>
- </servlet-mapping>
- <servlet-mapping>
- <servlet-name>login</servlet-name>
- <url-pattern>/login</url-pattern>
- </servlet-mapping>
- <session-config>
- <session-timeout>0</session-timeout>
- </session-config>
- <welcome-file-list>
- <welcome-file>index.html</welcome-file>
- </welcome-file-list>
- <error-page>
- <exception-type>org.apache.oodt.grid.AuthenticationRequiredException</exception-type>
- <location>/error.jsp</location>
- </error-page>
-</web-app>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/grid/src/main/webapp/config.jsp
----------------------------------------------------------------------
diff --git a/grid/src/main/webapp/config.jsp b/grid/src/main/webapp/config.jsp
deleted file mode 100755
index 1c5c699..0000000
--- a/grid/src/main/webapp/config.jsp
+++ /dev/null
@@ -1,205 +0,0 @@
-<%@ page language="java" session="true" contentType="text/html; charset=UTF-8" info="Config" errorPage="error.jsp"
- import="java.util.Map,java.util.Iterator,org.apache.oodt.grid.Server,org.apache.oodt.grid.Utility,java.net.URL" %>
-<!--
-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.
--->
-<jsp:useBean id="cb" scope="session" class="org.apache.oodt.grid.ConfigBean"/>
-<?xml version='1.0' encoding='UTF-8'?>
-<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
-<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
- <head>
- <title>Web Grid Configuration</title>
- <link rel='stylesheet' type='text/css' href='style.css'/>
- </head>
- <body>
- <h1>Web Grid Configuration</h1>
-
- <% if (cb.getMessage().length() > 0) { %>
- <div class='error'><jsp:getProperty name='cb' property='message'/></div>
- <% } %>
-
- <form action='conf' method='post'>
-
- <fieldset>
- <legend>Administrative Settings</legend>
- <div class='field'>
- <label for='passwordField'>New Administrator Password</label>
- <div class='fieldHelp'>
- Leave blank to leave password unchanged.
- </div>
- <input id='passwordField' type='password' name='password'/>
- </div>
-
- <div class='field'>
- <label for='lhf'>Require Administrative Access from Local Host Only</label>
- <div class='fieldHelp'>
- Click Yes to enable administrative access from browsers
- running on the local web-server host only. Click No to
- allow any host to access these administrative pages.
- </div>
- <input id='lhf' type='radio' name='localhost' value='on' <%= cb.isLocalhostRequired()? "checked='checked'" : "" %> />Yes
- <input type='radio' name='localhost' value='off' <%= !cb.isLocalhostRequired()? "checked='checked'" : "" %> />No
- </div>
-
- <div class='field'>
- <label for='httpsField'>Require HTTPS for Administrative Access</label>
- <div class='fieldHelp'>
- Click Yes to require HTTPS for access to these administrative pages. Note that this will require
- your web server to also support HTTPS. If you're not sure, <strong>click No</strong>.
- </div>
- <input id='httpsField' type='radio' name='https' value='on' <%= cb.isHttpsRequired()? "checked='checked'" : "" %> />Yes
- <input type='radio' name='https' value='off' <%= !cb.isHttpsRequired()? "checked='checked'" : "" %> />No
- </div>
- </fieldset>
-
- <fieldset>
- <legend>System Properties</legend>
- <div class='field'>
- <div class='fieldHelp'>To add a new system property, enter
- its key and value at the bottom. You can change the values
- of existing properties. To delete an existing property,
- check the box to its right.</div>
- <table>
- <thead><tr><th>#</th><th>Key</th><th>Value</th><th>Delete?</th></tr></thead>
- <tbody>
- <% int row = 1; for (Iterator i = cb.getProperties().entrySet().iterator(); i.hasNext(); ++row) {
- Map.Entry entry = (Map.Entry) i.next();
- String key = (String) entry.getKey();
- String val = (String) entry.getValue();
- %>
- <tr class='<%= row % 2 == 0? "evenRow" : "oddRow"%>'>
- <td><%= row %>.</td>
- <td><span class='key'><%= Utility.esc(key) %></span></td>
- <td><input type='text' name='val-<%= Utility.esc(key) %>' value='<%= Utility.esc(val) %>'/></td>
- <td><input type='checkbox' name='del-<%= Utility.esc(key) %>'/></td>
- </tr>
- <% } %>
- <tr class='newRow'>
- <td>(New)</td>
- <td><input type='text' id='newkey' name='newkey'/></td>
- <td><input type='text' id='newval' name='newval'/></td>
- <td> </td>
- </tr>
- </tbody>
- </table>
- </div>
- </fieldset>
-
- <fieldset>
- <legend>Code Bases</legend>
- <div class='fieldHelp'>Specify a URL for each code base. URLs
- to files are assumed to be jar files. URLs that end in a
- <code>/</code> refer to directories containing class files.
- Check the box to delete a code base.
- </div>
-
- <table>
- <thead><tr><th>#</th><th>Code Base</th><th>Delete?</th></thead>
- <tbody>
- <% row = 0; for (Iterator i = cb.getConfiguration().getCodeBases().iterator(); i.hasNext(); ++row) {
- URL codeBaseURL = (URL) i.next();
- %>
- <tr class='<%= row+1 % 2 == 0? "evenRow" : "oddRow"%>'>
- <td><%= row+1 %>.</td>
- <td><%= Utility.esc(codeBaseURL.toString()) %></td>
- <td><input type='checkbox' name='delcb-<%= row %>'/></td>
- </tr>
- <% } %>
- <tr class='newRow'>
- <td>(New)</td>
- <td><input type='text' name='newcb'/></td>
- <td> </td>
- </tr>
- </tbody>
- </table>
- </fieldset>
-
- <table>
- <caption>Query Handlers</caption>
- <tbody>
- <tr style="vertical-align: top;">
- <td>
- <fieldset>
- <legend>Product Query Handlers</legend>
- <div class='field'>
- <div class='fieldHelp'>Specify the class name for each
- product query handler; the class must implement the
- <code>org.apache.oodt.product.QueryHandler</code> interface.</div>
- <table>
- <thead><tr><th>#</th><th>Class Name</th><th>Delete?</th></tr></thead>
- <tbody>
- <% row = 0; for (Iterator i = cb.getProductServers().iterator(); i.hasNext(); ++row) {
- Server server = (Server) i.next();
- String className = server.getClassName();
- %>
- <tr class='<%= row % 2 == 0? "oddRow" : "evenRow" %>'>
- <td><%= row+1 %>.</td>
- <td><code><%= Utility.esc(className) %></code></td>
- <td><input type='checkbox' name='drm-<%= row %>'/></td>
- </tr>
- <% } %>
- <tr class='newRow'>
- <td>(New)</td>
- <td><input type='text' name='d-newcn'/></td>
- <td> </td>
- </tr>
- </tbody>
- </table>
- </div>
- </fieldset>
- </td>
- <td>
- <fieldset>
- <legend>Profile Query Handlers</legend>
- <div class='field'>
- <div class='fieldHelp'>Specify the class name for each
- profile query handler; the class must implement the
- <code>org.apache.oodt.profile.handlers.ProfileHandler</code> interface.</div>
- <table>
- <thead><tr><th>#</th><th>Class Name</th><th>Delete?</th></tr></thead>
- <tbody>
- <% row = 0; for (Iterator i = cb.getProfileServers().iterator(); i.hasNext(); ++row) {
- Server server = (Server) i.next();
- String className = server.getClassName();
- %>
- <tr class='<%= row % 2 == 0? "oddRow" : "evenRow" %>'>
- <td><%= row+1 %>.</td>
- <td><code><%= Utility.esc(className) %></code></td>
- <td><input type='checkbox' name='mrm-<%= row %>'/></td>
- </tr>
- <% } %>
- <tr class='newRow'>
- <td>(New)</td>
- <td><input type='text' name='m-newcn'/></td>
- <td> </td>
- </tr>
- </tbody>
- </table>
- </div>
- </fieldset>
- </td>
- </tr>
- </tbody>
- </table>
-
- <div class='formControls'>
- <input type='submit' name='submit' value='Save Changes'/>
- </div>
-
- </form>
-
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/grid/src/main/webapp/error.jsp
----------------------------------------------------------------------
diff --git a/grid/src/main/webapp/error.jsp b/grid/src/main/webapp/error.jsp
deleted file mode 100755
index 3305a36..0000000
--- a/grid/src/main/webapp/error.jsp
+++ /dev/null
@@ -1,60 +0,0 @@
-<%@ page language="java" session="true" contentType="text/html; charset=UTF-8" info="Config" isErrorPage="true"
- import="org.apache.oodt.grid.AuthenticationRequiredException,java.io.StringWriter,java.io.PrintWriter"
-%>
-<!--
-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.
--->
-<jsp:useBean id="cb" scope="session" class="org.apache.oodt.grid.ConfigBean"/>
-<?xml version='1.0' encoding='UTF-8'?>
-<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
-<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
- <head>
- <title>Web Grid</title>
- <link rel='stylesheet' type='text/css' href='style.css'/>
- </head>
- <body>
- <%! StringWriter s = new StringWriter();
- PrintWriter w = new PrintWriter(s); %>
- <% exception.printStackTrace(w); w.close(); %>
-
- <h1>Web Grid</h1>
- <% if (cb.getMessage().length() > 0) { %>
- <div class='error'><jsp:getProperty name='cb' property='message'/></div>
- <% } %>
-
- <% if (exception instanceof AuthenticationRequiredException) { %>
- <form action='login' method='post'>
- <fieldset>
- <legend>Log In</legend>
- <div class='field'>
- <label for='pw'>Administrator password:</label>
- <div class='fieldHelp'>
- Passwords are case sensitve; check your CAPS LOCK key, if necessary.
- </div>
- <input id='pw' type='password' name='password'/>
- </div>
- <div class='formControls'>
- <input type='submit' name='submit' value='Log In'/>
- </div>
- </fieldset>
- </form>
- <% } else { %>
- <h1>Error</h1>
- <div>Exception <code><%= exception.getClass().getName() %></code>: <%= exception.getMessage() %></div>
- <pre><%= s.getBuffer().toString() %></pre>
- <% } %>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/grid/src/main/webapp/images/webapp-large.png
----------------------------------------------------------------------
diff --git a/grid/src/main/webapp/images/webapp-large.png b/grid/src/main/webapp/images/webapp-large.png
deleted file mode 100755
index 87a5bb0..0000000
Binary files a/grid/src/main/webapp/images/webapp-large.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/grid/src/main/webapp/images/webapp-small.png
----------------------------------------------------------------------
diff --git a/grid/src/main/webapp/images/webapp-small.png b/grid/src/main/webapp/images/webapp-small.png
deleted file mode 100755
index d0dd963..0000000
Binary files a/grid/src/main/webapp/images/webapp-small.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/grid/src/main/webapp/index.html
----------------------------------------------------------------------
diff --git a/grid/src/main/webapp/index.html b/grid/src/main/webapp/index.html
deleted file mode 100755
index 3d2f161..0000000
--- a/grid/src/main/webapp/index.html
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more contributor
-license agreements. See the NOTICE.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.
--->
-<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
-<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
- <head>
- <title>Web Grid</title>
- <link rel="stylesheet" type="text/css" href="style.css" />
- </head>
- <h1>Web Grid</h1>
- <ul>
- <li><a href='config.jsp'>Configure</a> the system</li>
- <li><a href='http://oodt.jpl.nasa.gov/web-grid/'>Learn more</a> about OODT web-based grid technologies</li>
- </ul>
- <p>OODT is a product of the <a href="http://www.apache.org/">Apache Software Foundation</a>. Check out
- our <a href="http://oodt.apache.org/">web page</a> for more information.
- </p>
-</html>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/grid/src/main/webapp/style.css
----------------------------------------------------------------------
diff --git a/grid/src/main/webapp/style.css b/grid/src/main/webapp/style.css
deleted file mode 100755
index 0cce428..0000000
--- a/grid/src/main/webapp/style.css
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
-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.
-*/
-body {
- font-family: "Lucida Grande", Helvetica, sans;
- background-color: white;
- color: black;
- margin: 2em;
- padding: 0;
- vertical-align: top;
-}
-
-h1 {
- font-size: 160%;
-}
-
-h2 {
- font-size: 150%;
-}
-
-h3 {
- font-size: 140%;
- border-bottom: none;
- font-weight: bold;
-}
-
-fieldset {
- border: 1 solid #336699;
- margin: 1em 0 1em 0;
- padding: 0 1em 1em 1em;
- line-height: 1.5em;
- width: auto;
-}
-
-legend {
- background: white;
- padding: 0.5em;
- font-size: 90%;
-}
-
-form {
- border: none;
- margin: 0;
-}
-
-textarea {
- font: 110% "American Typewriter", Courier, monospace;
- border: 1 solid #369;
- color: black;
- background-color: white;
- width: 100%;
-}
-
-input {
- font-family: <dtml-var fontFamily>;
- visibility: visible;
- border: 1 solid #369;
- color: black;
- background-color: white;
- vertical-align: middle;
-}
-
-select {
- border: 1 solid #369;
- color: black;
- vertical-align: top;
-}
-
-.field {
- top: 0;
- left: 0;
- margin: 0 1em 1em 0;
-}
-
-.field .field {
- margin: 1em 0 0 0;
-}
-
-.field label {
- font-size: 100%;
- font-weight: bold;
-}
-
-.fieldRequired {
- background: url(required.gif) center left no-repeat;
- padding: 0 0 0 8px;
- color: black;
-}
-
-.fieldHelp {
- font-size: 90%;
- color: #666;
- margin: 0 0 0.2em 0;
-}
-
-.formHelp:hover {
- color: black;
- cursor: default;
-}
-
-.formControls {
- margin: 1em 0 0 0;
-}
-
-.error {
- /* Class for error indication in forms */
- color: #ff6633;
- border: 1 solid #ff6633;
- padding: 1em;
- margin: 0 0 1em 0;
- width: 68% !important;
-}
-
-.evenRow {
- background: #eee;
-}
-
-.newRow {
- border-top: solid;
- border-width: 1;
- background: #ffe;
-}
-
-th {
- border-bottom: solid;
- border-width: 1px;
- vertical-align: top;
-}
-
-tr {
- vertical-align: top;
-}
-
-td {
- vertical-align: top;
-}
-
-tbody {
- vertical-align: top;
-}
-
-table {
- vertical-align: top;
-}
-
-caption {
- font-size: 150%
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/grid/src/site/resources/images/web-grid.jpg
----------------------------------------------------------------------
diff --git a/grid/src/site/resources/images/web-grid.jpg b/grid/src/site/resources/images/web-grid.jpg
deleted file mode 100755
index 015bb43..0000000
Binary files a/grid/src/site/resources/images/web-grid.jpg and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/grid/src/site/resources/images/web-grid.psd
----------------------------------------------------------------------
diff --git a/grid/src/site/resources/images/web-grid.psd b/grid/src/site/resources/images/web-grid.psd
deleted file mode 100755
index e9d898e..0000000
Binary files a/grid/src/site/resources/images/web-grid.psd and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/grid/src/site/resources/slides.pdf
----------------------------------------------------------------------
diff --git a/grid/src/site/resources/slides.pdf b/grid/src/site/resources/slides.pdf
deleted file mode 100755
index 82f64ce..0000000
Binary files a/grid/src/site/resources/slides.pdf and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/grid/src/site/site.xml
----------------------------------------------------------------------
diff --git a/grid/src/site/site.xml b/grid/src/site/site.xml
deleted file mode 100644
index 1a85fa9..0000000
--- a/grid/src/site/site.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more contributor
-license agreements. See the NOTICE.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 name="Web Grid">
-
- <body>
- <links>
- <item name="OODT" href="../oodt-site/"/>
- <item name="Grid" href="../grid/"/>
- </links>
-
- <menu ref="reports" inherit="bottom"/>
-
- </body>
-
-</project>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/grid/src/site/xdoc/index.xml
----------------------------------------------------------------------
diff --git a/grid/src/site/xdoc/index.xml b/grid/src/site/xdoc/index.xml
deleted file mode 100755
index 78e4ea7..0000000
--- a/grid/src/site/xdoc/index.xml
+++ /dev/null
@@ -1,73 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more contributor
-license agreements. See the NOTICE.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.
--->
-<document>
- <properties>
- <title>Web Grid</title>
- <author email='Sean.Kelly@jpl.nasa.gov'>Sean Kelly</author>
- </properties>
- <!-- Sirius Isness - Irrational Substance -->
- <body>
- <section name='Web Grid'>
- <p>The OODT <a href='/grid/'>grid services</a>
- (<a href='/grid-product/'>product</a>
- and <a href='/grid-profile/'>profile</a> services) use CORBA
- or RMI as their underlying network transport. However,
- limitations of CORBA and RMI make them inappropriate for
- large-scale deployments. For one, both are procedural
- mechanisms, providing a remote interface that resembles a
- method call. This makes streaming of data from a service
- impossible, because there are limitations to the sizes of data
- structures that can be passed over a remote method call.
- Instead, repeated calls must be made to retrieve each block of
- a product, making transfer speeds horribly slow compared to
- HTTP or FTP. (Block-based retrieval of profiles was never
- implemented, resulting in out of memory conditions for large
- profile results, which is another problem.)
- </p>
- <p>Second, both CORBA and RMI rely on a central name registry.
- The registry makes an object independent of its network
- location, enabling a client to call it by name (looking up its
- last known location in the registry). However, this requires
- that server objects be able to make outbound network calls to
- the registry (through any outbound firewall), and that the
- registry accept those registrations (through any inbound
- firewall). This required administrative action at
- institutions hosting server objects and at the institution
- hosting the registry. Often, these firewall exceptions would
- change without notice as system adminstrators changed at each
- location (apparently firewall exceptions are poorly documented
- everywhere).
- </p>
- <p>Further, in the two major deployments of OODT (PDS and EDRN),
- server objects have almost never moved, nullifying any benefit
- of the registry. This project, OODT Web Grid, avoids the
- prolems of CORBA and RMI by using HTTP as the transport
- mechanism for products and profiles. Further, it provides a
- password-protected mechanism to add new sets of product and
- profile query handlers, enabling seamless activation of
- additional capabilities.
- </p>
- </section>
- <section name='Documentation'>
- <p>Further documentation on Web Grid is forthcoming. In the
- mean time, check out these <a href='./slides.pdf'>presentation
- slides</a>. (Don't worry, they're not in PowerPoint format.)
- </p>
- </section>
- </body>
-</document>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/grid/src/test/org/apache/oodt/grid/ConfigurationTest.java
----------------------------------------------------------------------
diff --git a/grid/src/test/org/apache/oodt/grid/ConfigurationTest.java b/grid/src/test/org/apache/oodt/grid/ConfigurationTest.java
deleted file mode 100755
index e54281b..0000000
--- a/grid/src/test/org/apache/oodt/grid/ConfigurationTest.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.grid;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-import java.util.Arrays;
-import junit.framework.TestCase;
-import org.xml.sax.SAXException;
-
-/**
- * Test the {@link Configuration} class.
- *
- */
-public class ConfigurationTest extends TestCase {
- /**
- * Creates a new <code>ConfigurationTest</code> instance.
- *
- * @param caseName
- * Test case name.
- */
- public ConfigurationTest(String caseName) {
- super(caseName);
- }
-
- /**
- * Set up by creating a temporary config file.
- *
- * @throws Exception
- * if an error occurs.
- */
- public void setUp() throws Exception {
- super.setUp();
- System.setProperty("javax.xml.parsers.DocumentBuilderFactory",
- "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
- System.setProperty("javax.xml.parsers.SAXParserFactory",
- "org.apache.xerces.jaxp.SAXParserFactoryImpl");
- System.setProperty("javax.xml.transform.TransformerFactory",
- "org.apache.xalan.processor.TransformerFactoryImpl");
- configFile = File.createTempFile("config", ".xml");
- configFile.deleteOnExit();
- }
-
- /**
- * Tear down by deleting the temporary config file.
- *
- * @throws Exception
- * if an error occurs.
- */
- public void tearDown() throws Exception {
- configFile.delete();
- super.tearDown();
- }
-
- /**
- * Test to see if the default values of the {@link Configuration} are
- * reasonable.
- *
- * @throws IOException
- * if an error occurs.
- * @throws SAXException
- * if an error occurs.
- */
- public void testDefaults() throws IOException, SAXException {
- Configuration config = new Configuration(configFile);
- assertTrue("Expect localhost not required by default", !config
- .isLocalhostRequired());
- assertTrue("Expect https not required by default", !config
- .isHTTPSrequired());
- assertTrue("Expect no product servers by default", config
- .getProductServers().isEmpty());
- assertTrue("Expect no profile servers by default", config
- .getProfileServers().isEmpty());
- assertTrue("Default password not set", Arrays.equals(
- Configuration.DEFAULT_PASSWORD, config.getPassword()));
- assertTrue("Expect no properties", config.getProperties().isEmpty());
- assertTrue("Expect no code bases", config.getCodeBases().isEmpty());
- }
-
- /**
- * Test to see if the mutators work.
- *
- * @throws IOException
- * if an error occurs.
- * @throws SAXException
- * if an error occurs.
- */
- public void testMutators() throws IOException, SAXException {
- Configuration config = new Configuration(configFile);
-
- assertTrue(!config.isHTTPSrequired());
- config.setHTTPSrequired(true);
- assertTrue("Cannot set https as required", config.isHTTPSrequired());
-
- assertTrue(!config.isLocalhostRequired());
- config.setLocalhostRequired(true);
- assertTrue("Cannot set localhost as required", config.isLocalhostRequired());
-
- byte[] password = { (byte) 'x', (byte) 'y', (byte) 'z' };
- assertTrue(Arrays.equals(Configuration.DEFAULT_PASSWORD, config
- .getPassword()));
- config.setPassword(password);
- assertTrue("Cannot change password", Arrays.equals(password, config
- .getPassword()));
-
- try {
- config.setPassword(null);
- fail("Null password allowed");
- } catch (IllegalArgumentException good) {
- }
-
- // Profile/product servers in the config have no mutators to test (they
- // return references to each Set). Same with Properties and code bases.
- }
-
- /**
- * Test to see if XML serialization works.
- *
- * @throws IOException
- * if an error occurs.
- * @throws SAXException
- * if an error occurs.
- */
- public void testSerialization() throws IOException, SAXException {
- Configuration a = new Configuration(configFile);
-
- byte[] password = { (byte) 'x', (byte) 'y', (byte) 'z' };
- URL prodServerURL = new URL("http://localhost/prod.jar");
- URL profServerURL = new URL("http://localhost/prof.jar");
- ProductServer prod = new ProductServer(a, "prod");
- ProfileServer prof = new ProfileServer(a, "prof");
-
- a.setLocalhostRequired(true);
- a.setHTTPSrequired(true);
- a.setPassword(password);
- a.getProductServers().add(prod);
- a.getProfileServers().add(prof);
- a.getProperties().setProperty("a", "b");
- a.getCodeBases().add(prodServerURL);
- a.getCodeBases().add(profServerURL);
- a.save();
-
- Configuration b = new Configuration(configFile);
- assertTrue("localhost state not saved", b.isLocalhostRequired());
- assertTrue("https state not saved", b.isHTTPSrequired());
- assertTrue("Password not saved", Arrays.equals(password, b.getPassword()));
- assertEquals("Product server not saved", 1, b.getProductServers().size());
- assertEquals("Product server not saved properly", prod, b
- .getProductServers().iterator().next());
- assertEquals("Profile server not saved", 1, b.getProfileServers().size());
- assertEquals("Profile server not saved properly", prof, b
- .getProfileServers().iterator().next());
- assertEquals("Properties not saved properly", "b", b.getProperties()
- .getProperty("a"));
- assertEquals("Code bases not saved properly", 2, b.getCodeBases().size());
- assertTrue(b.getCodeBases().contains(prodServerURL));
- assertTrue(b.getCodeBases().contains(profServerURL));
-
- assertEquals("Configuration.equals doesn't work", a, b);
- }
-
- /** Test config file. */
- private File configFile;
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/opendapps/pom.xml
----------------------------------------------------------------------
diff --git a/opendapps/pom.xml b/opendapps/pom.xml
deleted file mode 100644
index 0d8b27c..0000000
--- a/opendapps/pom.xml
+++ /dev/null
@@ -1,99 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.oodt</groupId>
- <artifactId>oodt-core</artifactId>
- <version>1.1-SNAPSHOT</version>
- <relativePath>../core/pom.xml</relativePath>
- </parent>
- <artifactId>opendapps</artifactId>
- <name>Apache OODT Configurable OPeNDAP Profile Server</name>
- <description>A generic, configurable Apache OODT profile server
- implementation that easily connects to OPeNDAP data sources. Connections
- are configured via an XML configuration file, providing information on how
- to extract and translate datasets from OPeNDAP and THREDDS into OODT profiles.</description>
- <!-- All dependencies should be listed in core/pom.xml and be ordered alphabetically by package and artifact.
- Once the dependency is in the core pom, it can then be used in other modules without the version tags.
- For example, within core/pom.xml:
-
- <dependency>
- <groupId>com.amazonaws</groupId>
- <artifactId>aws-java-sdk</artifactId>
- <version>1.7.4</version>
- </dependency>
-
- Elsewhere in the platform:
- <dependency>
- <groupId>com.amazonaws</groupId>
- <artifactId>aws-java-sdk</artifactId>
- </dependency>
-
- Where possible the same dependency version should be used across the whole platform but if required the version
- can be overridden in a specific pom and should have a comment explaing why the version has been overridden
- -->
- <dependencies>
- <dependency>
- <groupId>edu.ucar</groupId>
- <artifactId>netcdf4</artifactId>
- </dependency>
- <dependency>
- <groupId>edu.ucar</groupId>
- <artifactId>opendap</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.oodt</groupId>
- <artifactId>oodt-profile</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.oodt</groupId>
- <artifactId>oodt-xmlquery</artifactId>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <configuration>
- <descriptorRefs>
- <descriptorRef>jar-with-dependencies</descriptorRef>
- </descriptorRefs>
- </configuration>
- <!-- enable creation of single jar to use this module stand alone -->
- <executions>
- <execution>
- <id>make-assembly</id>
- <!-- bind to the packaging phase -->
- <goals>
- <goal>single</goal>
- </goals>
- <!-- this is used for inheritance merges -->
- <phase>package</phase>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- <scm>
- <!--<connection>scm:svn:https://svn.apache.org/repos/asf/oodt/trunk/opendapps</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/oodt/trunk/opendapps</developerConnection>
- <url>http://svn.apache.org/viewvc/oodt/trunk/opendapps</url>-->
- <tag>0.13-SNAPSHOT</tag>
- </scm>
-</project>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/opendapps/src/main/java/org/apache/oodt/opendapps/DapNames.java
----------------------------------------------------------------------
diff --git a/opendapps/src/main/java/org/apache/oodt/opendapps/DapNames.java b/opendapps/src/main/java/org/apache/oodt/opendapps/DapNames.java
deleted file mode 100644
index 6ee2378..0000000
--- a/opendapps/src/main/java/org/apache/oodt/opendapps/DapNames.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.opendapps;
-
-
-/**
- *
- * A set of named constants for extracting information from OPeNDAP {@link opendap.dap.DAS}
- * profiles.
- *
- */
-public interface DapNames {
-
- String ACTUAL_RANGE = "actual_range";
-
- String UNITS = "units";
-
- String START = "start";
-
- String END = "end";
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/opendapps/src/main/java/org/apache/oodt/opendapps/DatasetCrawler.java
----------------------------------------------------------------------
diff --git a/opendapps/src/main/java/org/apache/oodt/opendapps/DatasetCrawler.java b/opendapps/src/main/java/org/apache/oodt/opendapps/DatasetCrawler.java
deleted file mode 100644
index 760dea6..0000000
--- a/opendapps/src/main/java/org/apache/oodt/opendapps/DatasetCrawler.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.opendapps;
-
-//JDK imports
-
-import org.apache.oodt.cas.metadata.Metadata;
-import org.apache.oodt.opendapps.config.OpendapConfig;
-import org.apache.oodt.opendapps.extractors.MetadataExtractor;
-import org.apache.oodt.opendapps.extractors.ThreddsMetadataExtractor;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Vector;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import thredds.catalog.InvAccess;
-import thredds.catalog.InvCatalogRef;
-import thredds.catalog.InvDataset;
-import thredds.catalog.InvService;
-import thredds.catalog.ServiceType;
-import thredds.catalog.crawl.CatalogCrawler;
-
-/**
- * Crawls a catalog and returns all the datasets and their references.
- *
- */
-public class DatasetCrawler implements CatalogCrawler.Listener {
-
- private static Logger LOG = Logger.getLogger(DatasetCrawler.class.getName());
-
- private List<String> urls = new Vector<String>();
-
- private Map<String, Metadata> datasetMet;
-
- private String datasetURL = null;
-
- private OpendapConfig conf = null;
-
- public DatasetCrawler(String datasetURL, OpendapConfig conf) {
- this.datasetURL = datasetURL.endsWith("/") ? datasetURL : datasetURL + "/";
- this.datasetMet = new ConcurrentHashMap<String, Metadata>();
- this.conf = conf;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * thredds.catalog.crawl.CatalogCrawler.Listener#getCatalogRef(thredds.catalog
- * .InvCatalogRef, java.lang.Object)
- */
- public boolean getCatalogRef(InvCatalogRef dd, Object context) {
- return true;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * thredds.catalog.crawl.CatalogCrawler.Listener#getDataset(thredds.catalog
- * .InvDataset, java.lang.Object)
- */
- public void getDataset(InvDataset dd, Object context) {
- String url = this.datasetURL + dd.getCatalogUrl().split("#")[1];
-
- LOG.log(Level.FINE, url + " is the computed access URL for this dataset");
- // look for an OpenDAP access URL, only extract metadata if it is found
- List<InvAccess> datasets = dd.getAccess();
- if (dd.getAccess() != null && dd.getAccess().size() > 0) {
- for (InvAccess single : datasets) {
- InvService service = single.getService();
- // note: select the OpenDAP access URL based on THREDDS service type
- if (service.getServiceType() == ServiceType.OPENDAP) {
- LOG.log(Level.FINE, "Found OpenDAP access URL: " + single.getUrlPath());
- String opendapurl = this.datasetURL + single.getUrlPath();
- // extract metadata from THREDDS catalog
- MetadataExtractor extractor = new ThreddsMetadataExtractor(dd);
- Metadata met = new Metadata();
- extractor.extract(met, conf);
- // index metadata by opendap access URL
- this.datasetMet.put(opendapurl, met);
- this.urls.add(opendapurl);
- break;
- }
- }
- }
- }
-
- /**
- * Gets the set of String {@link java.net.URL}s crawled.
- *
- * @return A {@link List} of {@link String} representations of {@link java.net.URL}s.
- */
- public List<String> getURLs() {
- return this.urls;
- }
-
- /**
- * Returns the exracted THREDDS {@link InvDataset} metadata. The dataset
- * metadata is mapped to the unique THREDDS dataset URL.
- *
- * @return the exracted THREDDS {@link InvDataset} metadata.
- */
- public Map<String, Metadata> getDatasetMet() {
- return this.datasetMet;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/opendapps/src/main/java/org/apache/oodt/opendapps/DatasetExtractor.java
----------------------------------------------------------------------
diff --git a/opendapps/src/main/java/org/apache/oodt/opendapps/DatasetExtractor.java b/opendapps/src/main/java/org/apache/oodt/opendapps/DatasetExtractor.java
deleted file mode 100644
index ba22df8..0000000
--- a/opendapps/src/main/java/org/apache/oodt/opendapps/DatasetExtractor.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.opendapps;
-
-//JDK imports
-import org.apache.oodt.cas.metadata.Metadata;
-import org.apache.oodt.opendapps.config.OpendapConfig;
-import org.apache.oodt.xmlquery.XMLQuery;
-
-import java.io.FileNotFoundException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.StringTokenizer;
-import java.util.Vector;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import opendap.dap.DConnect;
-import opendap.dap.DataDDS;
-import thredds.catalog.crawl.CatalogCrawler;
-import ucar.nc2.util.CancelTask;
-
-//OODT imports
-//NetCDF-Java imports
-
-/**
- *
- * This class takes in a query and the main catalog url and returns a list of
- * relevant dataset urls
- *
- */
-public class DatasetExtractor {
-
- private static Logger LOG = Logger
- .getLogger(DatasetExtractor.class.getName());
-
- public static final String FINDALL = "PFunction=findall";
-
- public static final String FINDSOME = "PFunction=findsome";
-
- public static final String FINDQUERY = "PFunction=findquery";
-
- private String q;
-
- private String mainCatalogURL;
-
- private String datasetURL;
-
- private List<String> allUrls;
-
- private Map<String, Metadata> datasetMet;
-
- private OpendapConfig conf;
-
- public DatasetExtractor(XMLQuery q, String mainCatalogURL, String datasetURL, OpendapConfig conf) {
- this.q = q.getKwdQueryString().trim();
- this.mainCatalogURL = mainCatalogURL;
- this.datasetURL = datasetURL;
- this.conf = conf;
- this.initExtraction();
- }
-
- public List<String> getDapUrls() {
- List<String> urls = null;
-
- if (this.q.contains(FINDALL)) {
- urls = this.allUrls;
- } else if (this.q.contains(FINDSOME)) {
- urls = this.getFindSome();
- } else if (this.q.contains(FINDQUERY)) {
- urls = this.getFindQuery();
- }
-
- return urls;
- }
-
- public Metadata getDatasetMet(String opendapUrl){
- return this.datasetMet.get(opendapUrl);
- }
-
- private void initExtraction() {
- DatasetCrawler listener = new DatasetCrawler(this.datasetURL, this.conf);
- CancelTask ignore = new CancelTask() {
- public boolean isCancel() {
- return false;
- }
-
- public void setError(String msg) {
- LOG.log(Level.WARNING, msg);
- }
-
- @Override
- public void setProgress(String s, int i) {
-
- }
-
- };
-
- LOG.log(Level.FINE, "catalogURL: " + this.mainCatalogURL);
- // Note: look for all datasets, that have either a urlPath="" attribute, or a <access> subelement
- CatalogCrawler crawler = new CatalogCrawler(CatalogCrawler.USE_ALL, false, listener);
- crawler.crawl(this.mainCatalogURL, ignore, System.out, this);
- this.allUrls = listener.getURLs();
- this.datasetMet = listener.getDatasetMet();
- }
-
- private List<String> getFindQuery() {
- LOG.log(Level.FINE, "PFunction: findquery selected: orig query: [" + this.q
- + "]");
- String queryExpression = "";
- Pattern parameterPattern = Pattern.compile("PParameter=\"(.+?)\"");
- Matcher urlsMatch = parameterPattern.matcher(this.q);
- while (urlsMatch.find()) {
- queryExpression = urlsMatch.group(1);
- }
-
- List<String> datasetUrls = new Vector<String>();
-
- for (String datasetUrl : this.allUrls) {
- DConnect dConn = null;
- try {
- dConn = new DConnect(datasetUrl, true);
- } catch (FileNotFoundException e) {
- LOG.log(Level.SEVERE, e.getMessage());
- LOG.log(Level.WARNING, datasetUrl
- + " is neither a valid URL nor a filename.");
- }
- try {
- DataDDS dds = null;
- if (dConn != null) {
- dds = dConn.getData(queryExpression, null);
- }
-
- if (dds != null) {
- datasetUrls.add(datasetUrl);
- }
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- LOG.log(Level.SEVERE, " Some DAP2Exception or not a validate DDS", e);
- }
- }
-
- return datasetUrls;
-
- }
-
- private List<String> getFindSome() {
- LOG.log(Level.FINE, "PFunction: findsome selected");
- String urlsString = "";
- Pattern parameterPattern = Pattern.compile("PParameter=\"(.+?)\"");
- Matcher urlsMatch = parameterPattern.matcher(this.q);
- while (urlsMatch.find()) {
- urlsString = urlsMatch.group(1);
- }
-
- LOG.log(Level.FINE, "PParameter: [" + urlsString
- + "] parsed from original string query: [" + this.q + "]");
-
- List<String> openDapUrls = new ArrayList<String>();
-
- StringTokenizer tokens = new StringTokenizer(urlsString, ",");
- while (tokens.hasMoreTokens()) {
- openDapUrls.add(tokens.nextToken());
- }
-
- LOG.log(Level.FINE, "OPeNDAP urls: [" + openDapUrls + "]");
- return openDapUrls;
- }
-
-}
[41/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/static/js/jquery.dataTables.min.js
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/static/js/jquery.dataTables.min.js b/balance/modules/cas-browser/static/js/jquery.dataTables.min.js
deleted file mode 100644
index 3d417e4..0000000
--- a/balance/modules/cas-browser/static/js/jquery.dataTables.min.js
+++ /dev/null
@@ -1,388 +0,0 @@
-/*
- * File: jquery.dataTables.min.js
- * Version: 1.4.3
- * Author: Allan Jardine (www.sprymedia.co.uk)
- *
- * Copyright 2008-2009 Allan Jardine, all rights reserved.
- *
- * This source file is free software, under either the GPL v2 license or a
- * BSD style license, as supplied with this software.
- *
- * This source file is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
- */
-(function($){$.fn.dataTableSettings=[];$.fn.dataTableExt={};$.fn.dataTableExt.oApi={};
-$.fn.dataTableExt.oPagination={two_button:{fnInit:function(oSettings,fnCallbackDraw){oSettings.nPrevious=document.createElement("div");
-oSettings.nNext=document.createElement("div");if(oSettings.sTableId!==""){oSettings.nPaginate.setAttribute("id",oSettings.sTableId+"_paginate");
-oSettings.nPrevious.setAttribute("id",oSettings.sTableId+"_previous");oSettings.nNext.setAttribute("id",oSettings.sTableId+"_next")
-}oSettings.nPrevious.className="paginate_disabled_previous";oSettings.nNext.className="paginate_disabled_next";
-oSettings.nPaginate.appendChild(oSettings.nPrevious);oSettings.nPaginate.appendChild(oSettings.nNext);
-$(oSettings.nPaginate).insertAfter(oSettings.nTable);$(oSettings.nPrevious).click(function(){oSettings.iDisplayStart-=oSettings.iDisplayLength;
-if(oSettings.iDisplayStart<0){oSettings.iDisplayStart=0}fnCallbackDraw(oSettings)
-});$(oSettings.nNext).click(function(){if(oSettings.iDisplayStart+oSettings.iDisplayLength<oSettings.aiDisplay.length){oSettings.iDisplayStart+=oSettings.iDisplayLength
-}fnCallbackDraw(oSettings)})},fnUpdate:function(oSettings,fnCallbackDraw){oSettings.nPrevious.className=(oSettings.iDisplayStart===0)?"paginate_disabled_previous":"paginate_enabled_previous";
-oSettings.nNext.className=(oSettings.iDisplayEnd==oSettings.aiDisplay.length)?"paginate_disabled_next":"paginate_enabled_next"
-}},iFullNumbersShowPages:5,full_numbers:{fnInit:function(oSettings,fnCallbackDraw){var nFirst=document.createElement("span");
-var nPrevious=document.createElement("span");var nList=document.createElement("span");
-var nNext=document.createElement("span");var nLast=document.createElement("span");
-nFirst.innerHTML=oSettings.oLanguage.oPaginate.sFirst;nPrevious.innerHTML=oSettings.oLanguage.oPaginate.sPrevious;
-nNext.innerHTML=oSettings.oLanguage.oPaginate.sNext;nLast.innerHTML=oSettings.oLanguage.oPaginate.sLast;
-nFirst.className="paginate_button first";nPrevious.className="paginate_button previous";
-nNext.className="paginate_button next";nLast.className="paginate_button last";oSettings.nPaginate.appendChild(nFirst);
-oSettings.nPaginate.appendChild(nPrevious);oSettings.nPaginate.appendChild(nList);
-oSettings.nPaginate.appendChild(nNext);oSettings.nPaginate.appendChild(nLast);$(nFirst).click(function(){oSettings.iDisplayStart=0;
-fnCallbackDraw(oSettings)});$(nPrevious).click(function(){oSettings.iDisplayStart-=oSettings.iDisplayLength;
-if(oSettings.iDisplayStart<0){oSettings.iDisplayStart=0}fnCallbackDraw(oSettings)
-});$(nNext).click(function(){if(oSettings.iDisplayStart+oSettings.iDisplayLength<oSettings.aiDisplay.length){oSettings.iDisplayStart+=oSettings.iDisplayLength
-}fnCallbackDraw(oSettings)});$(nLast).click(function(){var iPages=parseInt((oSettings.aiDisplay.length-1)/oSettings.iDisplayLength,10)+1;
-oSettings.iDisplayStart=(iPages-1)*oSettings.iDisplayLength;fnCallbackDraw(oSettings)
-});$("span",oSettings.nPaginate).bind("mousedown",function(){return false});$("span",oSettings.nPaginate).bind("selectstart",function(){return false
-});oSettings.nPaginateList=nList},fnUpdate:function(oSettings,fnCallbackDraw){var iPageCount=jQuery.fn.dataTableExt.oPagination.iFullNumbersShowPages;
-var iPageCountHalf=Math.floor(iPageCount/2);var iPages=parseInt((oSettings.aiDisplay.length-1)/oSettings.iDisplayLength,10)+1;
-var iCurrentPage=parseInt(oSettings.iDisplayStart/oSettings.iDisplayLength,10)+1;
-var sList="";var iStartButton;var iEndButton;if(iPages<iPageCount){iStartButton=1;
-iEndButton=iPages}else{if(iCurrentPage<=iPageCountHalf){iStartButton=1;iEndButton=iPageCount
-}else{if(iCurrentPage>=(iPages-iPageCountHalf)){iStartButton=iPages-iPageCount+1;
-iEndButton=iPages}else{iStartButton=iCurrentPage-Math.ceil(iPageCount/2)+1;iEndButton=iStartButton+iPageCount-1
-}}}for(var i=iStartButton;i<=iEndButton;i++){if(iCurrentPage!=i){sList+='<span class="paginate_button">'+i+"</span>"
-}else{sList+='<span class="paginate_active">'+i+"</span>"}}oSettings.nPaginateList.innerHTML=sList;
-$("span",oSettings.nPaginateList).bind("mousedown",function(){return false});$("span",oSettings.nPaginateList).bind("selectstart",function(){return false
-});$("span",oSettings.nPaginateList).click(function(){var iTarget=(this.innerHTML*1)-1;
-oSettings.iDisplayStart=iTarget*oSettings.iDisplayLength;fnCallbackDraw(oSettings);
-return false})}}};$.fn.dataTableExt.oSort={"string-asc":function(a,b){var x=a.toLowerCase();
-var y=b.toLowerCase();return((x<y)?-1:((x>y)?1:0))},"string-desc":function(a,b){var x=a.toLowerCase();
-var y=b.toLowerCase();return((x<y)?1:((x>y)?-1:0))},"html-asc":function(a,b){var x=a.replace(/<.*?>/g,"").toLowerCase();
-var y=b.replace(/<.*?>/g,"").toLowerCase();return((x<y)?-1:((x>y)?1:0))},"html-desc":function(a,b){var x=a.replace(/<.*?>/g,"").toLowerCase();
-var y=b.replace(/<.*?>/g,"").toLowerCase();return((x<y)?1:((x>y)?-1:0))},"date-asc":function(a,b){var x=Date.parse(a);
-var y=Date.parse(b);if(isNaN(x)){x=Date.parse("01/01/1970 00:00:00")}if(isNaN(y)){y=Date.parse("01/01/1970 00:00:00")
-}return x-y},"date-desc":function(a,b){var x=Date.parse(a);var y=Date.parse(b);if(isNaN(x)){x=Date.parse("01/01/1970 00:00:00")
-}if(isNaN(y)){y=Date.parse("01/01/1970 00:00:00")}return y-x},"numeric-asc":function(a,b){var x=a=="-"?0:a;
-var y=b=="-"?0:b;return x-y},"numeric-desc":function(a,b){var x=a=="-"?0:a;var y=b=="-"?0:b;
-return y-x}};$.fn.dataTableExt.aTypes=[function(sData){var sValidChars="0123456789.-";
-var Char;for(i=0;i<sData.length;i++){Char=sData.charAt(i);if(sValidChars.indexOf(Char)==-1){return null
-}}return"numeric"},function(sData){if(!isNaN(Date.parse(sData))){return"date"}return null
-}];$.fn.dataTableExt._oExternConfig={iNextUnique:0};$.fn.dataTable=function(oInit){var _aoSettings=$.fn.dataTableSettings;
-function classSettings(){this.sInstance=null;this.oFeatures={bPaginate:true,bLengthChange:true,bFilter:true,bSort:true,bInfo:true,bAutoWidth:true,bProcessing:false,bSortClasses:true,bStateSave:false};
-this.oLanguage={sProcessing:"Processing...",sLengthMenu:"Show _MENU_ entries per page",sZeroRecords:"No matching records found",sInfo:"Showing _START_ to _END_ of _TOTAL_ entries",sInfoEmpty:"Showing 0 to 0 of 0 entries",sInfoFiltered:"(filtered from _MAX_ total entries)",sInfoPostFix:"",sSearch:"Search:",sUrl:"",oPaginate:{sFirst:"First",sPrevious:"Previous",sNext:"Next",sLast:"Last"}};
-this.aoData=[];this.aiDisplay=[];this.aiDisplayMaster=[];this.aoColumns=[];this.iNextId=0;
-this.asDataSearch=[];this.oPreviousSearch={sSearch:"",bEscapeRegex:true};this.aoPreSearchCols=[];
-this.nInfo=null;this.nProcessing=null;this.iDisplayLength=100;this.iDisplayStart=0;
-this.iDisplayEnd=10;this.aaSorting=[[0,"asc"]];this.asStripClasses=["odd","even"];
-this.fnRowCallback=null;this.fnHeaderCallback=null;this.fnFooterCallback=null;this.fnDrawCallback=null;
-this.fnInitComplete=null;this.nFooter=null;this.sTableId="";this.nTable=null;this.iDefaultSortIndex=0;
-this.bInitialised=false;this.nOpenRow=null;this.nPaginate=null;this.nPrevious=null;
-this.nNext=null;this.sDomPositioning="lfrtip";this.sPaginationType="two_button";this.sAjaxSource=null;
-this.iCookieDuration=60*60*2}this.oApi={};this.fnDraw=function(){_fnReDraw(_fnSettingsFromNode(this[0]))
-};this.fnFilter=function(sInput,iColumn,bEscapeRegex){var oSettings=_fnSettingsFromNode(this[0]);
-if(typeof bEscapeRegex=="undefined"){bEscapeRegex=true}if(typeof iColumn=="undefined"||iColumn===null){_fnFilterComplete(oSettings,{sSearch:sInput,bEscapeRegex:bEscapeRegex},1)
-}else{oSettings.aoPreSearchCols[iColumn].sSearch=sInput;oSettings.aoPreSearchCols[iColumn].bEscapeRegex=bEscapeRegex;
-_fnFilterComplete(oSettings,oSettings.oPreviousSearch,1)}};this.fnSettings=function(nNode){return _fnSettingsFromNode(this[0])
-};this.fnSort=function(aaSort){var oSettings=_fnSettingsFromNode(this[0]);oSettings.aaSorting=aaSort;
-_fnSort(oSettings)};this.fnAddData=function(mData,bRedraw){var aiReturn=[];var iTest;
-if(typeof bRedraw=="undefined"){bRedraw=true}var oSettings=_fnSettingsFromNode(this[0]);
-if(typeof mData[0]=="object"){for(var i=0;i<mData.length;i++){iTest=_fnAddData(oSettings,mData[i]);
-if(iTest==-1){return aiReturn}aiReturn.push(iTest)}}else{iTest=_fnAddData(oSettings,mData);
-if(iTest==-1){return aiReturn}aiReturn.push(iTest)}oSettings.aiDisplay=oSettings.aiDisplayMaster.slice();
-_fnBuildSearchArray(oSettings,1);if(bRedraw){_fnReDraw(oSettings)}return aiReturn
-};this.fnDeleteRow=function(iAODataIndex,fnCallBack){var oSettings=_fnSettingsFromNode(this[0]);
-var i;for(i=0;i<oSettings.aiDisplayMaster.length;i++){if(oSettings.aiDisplayMaster[i]==iAODataIndex){oSettings.aiDisplayMaster.splice(i,1);
-break}}for(i=0;i<oSettings.aiDisplay.length;i++){if(oSettings.aiDisplay[i]==iAODataIndex){oSettings.aiDisplay.splice(i,1)
-}}_fnBuildSearchArray(oSettings,1);if(typeof fnCallBack=="function"){fnCallBack.call(this)
-}if(oSettings.iDisplayStart>oSettings.aiDisplay.length){oSettings.iDisplayStart-=oSettings.iDisplayLength
-}_fnCalculateEnd(oSettings);_fnDraw(oSettings);return oSettings.aoData[iAODataIndex]._aData.slice()
-};this.fnClearTable=function(){var oSettings=_fnSettingsFromNode(this[0]);oSettings.aoData.length=0;
-oSettings.aiDisplayMaster.length=0;oSettings.aiDisplay.length=0;_fnCalculateEnd(oSettings);
-_fnDraw(oSettings)};this.fnOpen=function(nTr,sHtml,sClass){var oSettings=_fnSettingsFromNode(this[0]);
-if(oSettings.nOpenRow!==null){this.fnClose()}var nNewRow=document.createElement("tr");
-var nNewCell=document.createElement("td");nNewRow.appendChild(nNewCell);nNewRow.className=sClass;
-nNewCell.colSpan=oSettings.aoColumns.length;nNewCell.innerHTML=sHtml;$(nNewRow).insertAfter(nTr);
-oSettings.nOpenRow=nNewRow};this.fnClose=function(){var oSettings=_fnSettingsFromNode(this[0]);
-$(oSettings.nOpenRow).remove();oSettings.nOpenRow=null};this.fnGetData=function(iRow){var oSettings=_fnSettingsFromNode(this[0]);
-if(typeof iRow!="undefined"){return oSettings.aoData[iRow]._aData}return _fnGetDataMaster(oSettings)
-};this.fnGetNodes=function(iRow){var oSettings=_fnSettingsFromNode(this[0]);if(typeof iRow!="undefined"){return oSettings.aoData[iRow].nTr
-}return _fnGetTrNodes(oSettings)};this.fnGetPosition=function(nNode){var oSettings=_fnSettingsFromNode(this[0]);
-var i;if(nNode.nodeName=="TR"){for(i=0;i<oSettings.aoData.length;i++){if(oSettings.aoData[i].nTr==nNode){return i
-}}}else{if(nNode.nodeName=="TD"){for(i=0;i<oSettings.aoData.length;i++){var iCorrector=0;
-for(var j=0;j<oSettings.aoColumns.length;j++){if(oSettings.aoColumns[j].bVisible){if(oSettings.aoData[i].nTr.getElementsByTagName("td")[j-iCorrector]==nNode){return[i,j-iCorrector,j]
-}}else{iCorrector++}}}}}return null};this.fnUpdate=function(mData,iRow,iColumn,bRedraw){var oSettings=_fnSettingsFromNode(this[0]);
-var iVisibleColumn;var sRendered;if(typeof bRedraw=="undefined"){bRedraw=true}if(typeof mData!="object"){oSettings.aoData[iRow]._aData[iColumn]=mData;
-if(oSettings.aoColumns[iColumn].fnRender!==null&&oSettings.aoColumns[iColumn].bUseRendered){sRendered=oSettings.aoColumns[iColumn].fnRender({iDataRow:iRow,iDataColumn:iColumn,aData:oSettings.aoData[iRow]._aData});
-oSettings.aoData[iRow]._aData[iColumn]=sRendered}iVisibleColumn=_fnColumnIndexToVisible(oSettings,iColumn);
-if(iVisibleColumn!==null){oSettings.aoData[iRow].nTr.getElementsByTagName("td")[iVisibleColumn].innerHTML=oSettings.aoData[iRow]._aData[iColumn]
-}}else{if(mData.length!=oSettings.aoColumns.length){alert("Warning: An array passed to fnUpdate must have the same number of columns as the table in question - in this case "+oSettings.aoColumns.length);
-return 1}for(var i=0;i<mData.length;i++){oSettings.aoData[iRow]._aData[i]=mData[i];
-if(oSettings.aoColumns[i].fnRender!==null&&oSettings.aoColumns[i].bUseRendered){sRendered=oSettings.aoColumns[i].fnRender({iDataRow:iRow,iDataColumn:i,aData:oSettings.aoData[iRow]._aData});
-oSettings.aoData[iRow]._aData[i]=sRendered}iVisibleColumn=_fnColumnIndexToVisible(oSettings,i);
-if(iVisibleColumn!==null){oSettings.aoData[iRow].nTr.getElementsByTagName("td")[iVisibleColumn].innerHTML=oSettings.aoData[iRow]._aData[i]
-}}}_fnBuildSearchArray(oSettings,1);if(bRedraw){_fnReDraw(oSettings)}return 0};function _fnExternApiFunc(sFunc){return function(){var aArgs=[_fnSettingsFromNode(this[0])].concat(Array.prototype.slice.call(arguments));
-return $.fn.dataTableExt.oApi[sFunc].apply(this,aArgs)}}var bApi=false;for(var sFunc in $.fn.dataTableExt.oApi){if(sFunc){this[sFunc]=_fnExternApiFunc(sFunc);
-bApi=true}}function _fnInitalise(oSettings){if(oSettings.bInitialised===false){setTimeout(function(){_fnInitalise(oSettings)
-},200);return}_fnAddOptionsHtml(oSettings);_fnDrawHead(oSettings);if(oSettings.oFeatures.bSort){_fnSort(oSettings,false);
-_fnSortingClasses(oSettings)}else{oSettings.aiDisplay=oSettings.aiDisplayMaster.slice();
-_fnCalculateEnd(oSettings);_fnDraw(oSettings)}if(oSettings.sAjaxSource!==null){_fnProcessingDisplay(oSettings,true);
-$.getJSON(oSettings.sAjaxSource,null,function(json){for(var i=0;i<json.aaData.length;
-i++){_fnAddData(oSettings,json.aaData[i])}if(oSettings.oFeatures.bSort){_fnSort(oSettings)
-}else{oSettings.aiDisplay=oSettings.aiDisplayMaster.slice();_fnCalculateEnd(oSettings);
-_fnDraw(oSettings)}_fnProcessingDisplay(oSettings,false);if(typeof oSettings.fnInitComplete=="function"){oSettings.fnInitComplete(oSettings)
-}});return}if(oSettings.oFeatures.bSort){_fnSortingClasses(oSettings)}if(typeof oSettings.fnInitComplete=="function"){oSettings.fnInitComplete(oSettings)
-}}function _fnLanguageProcess(oSettings,oLanguage,bInit){if(typeof oLanguage.sProcessing!="undefined"){oSettings.oLanguage.sProcessing=oLanguage.sProcessing
-}if(typeof oLanguage.sLengthMenu!="undefined"){oSettings.oLanguage.sLengthMenu=oLanguage.sLengthMenu
-}if(typeof oLanguage.sZeroRecords!="undefined"){oSettings.oLanguage.sZeroRecords=oLanguage.sZeroRecords
-}if(typeof oLanguage.sInfo!="undefined"){oSettings.oLanguage.sInfo=oLanguage.sInfo
-}if(typeof oLanguage.sInfoEmpty!="undefined"){oSettings.oLanguage.sInfoEmpty=oLanguage.sInfoEmpty
-}if(typeof oLanguage.sInfoFiltered!="undefined"){oSettings.oLanguage.sInfoFiltered=oLanguage.sInfoFiltered
-}if(typeof oLanguage.sInfoPostFix!="undefined"){oSettings.oLanguage.sInfoPostFix=oLanguage.sInfoPostFix
-}if(typeof oLanguage.sSearch!="undefined"){oSettings.oLanguage.sSearch=oLanguage.sSearch
-}if(typeof oLanguage.oPaginate!="undefined"){if(typeof oLanguage.oPaginate!="undefined"){oSettings.oLanguage.oPaginate.sFirst=oLanguage.oPaginate.sFirst
-}if(typeof oLanguage.oPaginate!="undefined"){oSettings.oLanguage.oPaginate.sPrevious=oLanguage.oPaginate.sPrevious
-}if(typeof oLanguage.oPaginate!="undefined"){oSettings.oLanguage.oPaginate.sNext=oLanguage.oPaginate.sNext
-}if(typeof oLanguage.oPaginate!="undefined"){oSettings.oLanguage.oPaginate.sLast=oLanguage.oPaginate.sLast
-}}if(bInit){_fnInitalise(oSettings)}}function _fnAddColumn(oSettings,oOptions){oSettings.aoColumns[oSettings.aoColumns.length++]={sType:null,_bAutoType:true,bVisible:true,bSearchable:true,bSortable:true,sTitle:null,sWidth:null,sClass:null,fnRender:null,bUseRendered:true,iDataSort:oSettings.aoColumns.length-1};
-if(typeof oOptions!="undefined"&&oOptions!==null){var iLength=oSettings.aoColumns.length-1;
-if(typeof oOptions.sType!="undefined"){oSettings.aoColumns[iLength].sType=oOptions.sType;
-oSettings.aoColumns[iLength]._bAutoType=false}if(typeof oOptions.bVisible!="undefined"){oSettings.aoColumns[iLength].bVisible=oOptions.bVisible
-}if(typeof oOptions.bSearchable!="undefined"){oSettings.aoColumns[iLength].bSearchable=oOptions.bSearchable
-}if(typeof oOptions.bSortable!="undefined"){oSettings.aoColumns[iLength].bSortable=oOptions.bSortable
-}if(typeof oOptions.sTitle!="undefined"){oSettings.aoColumns[iLength].sTitle=oOptions.sTitle
-}if(typeof oOptions.sWidth!="undefined"){oSettings.aoColumns[iLength].sWidth=oOptions.sWidth
-}if(typeof oOptions.sClass!="undefined"){oSettings.aoColumns[iLength].sClass=oOptions.sClass
-}if(typeof oOptions.fnRender!="undefined"){oSettings.aoColumns[iLength].fnRender=oOptions.fnRender
-}if(typeof oOptions.bUseRendered!="undefined"){oSettings.aoColumns[iLength].bUseRendered=oOptions.bUseRendered
-}if(typeof oOptions.iDataSort!="undefined"){oSettings.aoColumns[iLength].iDataSort=oOptions.iDataSort
-}}oSettings.aoPreSearchCols[oSettings.aoPreSearchCols.length++]={sSearch:"",bEscapeRegex:true}
-}function _fnAddData(oSettings,aData){if(aData.length!=oSettings.aoColumns.length){return -1
-}var iThisIndex=oSettings.aoData.length;oSettings.aoData.push({_iId:oSettings.iNextId++,_aData:aData.slice(),nTr:document.createElement("tr")});
-var nTd;for(var i=0;i<aData.length;i++){if(oSettings.aoColumns[i].bVisible){nTd=document.createElement("td");
-if(typeof oSettings.aoColumns[i].fnRender=="function"){var sRendered=oSettings.aoColumns[i].fnRender({iDataRow:iThisIndex,iDataColumn:i,aData:aData});
-nTd.innerHTML=sRendered;if(oSettings.aoColumns[i].bUseRendered){oSettings.aoData[iThisIndex]._aData[i]=sRendered
-}}else{nTd.innerHTML=aData[i]}if(oSettings.aoColumns[i].sClass!==null){nTd.className=oSettings.aoColumns[i].sClass
-}if(oSettings.aoColumns[i]._bAutoType&&oSettings.aoColumns[i].sType!="string"){if(oSettings.aoColumns[i].sType===null){oSettings.aoColumns[i].sType=_fnDetectType(aData[i])
-}else{if(oSettings.aoColumns[i].sType=="date"||oSettings.aoColumns[i].sType=="numeric"){oSettings.aoColumns[i].sType=_fnDetectType(aData[i])
-}}}oSettings.aoData[iThisIndex].nTr.appendChild(nTd)}}oSettings.aiDisplayMaster.push(iThisIndex);
-return iThisIndex}function _fnGatherData(oSettings){var nDataNodes;var iDataLength=$("tbody tr").length;
-var iLoop;var i,j;if($("thead th",oSettings.nTable).length!=oSettings.aoColumns.length){alert("Warning - columns do not match")
-}oSettings.nHeader=$("thead",oSettings.nTable)[0];if(typeof $("tfoot",oSettings.nTable)[0]!="undefined"){oSettings.nFooter=$("tfoot",oSettings.nTable)[0]
-}$("tbody tr",oSettings.nTable).each(function(){var iThisIndex=oSettings.aoData.length;
-oSettings.aoData.push({_iId:oSettings.iNextId++,_aData:[],nTr:this});oSettings.aiDisplayMaster.push(iThisIndex);
-var aLocalData=oSettings.aoData[iThisIndex]._aData;$("td",this).each(function(i){aLocalData[i]=this.innerHTML
-})});var iCorrector=0;for(i=0;i<oSettings.aoColumns.length;i++){if(oSettings.aoColumns[i].sTitle===null){oSettings.aoColumns[i].sTitle=$("thead th:nth-child("+(i+1)+")",oSettings.nTable).html()
-}if(oSettings.aoColumns[i]._bAutoType){iLoop=oSettings.aoData.length;for(j=0;j<iLoop;
-j++){if(oSettings.aoColumns[i].sType===null){oSettings.aoColumns[i].sType=_fnDetectType(oSettings.aoData[j]._aData[i])
-}else{if(oSettings.aoColumns[i].sType=="date"||oSettings.aoColumns[i].sType=="numeric"){oSettings.aoColumns[i].sType=_fnDetectType(oSettings.aoData[j]._aData[i])
-}}}}if(oSettings.aoColumns[i].sClass!==null){iLoop=oSettings.aoData.length;for(j=0;
-j<iLoop;j++){oSettings.aoData[j].nTr.getElementsByTagName("td")[i-iCorrector].className+=" "+oSettings.aoColumns[i].sClass
-}}if(typeof oSettings.aoColumns[i].fnRender=="function"){iLoop=oSettings.aoData.length;
-for(j=0;j<iLoop;j++){var sRendered=oSettings.aoColumns[i].fnRender({iDataRow:j,iDataColumn:i,aData:oSettings.aoData[j]._aData});
-oSettings.aoData[j].nTr.getElementsByTagName("td")[i-iCorrector].innerHTML=sRendered;
-if(oSettings.aoColumns[i].bUseRendered){oSettings.aoData[j]._aData[i]=sRendered}}}if(!oSettings.aoColumns[i].bVisible){iLoop=oSettings.aoData.length;
-for(j=0;j<iLoop;j++){var nRemove=oSettings.aoData[j].nTr.getElementsByTagName("td")[i-iCorrector];
-nRemove.parentNode.removeChild(nRemove)}iCorrector++}}}function _fnDrawHead(oSettings){var i;
-var nThOriginals=$("thead th",oSettings.nTable);if(nThOriginals.length==oSettings.aoColumns.length){for(i=0;
-i<oSettings.aoColumns.length;i++){if(oSettings.aoColumns[i].bVisible){if(oSettings.aoColumns[i].sWidth!==null){nThOriginals[i].style.width=oSettings.aoColumns[i].sWidth
-}if(oSettings.aoColumns[i].sTitle!=nThOriginals[i].innerHTML){nThOriginals[i].innerHTML=oSettings.aoColumns[i].sTitle
-}}else{nThOriginals[i].parentNode.removeChild(nThOriginals[i])}}}else{var nTh;var nTr=document.createElement("tr");
-for(i=0;i<oSettings.aoColumns.length;i++){if(oSettings.aoColumns[i].bVisible){nTh=document.createElement("th");
-if(typeof nThOriginals[i]!="undefined"&&nThOriginals[i].className!==""){nTh.className=nThOriginals[i].className
-}if(oSettings.aoColumns[i].sWidth!==null){nTh.style.width=oSettings.aoColumns[i].sWidth
-}nTh.innerHTML=oSettings.aoColumns[i].sTitle;nTr.appendChild(nTh)}}$("thead",oSettings.nTable).html("")[0].appendChild(nTr)
-}if(oSettings.oFeatures.bSort){$("thead th",oSettings.nTable).click(function(e){var iDataIndex=$("thead th",oSettings.nTable).index(this);
-iDataIndex=_fnVisibleToColumnIndex(oSettings,iDataIndex);if(oSettings.aoColumns[iDataIndex].bSortable===false){return
-}_fnProcessingDisplay(oSettings,true);setTimeout(function(){if(e.shiftKey){var bFound=false;
-for(var i=0;i<oSettings.aaSorting.length;i++){if(oSettings.aaSorting[i][0]==iDataIndex){if(oSettings.aaSorting[i][1]=="asc"){oSettings.aaSorting[i][1]="desc"
-}else{oSettings.aaSorting.splice(i,1)}bFound=true;break}}if(bFound===false){oSettings.aaSorting.push([iDataIndex,"asc"])
-}}else{if(oSettings.aaSorting.length==1&&oSettings.aaSorting[0][0]==iDataIndex){oSettings.aaSorting[0][1]=oSettings.aaSorting[0][1]=="asc"?"desc":"asc"
-}else{oSettings.aaSorting.splice(0,oSettings.aaSorting.length);oSettings.aaSorting.push([iDataIndex,"asc"])
-}}_fnSortingClasses(oSettings);_fnSort(oSettings);_fnProcessingDisplay(oSettings,false)
-},0)});$("thead th",oSettings.nTable).mousedown(function(){this.onselectstart=function(){return false
-};return false})}if(oSettings.oFeatures.bAutoWidth){oSettings.nTable.style.width=oSettings.nTable.offsetWidth+"px"
-}}function _fnDraw(oSettings){var i;var anRows=[];var iRowCount=0;var iStrips=oSettings.asStripClasses.length;
-if(oSettings.aiDisplay.length!==0){for(var j=oSettings.iDisplayStart;j<oSettings.iDisplayEnd;
-j++){var nRow=oSettings.aoData[oSettings.aiDisplay[j]].nTr;$(nRow).removeClass(oSettings.asStripClasses.join(" "));
-$(nRow).addClass(oSettings.asStripClasses[iRowCount%iStrips]);if(typeof oSettings.fnRowCallback=="function"){anRows[iRowCount]=oSettings.fnRowCallback(nRow,oSettings.aoData[oSettings.aiDisplay[j]]._aData,iRowCount,j)
-}anRows.push(nRow);iRowCount++}}else{anRows[0]=document.createElement("tr");if(typeof oSettings.asStripClasses[0]!="undefined"){anRows[0].className=oSettings.asStripClasses[0]
-}var nTd=document.createElement("td");nTd.setAttribute("valign","top");nTd.colSpan=oSettings.aoColumns.length;
-nTd.style.textAlign="center";nTd.className="dataTables_empty";nTd.innerHTML=oSettings.oLanguage.sZeroRecords;
-anRows[iRowCount].appendChild(nTd)}if(typeof oSettings.fnHeaderCallback=="function"){oSettings.fnHeaderCallback($("thead tr",oSettings.nTable)[0],_fnGetDataMaster(oSettings),oSettings.iDisplayStart,oSettings.iDisplayEnd,oSettings.aiDisplay)
-}if(typeof oSettings.fnFooterCallback=="function"){oSettings.fnFooterCallback(oSettings.nFooter,_fnGetDataMaster(oSettings),oSettings.iDisplayStart,oSettings.iDisplayEnd,oSettings.aiDisplay)
-}var nTrs=$("tbody:eq(0)>tr",oSettings.nTable);for(i=0;i<nTrs.length;i++){nTrs[i].parentNode.removeChild(nTrs[i])
-}var nBody=$("tbody:eq(0)",oSettings.nTable);for(i=0;i<anRows.length;i++){nBody[0].appendChild(anRows[i])
-}if(oSettings.oFeatures.bPaginate){$.fn.dataTableExt.oPagination[oSettings.sPaginationType].fnUpdate(oSettings,function(oSettings){_fnCalculateEnd(oSettings);
-_fnDraw(oSettings)})}if(oSettings.oFeatures.bInfo){if(oSettings.aiDisplay.length===0&&oSettings.aiDisplay.length==oSettings.aiDisplayMaster.length){oSettings.nInfo.innerHTML=oSettings.oLanguage.sInfoEmpty+" "+oSettings.oLanguage.sInfoPostFix
-}else{if(oSettings.aiDisplay.length===0){oSettings.nInfo.innerHTML=oSettings.oLanguage.sInfoEmpty+" "+oSettings.oLanguage.sInfoFiltered.replace("_MAX_",oSettings.aiDisplayMaster.length)+" "+oSettings.oLanguage.sInfoPostFix
-}else{if(oSettings.aiDisplay.length==oSettings.aiDisplayMaster.length){oSettings.nInfo.innerHTML=oSettings.oLanguage.sInfo.replace("_START_",oSettings.iDisplayStart+1).replace("_END_",oSettings.iDisplayEnd).replace("_TOTAL_",oSettings.aiDisplay.length)+" "+oSettings.oLanguage.sInfoPostFix
-}else{oSettings.nInfo.innerHTML=oSettings.oLanguage.sInfo.replace("_START_",oSettings.iDisplayStart+1).replace("_END_",oSettings.iDisplayEnd).replace("_TOTAL_",oSettings.aiDisplay.length)+" "+oSettings.oLanguage.sInfoFiltered.replace("_MAX_",oSettings.aiDisplayMaster.length)+" "+oSettings.oLanguage.sInfoPostFix
-}}}}_fnSaveState(oSettings);if(typeof oSettings.fnDrawCallback=="function"){oSettings.fnDrawCallback()
-}}function _fnReDraw(oSettings){if(oSettings.oFeatures.bSort){_fnSort(oSettings,oSettings.oPreviousSearch)
-}else{if(oSettings.oFeatures.bFilter){_fnFilterComplete(oSettings,oSettings.oPreviousSearch)
-}else{_fnCalculateEnd(oSettings);_fnDraw(oSettings)}}}function _fnAddOptionsHtml(oSettings){var nHolding=document.createElement("div");
-oSettings.nTable.parentNode.insertBefore(nHolding,oSettings.nTable);var nWrapper=document.createElement("div");
-nWrapper.className="dataTables_wrapper";if(oSettings.sTableId!==""){nWrapper.setAttribute("id",oSettings.sTableId+"_wrapper")
-}var nInsertNode=nWrapper;var sDom=oSettings.sDomPositioning.split("");for(var i=0;
-i<sDom.length;i++){var cOption=sDom[i];if(cOption=="<"){var nNewNode=document.createElement("div");
-var cNext=sDom[i+1];if(cNext=="'"||cNext=='"'){var sClass="";var j=2;while(sDom[i+j]!=cNext){sClass+=sDom[i+j];
-j++}nNewNode.className=sClass;i+=j}nInsertNode.appendChild(nNewNode);nInsertNode=nNewNode
-}else{if(cOption==">"){nInsertNode=nInsertNode.parentNode}else{if(cOption=="l"&&oSettings.oFeatures.bPaginate&&oSettings.oFeatures.bLengthChange){nInsertNode.appendChild(_fnFeatureHtmlLength(oSettings))
-}else{if(cOption=="f"&&oSettings.oFeatures.bFilter){nInsertNode.appendChild(_fnFeatureHtmlFilter(oSettings))
-}else{if(cOption=="r"&&oSettings.oFeatures.bProcessing){nInsertNode.appendChild(_fnFeatureHtmlProcessing(oSettings))
-}else{if(cOption=="t"){nInsertNode.appendChild(oSettings.nTable)}else{if(cOption=="i"&&oSettings.oFeatures.bInfo){nInsertNode.appendChild(_fnFeatureHtmlInfo(oSettings))
-}else{if(cOption=="p"&&oSettings.oFeatures.bPaginate){nInsertNode.appendChild(_fnFeatureHtmlPaginate(oSettings))
-}}}}}}}}}nHolding.parentNode.replaceChild(nWrapper,nHolding)}function _fnFeatureHtmlFilter(oSettings){var nFilter=document.createElement("div");
-if(oSettings.sTableId!==""){nFilter.setAttribute("id",oSettings.sTableId+"_filter")
-}nFilter.className="dataTables_filter";nFilter.innerHTML=oSettings.oLanguage.sSearch+' <input type="text" value="'+oSettings.oPreviousSearch.sSearch.replace('"',""")+'" />';
-$("input",nFilter).keyup(function(e){_fnFilterComplete(oSettings,{sSearch:this.value,bEscapeRegex:oSettings.oPreviousSearch.bEscapeRegex})
-});return nFilter}function _fnFeatureHtmlInfo(oSettings){var nInfo=document.createElement("div");
-oSettings.nInfo=nInfo;if(oSettings.sTableId!==""){oSettings.nInfo.setAttribute("id",oSettings.sTableId+"_info")
-}oSettings.nInfo.className="dataTables_info";return nInfo}function _fnFeatureHtmlPaginate(oSettings){var nPaginate=document.createElement("div");
-nPaginate.className="dataTables_paginate";oSettings.nPaginate=nPaginate;$.fn.dataTableExt.oPagination[oSettings.sPaginationType].fnInit(oSettings,function(oSettings){_fnCalculateEnd(oSettings);
-_fnDraw(oSettings)});return nPaginate}function _fnFeatureHtmlLength(oSettings){var sName=(oSettings.sTableId==="")?"":'name="'+oSettings.sTableId+'_length"';
-var sStdMenu='<select size="1" '+sName+'><option value="10">10</option><option value="25">25</option><option value="50">50</option><option value="100">100</option></select>';
-var nLength=document.createElement("div");if(oSettings.sTableId!==""){nLength.setAttribute("id",oSettings.sTableId+"_length")
-}nLength.className="dataTables_length";nLength.innerHTML=oSettings.oLanguage.sLengthMenu.replace("_MENU_",sStdMenu);
-$('select option[value="'+oSettings.iDisplayLength+'"]',nLength).attr("selected",true);
-$("select",nLength).change(function(){oSettings.iDisplayLength=parseInt($(this).val(),10);
-_fnCalculateEnd(oSettings);if(oSettings.iDisplayEnd==oSettings.aiDisplay.length){oSettings.iDisplayStart=oSettings.iDisplayEnd-oSettings.iDisplayLength;
-if(oSettings.iDisplayStart<0){oSettings.iDisplayStart=0}}_fnDraw(oSettings)});return nLength
-}function _fnFeatureHtmlProcessing(oSettings){var nProcessing=document.createElement("div");
-oSettings.nProcessing=nProcessing;if(oSettings.sTableId!==""){oSettings.nProcessing.setAttribute("id",oSettings.sTableId+"_processing")
-}oSettings.nProcessing.appendChild(document.createTextNode(oSettings.oLanguage.sProcessing));
-oSettings.nProcessing.className="dataTables_processing";oSettings.nProcessing.style.visibility="hidden";
-oSettings.nTable.parentNode.insertBefore(oSettings.nProcessing,oSettings.nTable);
-return nProcessing}function _fnProcessingDisplay(oSettings,bShow){if(oSettings.oFeatures.bProcessing){if(bShow){oSettings.nProcessing.style.visibility="visible"
-}else{oSettings.nProcessing.style.visibility="hidden"}}}function _fnFilterComplete(oSettings,oInput,iForce){_fnFilter(oSettings,oInput.sSearch,iForce,oInput.bEscapeRegex);
-for(var i=0;i<oSettings.aoPreSearchCols.length;i++){_fnFilterColumn(oSettings,oSettings.aoPreSearchCols[i].sSearch,i,oSettings.aoPreSearchCols[i].bEscapeRegex)
-}if(typeof oSettings.iInitDisplayStart!="undefined"&&oSettings.iInitDisplayStart!=-1){oSettings.iDisplayStart=oSettings.iInitDisplayStart;
-oSettings.iInitDisplayStart=-1}else{oSettings.iDisplayStart=0}_fnCalculateEnd(oSettings);
-_fnDraw(oSettings);_fnBuildSearchArray(oSettings,0)}function _fnFilterColumn(oSettings,sInput,iColumn,bEscapeRegex){if(sInput===""){return
-}var iIndexCorrector=0;var sRegexMatch=bEscapeRegex?_fnEscapeRegex(sInput):sInput;
-var rpSearch=new RegExp(sRegexMatch,"i");for(i=oSettings.aiDisplay.length-1;i>=0;
-i--){if(!rpSearch.test(oSettings.aoData[oSettings.aiDisplay[i]]._aData[iColumn])){oSettings.aiDisplay.splice(i,1);
-iIndexCorrector++}}}function _fnFilter(oSettings,sInput,iForce,bEscapeRegex){var flag,i,j;
-if(typeof iForce=="undefined"||iForce===null){iForce=0}if(typeof bRedraw=="undefined"||bRedraw===null){bRedraw=true
-}var asSearch=bEscapeRegex?_fnEscapeRegex(sInput).split(" "):sInput.split(" ");var sRegExpString="^(?=.*?"+asSearch.join(")(?=.*?")+").*$";
-var rpSearch=new RegExp(sRegExpString,"i");if(sInput.length<=0){oSettings.aiDisplay.splice(0,oSettings.aiDisplay.length);
-oSettings.aiDisplay=oSettings.aiDisplayMaster.slice()}else{if(oSettings.aiDisplay.length==oSettings.aiDisplayMaster.length||oSettings.oPreviousSearch.sSearch.length>sInput.length||iForce==1||sInput.indexOf(oSettings.oPreviousSearch.sSearch)!==0){oSettings.aiDisplay.splice(0,oSettings.aiDisplay.length);
-_fnBuildSearchArray(oSettings,1);for(i=0;i<oSettings.aiDisplayMaster.length;i++){if(rpSearch.test(oSettings.asDataSearch[i])){oSettings.aiDisplay.push(oSettings.aiDisplayMaster[i])
-}}}else{var iIndexCorrector=0;for(i=0;i<oSettings.asDataSearch.length;i++){if(!rpSearch.test(oSettings.asDataSearch[i])){oSettings.aiDisplay.splice(i-iIndexCorrector,1);
-iIndexCorrector++}}}}oSettings.oPreviousSearch.sSearch=sInput;oSettings.oPreviousSearch.bEscapeRegex=bEscapeRegex
-}function _fnSort(oSettings,bApplyClasses){var sDynamicSort="var fnLocalSorting = function(a,b){var iTest;var oSort = $.fn.dataTableExt.oSort;var aoData = oSettings.aoData;";
-var aaSort=oSettings.aaSorting;var iDataSort;var iDataType;if(aaSort.length!==0){for(var i=0;
-i<aaSort.length-1;i++){iDataSort=oSettings.aoColumns[aaSort[i][0]].iDataSort;iDataType=oSettings.aoColumns[iDataSort].sType;
-sDynamicSort+="iTest = oSort['"+iDataType+"-"+aaSort[i][1]+"']( aoData[a]._aData["+iDataSort+"], aoData[b]._aData["+iDataSort+"] ); if ( iTest === 0 )"
-}iDataSort=oSettings.aoColumns[aaSort[aaSort.length-1][0]].iDataSort;iDataType=oSettings.aoColumns[iDataSort].sType;
-sDynamicSort+="iTest = oSort['"+iDataType+"-"+aaSort[aaSort.length-1][1]+"']( aoData[a]._aData["+iDataSort+"], aoData[b]._aData["+iDataSort+"] ); return iTest;}";
-eval(sDynamicSort);oSettings.aiDisplayMaster.sort(fnLocalSorting)}if(typeof bApplyClasses=="undefined"||bApplyClasses){_fnSortingClasses(oSettings)
-}if(oSettings.oFeatures.bFilter){_fnFilterComplete(oSettings,oSettings.oPreviousSearch,1)
-}else{oSettings.aiDisplay=oSettings.aiDisplayMaster.slice();_fnCalculateEnd(oSettings);
-_fnDraw(oSettings)}}function _fnSortingClasses(oSettings){$("thead th",oSettings.nTable).removeClass("sorting_asc sorting_desc sorting");
-var iCorrector=0;var i;for(i=0;i<oSettings.aoColumns.length;i++){if(oSettings.aoColumns[i].bSortable&&oSettings.aoColumns[i].bVisible){var sClass="sorting";
-for(var j=0;j<oSettings.aaSorting.length;j++){if(oSettings.aaSorting[j][0]==i){sClass=(oSettings.aaSorting[j][1]=="asc")?"sorting_asc":"sorting_desc";
-break}}$("thead th:eq("+_fnColumnIndexToVisible(oSettings,i)+")",oSettings.nTable).addClass(sClass)
-}}if(oSettings.oFeatures.bSortClasses){var nTrs=_fnGetTrNodes(oSettings);$("td",nTrs).removeClass("sorting_1 sorting_2 sorting_3");
-for(i=0;i<oSettings.aaSorting.length;i++){if(i<=1){$("td:eq("+_fnColumnIndexToVisible(oSettings,oSettings.aaSorting[i][0])+")",nTrs).addClass("sorting_"+(i+1))
-}else{$("td:eq("+_fnColumnIndexToVisible(oSettings,oSettings.aaSorting[i][0])+")",nTrs).addClass("sorting_3")
-}}}}function _fnVisibleToColumnIndex(oSettings,iMatch){var iColumn=-1;for(var i=0;
-i<oSettings.aoColumns.length;i++){if(oSettings.aoColumns[i].bVisible===true){iColumn++
-}if(iColumn==iMatch){return i}}return null}function _fnColumnIndexToVisible(oSettings,iMatch){var iVisible=-1;
-for(var i=0;i<oSettings.aoColumns.length;i++){if(oSettings.aoColumns[i].bVisible===true){iVisible++
-}if(i==iMatch){return oSettings.aoColumns[i].bVisible===true?iVisible:null}}return null
-}function _fnBuildSearchArray(oSettings,iMaster){oSettings.asDataSearch.splice(0,oSettings.asDataSearch.length);
-var aArray=(typeof iMaster!="undefined"&&iMaster==1)?oSettings.aiDisplayMaster:oSettings.aiDisplay;
-for(i=0;i<aArray.length;i++){oSettings.asDataSearch[i]="";for(j=0;j<oSettings.aoColumns.length;
-j++){if(oSettings.aoColumns[j].bSearchable){var sData=oSettings.aoData[aArray[i]]._aData[j];
-if(oSettings.aoColumns[j].sType=="html"){oSettings.asDataSearch[i]+=sData.replace(/\n/g," ").replace(/<.*?>/g,"")+" "
-}else{if(typeof sData=="string"){oSettings.asDataSearch[i]+=sData.replace(/\n/g," ")+" "
-}else{oSettings.asDataSearch[i]+=sData+" "}}}}}}function _fnCalculateEnd(oSettings){if(oSettings.oFeatures.bPaginate===false){oSettings.iDisplayEnd=oSettings.aiDisplay.length
-}else{if(oSettings.iDisplayStart+oSettings.iDisplayLength>oSettings.aiDisplay.length){oSettings.iDisplayEnd=oSettings.aiDisplay.length
-}else{oSettings.iDisplayEnd=oSettings.iDisplayStart+oSettings.iDisplayLength}}}function _fnConvertToWidth(sWidth,nParent){if(!sWidth||sWidth===null||sWidth===""){return 0
-}if(typeof nParent=="undefined"){nParent=document.getElementsByTagName("body")[0]
-}var iWidth;var nTmp=document.createElement("div");nTmp.style.width=sWidth;nParent.appendChild(nTmp);
-iWidth=nTmp.offsetWidth;nParent.removeChild(nTmp);return(iWidth)}function _fnCalculateColumnWidths(oSettings){var iTableWidth=oSettings.nTable.offsetWidth;
-var iTotalUserIpSize=0;var iTmpWidth;var iVisibleColumns=0;var i;var oHeaders=$("thead th",oSettings.nTable);
-for(i=0;i<oSettings.aoColumns.length;i++){if(oSettings.aoColumns[i].bVisible){iVisibleColumns++;
-if(oSettings.aoColumns[i].sWidth!==null){iTmpWidth=_fnConvertToWidth(oSettings.aoColumns[i].sWidth,oSettings.nTable.parentNode);
-iTotalUserIpSize+=iTmpWidth;oSettings.aoColumns[i].sWidth=iTmpWidth+"px"}}}if(oSettings.aoColumns.length==oHeaders.length&&iTotalUserIpSize===0){for(i=0;
-i<oSettings.aoColumns.length;i++){oSettings.aoColumns[i].sWidth=oHeaders[i].offsetWidth+"px"
-}}else{var nCalcTmp=oSettings.nTable.cloneNode(false);nCalcTmp.setAttribute("id","");
-var sTableTmp='<table class="'+nCalcTmp.className+'">';var sCalcHead="<tr>";var sCalcHtml="<tr>";
-for(i=0;i<oSettings.aoColumns.length;i++){if(oSettings.aoColumns[i].bVisible){sCalcHead+="<th>"+oSettings.aoColumns[i].sTitle+"</th>";
-if(oSettings.aoColumns[i].sWidth!==null){var sWidth="";if(oSettings.aoColumns[i].sWidth!==null){sWidth=' style="width:'+oSettings.aoColumns[i].sWidth+';"'
-}sCalcHtml+="<td"+sWidth+' tag_index="'+i+'">'+fnGetMaxLenString(oSettings,i)+"</td>"
-}else{sCalcHtml+='<td tag_index="'+i+'">'+fnGetMaxLenString(oSettings,i)+"</td>"}}}sCalcHead+="</tr>";
-sCalcHtml+="</tr>";nCalcTmp=$(sTableTmp+sCalcHead+sCalcHtml+"</table>")[0];nCalcTmp.style.width=iTableWidth+"px";
-nCalcTmp.style.visibility="hidden";nCalcTmp.style.position="absolute";oSettings.nTable.parentNode.appendChild(nCalcTmp);
-var oNodes=$("td",nCalcTmp);var iIndex;for(i=0;i<oNodes.length;i++){iIndex=oNodes[i].getAttribute("tag_index");
-oSettings.aoColumns[iIndex].sWidth=$("td",nCalcTmp)[i].offsetWidth+"px"}oSettings.nTable.parentNode.removeChild(nCalcTmp)
-}}function fnGetMaxLenString(oSettings,iCol){var iMax=0;var iMaxIndex=-1;for(var i=0;
-i<oSettings.aoData.length;i++){if(oSettings.aoData[i]._aData[iCol].length>iMax){iMax=oSettings.aoData[i]._aData[iCol].length;
-iMaxIndex=i}}if(iMaxIndex>=0){return oSettings.aoData[iMaxIndex]._aData[iCol]}return""
-}function _fnArrayCmp(aArray1,aArray2){if(aArray1.length!=aArray2.length){return 1
-}for(var i=0;i<aArray1.length;i++){if(aArray1[i]!=aArray2[i]){return 2}}return 0}function _fnDetectType(sData){var aTypes=$.fn.dataTableExt.aTypes;
-var iLen=aTypes.length;for(var i=0;i<iLen;i++){var sType=aTypes[i](sData);if(sType!==null){return sType
-}}return"string"}function _fnSettingsFromNode(nTable){for(var i=0;i<_aoSettings.length;
-i++){if(_aoSettings[i].nTable==nTable){return _aoSettings[i]}}return null}function _fnGetDataMaster(oSettings){var aData=[];
-var iLen=oSettings.aoData.length;for(var i=0;i<iLen;i++){aData.push(oSettings.aoData[i]._aData)
-}return aData}function _fnGetTrNodes(oSettings){var aNodes=[];var iLen=oSettings.aoData.length;
-for(var i=0;i<iLen;i++){aNodes.push(oSettings.aoData[i].nTr)}return aNodes}function _fnEscapeRegex(sVal){var acEscape=["/",".","*","+","?","|","(",")","[","]","{","}","\\","$","^"];
-var reReplace=new RegExp("(\\"+acEscape.join("|\\")+")","g");return sVal.replace(reReplace,"\\$1")
-}function _fnSaveState(oSettings){if(!oSettings.oFeatures.bStateSave){return}var sValue="{";
-sValue+='"iStart": '+oSettings.iDisplayStart+",";sValue+='"iEnd": '+oSettings.iDisplayEnd+",";
-sValue+='"iLength": '+oSettings.iDisplayLength+",";sValue+='"sFilter": "'+oSettings.oPreviousSearch.sSearch.replace('"','\\"')+'",';
-sValue+='"sFilterEsc": '+oSettings.oPreviousSearch.bEscapeRegex+",";sValue+='"aaSorting": [ ';
-for(var i=0;i<oSettings.aaSorting.length;i++){sValue+="["+oSettings.aaSorting[i][0]+",'"+oSettings.aaSorting[i][1]+"'],"
-}sValue=sValue.substring(0,sValue.length-1);sValue+="]}";_fnCreateCookie("SpryMedia_DataTables_"+oSettings.sInstance,sValue,oSettings.iCookieDuration)
-}function _fnLoadState(oSettings){if(!oSettings.oFeatures.bStateSave){return}var sData=_fnReadCookie("SpryMedia_DataTables_"+oSettings.sInstance);
-if(sData!==null&&sData!==""){if(typeof JSON=="object"&&typeof JSON.parse=="function"){oData=JSON.parse(sData.replace(/'/g,'"'))
-}else{oData=eval("("+sData+")")}oSettings.iDisplayStart=oData.iStart;oSettings.iInitDisplayStart=oData.iStart;
-oSettings.iDisplayEnd=oData.iEnd;oSettings.iDisplayLength=oData.iLength;oSettings.oPreviousSearch.sSearch=oData.sFilter;
-oSettings.aaSorting=oData.aaSorting.slice();if(typeof oData.sFilterEsc!="undefined"){oSettings.oPreviousSearch.bEscapeRegex=oData.sFilterEsc
-}}}function _fnCreateCookie(sName,sValue,iSecs){var date=new Date();date.setTime(date.getTime()+(iSecs*1000));
-sName+="_"+window.location.pathname.replace(/[\/:]/g,"");document.cookie=sName+"="+sValue+"; expires="+date.toGMTString()+"; path=/"
-}function _fnReadCookie(sName){var sNameEQ=sName+"_"+window.location.pathname.replace(/[\/:]/g,"")+"=";
-var sCookieContents=document.cookie.split(";");for(var i=0;i<sCookieContents.length;
-i++){var c=sCookieContents[i];while(c.charAt(0)==" "){c=c.substring(1,c.length)}if(c.indexOf(sNameEQ)===0){return c.substring(sNameEQ.length,c.length)
-}}return null}if(bApi){this.oApi._fnInitalise=_fnInitalise;this.oApi._fnLanguageProcess=_fnLanguageProcess;
-this.oApi._fnAddColumn=_fnAddColumn;this.oApi._fnAddData=_fnAddData;this.oApi._fnGatherData=_fnGatherData;
-this.oApi._fnDrawHead=_fnDrawHead;this.oApi._fnDraw=_fnDraw;this.oApi._fnAddOptionsHtml=_fnAddOptionsHtml;
-this.oApi._fnFeatureHtmlFilter=_fnFeatureHtmlFilter;this.oApi._fnFeatureHtmlInfo=_fnFeatureHtmlInfo;
-this.oApi._fnFeatureHtmlPaginate=_fnFeatureHtmlPaginate;this.oApi._fnFeatureHtmlLength=_fnFeatureHtmlLength;
-this.oApi._fnFeatureHtmlProcessing=_fnFeatureHtmlProcessing;this.oApi._fnProcessingDisplay=_fnProcessingDisplay;
-this.oApi._fnFilterComplete=_fnFilterComplete;this.oApi._fnFilterColumn=_fnFilterColumn;
-this.oApi._fnFilter=_fnFilter;this.oApi._fnSortingClasses=_fnSortingClasses;this.oApi._fnVisibleToColumnIndex=_fnVisibleToColumnIndex;
-this.oApi._fnColumnIndexToVisible=_fnColumnIndexToVisible;this.oApi._fnBuildSearchArray=_fnBuildSearchArray;
-this.oApi._fnCalculateEnd=_fnCalculateEnd;this.oApi._fnConvertToWidth=_fnConvertToWidth;
-this.oApi._fnCalculateColumnWidths=_fnCalculateColumnWidths;this.oApi._fnArrayCmp=_fnArrayCmp;
-this.oApi._fnDetectType=_fnDetectType;this.oApi._fnGetDataMaster=_fnGetDataMaster;
-this.oApi._fnGetTrNodes=_fnGetTrNodes;this.oApi._fnEscapeRegex=_fnEscapeRegex;this.oApi._fnSaveState=_fnSaveState;
-this.oApi._fnLoadState=_fnLoadState;this.oApi._fnCreateCookie=_fnCreateCookie;this.oApi._fnReadCookie=_fnReadCookie
-}return this.each(function(){var oSettings=new classSettings();_aoSettings.push(oSettings);
-var bInitHandedOff=false;var bUsePassedData=false;var sId=this.getAttribute("id");
-if(sId!==null){oSettings.sTableId=sId;oSettings.sInstance=sId}else{oSettings.sInstance=$.fn.dataTableExt._oExternConfig.iNextUnique++
-}oSettings.nTable=this;if(typeof oInit!="undefined"&&oInit!==null){if(typeof oInit.bPaginate!="undefined"){oSettings.oFeatures.bPaginate=oInit.bPaginate
-}if(typeof oInit.bLengthChange!="undefined"){oSettings.oFeatures.bLengthChange=oInit.bLengthChange
-}if(typeof oInit.bFilter!="undefined"){oSettings.oFeatures.bFilter=oInit.bFilter}if(typeof oInit.bSort!="undefined"){oSettings.oFeatures.bSort=oInit.bSort
-}if(typeof oInit.bInfo!="undefined"){oSettings.oFeatures.bInfo=oInit.bInfo}if(typeof oInit.bProcessing!="undefined"){oSettings.oFeatures.bProcessing=oInit.bProcessing
-}if(typeof oInit.bAutoWidth!="undefined"){oSettings.oFeatures.bAutoWidth=oInit.bAutoWidth
-}if(typeof oInit.bSortClasses!="undefined"){oSettings.oFeatures.bSortClasses=oInit.bSortClasses
-}if(typeof oInit.aaData!="undefined"){bUsePassedData=true}if(typeof oInit.iDisplayLength!="undefined"){oSettings.iDisplayLength=oInit.iDisplayLength
-}if(typeof oInit.asStripClasses!="undefined"){oSettings.asStripClasses=oInit.asStripClasses
-}if(typeof oInit.fnRowCallback!="undefined"){oSettings.fnRowCallback=oInit.fnRowCallback
-}if(typeof oInit.fnHeaderCallback!="undefined"){oSettings.fnHeaderCallback=oInit.fnHeaderCallback
-}if(typeof oInit.fnFooterCallback!="undefined"){oSettings.fnFooterCallback=oInit.fnFooterCallback
-}if(typeof oInit.fnDrawCallback!="undefined"){oSettings.fnDrawCallback=oInit.fnDrawCallback
-}if(typeof oInit.fnInitComplete!="undefined"){oSettings.fnInitComplete=oInit.fnInitComplete
-}if(typeof oInit.aaSorting!="undefined"){oSettings.aaSorting=oInit.aaSorting}if(typeof oInit.sPaginationType!="undefined"){oSettings.sPaginationType=oInit.sPaginationType
-}if(typeof oInit.sDom!="undefined"){oSettings.sDomPositioning=oInit.sDom}if(typeof oInit.sAjaxSource!="undefined"){oSettings.sAjaxSource=oInit.sAjaxSource
-}if(typeof oInit.iCookieDuration!="undefined"){oSettings.iCookieDuration=oInit.iCookieDuration
-}if(typeof oInit.bStateSave!="undefined"){oSettings.oFeatures.bStateSave=oInit.bStateSave;
-_fnLoadState(oSettings)}if(typeof oInit!="undefined"&&typeof oInit.aoData!="undefined"){oInit.aoColumns=oInit.aoData
-}if(typeof oInit.oLanguage!="undefined"){if(typeof oInit.oLanguage.sUrl!="undefined"){oSettings.oLanguage.sUrl=oInit.oLanguage.sUrl;
-$.getJSON(oSettings.oLanguage.sUrl,null,function(json){_fnLanguageProcess(oSettings,json,true)
-});bInitHandedOff=true}else{_fnLanguageProcess(oSettings,oInit.oLanguage,false)}}}if(typeof oInit!="undefined"&&typeof oInit.aoColumns!="undefined"){for(var i=0;
-i<oInit.aoColumns.length;i++){_fnAddColumn(oSettings,oInit.aoColumns[i])}}else{$("thead th",this).each(function(){_fnAddColumn(oSettings,null)
-})}if(bUsePassedData){for(var j=0;j<oInit.aaData.length;j++){_fnAddData(oSettings,oInit.aaData[j])
-}if($("thead",this).length===0){this.appendChild(document.createElement("thead"))
-}if($("tbody",this).length===0){this.appendChild(document.createElement("tbody"))
-}}else{_fnGatherData(oSettings)}oSettings.aiDisplay=oSettings.aiDisplayMaster.slice();
-if(oSettings.oFeatures.bAutoWidth){_fnCalculateColumnWidths(oSettings)}oSettings.bInitialised=true;
-if(bInitHandedOff===false){_fnInitalise(oSettings)}})}})(jQuery);
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/static/js/querywidget.js
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/static/js/querywidget.js b/balance/modules/cas-browser/static/js/querywidget.js
deleted file mode 100644
index cdd2bcd..0000000
--- a/balance/modules/cas-browser/static/js/querywidget.js
+++ /dev/null
@@ -1,314 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var criteriaNum = 0;
-var allCriteria = new Array();
-var criteriaRoot = 0;
-var pCurrPage = 1;
-var pTotalPages = 0;
-var pPageSize = 0;
-var pNumPageProducts = 0;
-var pTotalProducts = 0;
-
-function encodeRequestData(key, value){
- return escape(key) + "=" + value;
-}
-
-function displayPageInfo(){
- pageInfo = '<div class="pp_pageLinks">';
- if(pNumPageProducts > 0){
- prodRangeStart = (pCurrPage - 1) * pPageSize + 1;
- prodRangeEnd = (pCurrPage - 1) * pPageSize + pNumPageProducts;
- pageInfo += 'Page ' + pCurrPage + ' of ' + pTotalPages + ' ';
- pageInfo += '(Products ' + prodRangeStart + ' to ' + prodRangeEnd;
- if(pTotalProducts > 0){
- pageInfo += ', out of ' + pTotalProducts;
- }
- pageInfo += ') ';
- if(pCurrPage > 1){
- pageInfo += '<a href="#" onclick="getPrevPage()"><< Previous Page</a> ';
- }
- if(pCurrPage < pTotalPages){
- pageInfo += '<a href="#" onclick="getNextPage()">Next Page >></a>';
- }
- }else{
- pageInfo += 'No products meet given criteria.';
- }
- pageInfo += '</div>';
- $("#" + htmlID).prepend(pageInfo);
-}
-
-function formatCriteria(index){
- if(allCriteria[index].type == 'term'){
- requestData = encodeRequestData("Criteria[" + index + "][CriteriaType]", "Term");
- requestData += '&' + encodeRequestData("Criteria[" + index + "][ElementName]", allCriteria[index].element);
- requestData += '&' + encodeRequestData("Criteria[" + index + "][Value]", allCriteria[index].value);
- }else if(allCriteria[index].type == 'range'){
- requestData = encodeRequestData("Criteria[" + index + "][CriteriaType]", "Range");
- requestData += '&' + encodeRequestData("Criteria[" + index + "][ElementName]", allCriteria[index].element);
- requestData += '&' + encodeRequestData("Criteria[" + index + "][Min]", allCriteria[index].min);
- requestData += '&' + encodeRequestData("Criteria[" + index + "][Max]", allCriteria[index].max);
- }else if(allCriteria[index].type == 'boolean'){
- requestData = encodeRequestData("Criteria[" + index + "][CriteriaType]", "Boolean");
- requestData += '&' + encodeRequestData("Criteria[" + index + "][Operator]", allCriteria[index].operator);
- for(i = 0; i < allCriteria[index].criteria.length; i++){
- requestData += '&' + encodeRequestData("Criteria[" + index + "][CriteriaTerms][" + i + "]", allCriteria[index].criteria[i]);
- }
- for(i = 0; i < allCriteria[index].criteria.length; i++){
- requestData += '&' + formatCriteria(allCriteria[index].criteria[i]);
- }
- }
- return requestData;
-}
-
-function formatQueryRequest(expectedType){
- showLoadingIcon();
- requestData = encodeRequestData("Types[0]", ptName);
- requestData += '&' + encodeRequestData("PagedResults", "1");
- requestData += '&' + encodeRequestData("PageNum", pCurrPage);
- requestData += '&' + encodeRequestData("RootIndex", criteriaRoot);
- requestData += '&' + encodeRequestData("OutputFormat", expectedType);
- requestData += '&' + formatCriteria(criteriaRoot);
- displayPermalink();
- $.post(siteUrl + "/queryScript.do",
- requestData,
- function(data){
- hideLoadingIcon();
- if(expectedType == "html"){
- $("#" + htmlID).html(data);
- currPage = parseInt($("#page_num").val());
- totalPages = parseInt($("#total_pages").val());
- pageSize = parseInt($("#page_size").val());
- numPageProducts = $("#product_list > li").length;
- totalTypeProducts = $("#total_type_products").val();
- }else if(expectedType == "json"){
- if(parseInt(data['Error']) == 1){
- $("#" + htmlID).html('<div class="error">' + data['ErrorMsg'] + '</div>');
- pCurrPage = 0;
- pTotalPages = 0;
- pPageSize = 0;
- pNumPageProducts = 0;
- pTotalProducts = 0;
- }else{
- renderJsonOutput(data);
- pTotalPages = data['totalPages'];
- pPageSize = data['pageSize'];
- pNumPageProducts = data['results'].length;
- pTotalProducts = data['totalProducts'];
- }
- }
- displayPageInfo();
- },
- expectedType);
-}
-
-function formatCrossTypeQueryRequest(){
- showLoadingIcon();
- requestData = encodeRequestData("Types[0]", "*");
- requestData += '&' + encodeRequestData("RootIndex", criteriaRoot);
- requestData += '&' + formatCriteria(criteriaRoot);
- requestData += '&' + encodeRequestData("PageNum", pCurrPage);
- requestData += '&' + encodeRequestData("PageSize", pPageSize);
- displayPermalink();
- $.post(siteUrl + "/crossTypeQueryScript.do",
- requestData,
- function(data){
- hideLoadingIcon();
- if(parseInt(data['Error']) == 1){
- $("#" + htmlID).html('<div class="error">' + data['ErrorMsg'] + '</div>');
- }else{
- renderJsonOutput(data);
- pTotalPages = data['totalPages'];
- pTotalProducts = data['totalProducts'];
- pNumPageProducts = data['results'].length;
- displayPageInfo();
- }
- },
- "json");
-}
-
-function formatAllTypeRequest(){
- showLoadingIcon();
- requestData = encodeRequestData("PageNum", pCurrPage);
- requestData += '&' + encodeRequestData("PageSize", pPageSize);
- $.post(siteUrl + "/allTypeScript.do",
- requestData,
- function(data){
- hideLoadingIcon();
- if(parseInt(data['Error']) == 1){
- $("#" + htmlID).html('<div class="error">' + data['ErrorMsg'] + '</div>');
- }else{
- renderJsonOutput(data);
- pTotalPages = data['totalPages'];
- pTotalProducts = data['totalProducts'];
- pNumPageProducts = data['results'].length;
- displayPageInfo();
- }
- },
- "json");
-}
-
-function formatProductPageRequest(expectedType){
- showLoadingIcon();
- requestData = encodeRequestData("Type", ptName);
- requestData += '&' + encodeRequestData("PageNum", pCurrPage);
- requestData += '&' + encodeRequestData("OutputFormat", expectedType);
- $.post(siteUrl + "/pageScript.do",
- requestData,
- function(data){
- hideLoadingIcon();
- if(expectedType == "html"){
- $("#" + htmlID).html(data);
- currPage = parseInt($("#page_num").val());
- totalPages = parseInt($("#total_pages").val());
- pageSize = parseInt($("#page_size").val());
- numPageProducts = $("#product_list > li").length;
- totalTypeProducts = 0;
- }else if(expectedType == "json"){
- if(parseInt(data['Error']) == 1){
- $("#" + htmlID).html('<div class="error">' + data['ErrorMsg'] + '</div>');
- pCurrPage = 0;
- pTotalPages = 0;
- pPageSize = 0;
- pNumPageProducts = 0;
- pTotalProducts = 0;
- }else{
- renderJsonOutput(data);
- pTotalPages = data['totalPages'];
- pPageSize = data['pageSize'];
- pNumPageProducts = data['results'].length;
- pTotalProducts = data['totalProducts'];
- }
- }
- displayPageInfo();
- },
- expectedType);
-}
-
-// Determine whether to request a page or query, depending upon the presence
-// of any non-boolean criteria. Returns 0 for a page and 1 for a query.
-function determineRequest(index){
- if(allCriteria[index] == null){
- return 0;
- }
- if(allCriteria[index].type != 'boolean'){
- return 1;
- }
- for(i = 0; i < allCriteria[index].criteria.length; i++){
- if(determineRequest(allCriteria[index].criteria[i])){
- return 1;
- }
- }
- return 0;
-}
-
-function sendRequest(expectedType){
- if(determineRequest(criteriaRoot)){
- formatQueryRequest(expectedType);
- }else{
- formatProductPageRequest(expectedType);
- }
-}
-
-function sendCrossTypeRequest(){
- if(determineRequest(criteriaRoot)){
- formatCrossTypeQueryRequest();
- }else{
- if(parseInt(defaultShowEverything) == 1){
- formatAllTypeRequest();
- }else{
- clearResults();
- }
- }
-}
-
-function addCriteria(){
- index = criteriaNum;
- criteriaNum++;
- allCriteria[index] = new Object();
- return index;
-}
-
-function addTermCriteria(elementName, value, parentIndex){
- index = addCriteria();
- allCriteria[index].type = 'term';
- allCriteria[index].parentIndex = parentIndex;
- allCriteria[index].element = elementName;
- allCriteria[index].value = value;
- if(parentIndex != null){
- allCriteria[parentIndex].criteria.push(index);
- }
- return index;
-}
-
-function addRangeCriteria(elementName, min, max, parentIndex){
- index = addCriteria();
- allCriteria[index].type = 'range';
- allCriteria[index].parentIndex = parentIndex;
- allCriteria[index].element = elementName;
- allCriteria[index].min = min;
- allCriteria[index].max = max;
- if(parentIndex != null){
- allCriteria[parentIndex].criteria.push(index);
- }
- return index;
-}
-
-function addBooleanCriteria(operator, parentIndex){
- index = addCriteria();
- allCriteria[index].type = 'boolean';
- allCriteria[index].parentIndex = parentIndex;
- allCriteria[index].operator = operator;
- allCriteria[index].criteria = new Array();
- if(parentIndex != null){
- allCriteria[parentIndex].criteria.push(allCriteria[index]);
- }
- return index;
-}
-
-function removeCriteria(index){
- if(allCriteria[index].parentIndex != null){
- parentCriteria = allCriteria[allCriteria[index].parentIndex];
- for(i = 0; i < parentCriteria.criteria.length; i++){
- if(parentCriteria.criteria[i] == index){
- parentCriteria.criteria.splice(i, 1);
- i = parentCriteria.criteria.length;
- }
- }
- }
- allCriteria[index] = null;
-}
-
-function showLoadingIcon(){
- $("#" + htmlID).css("display", "none");
- $("#" + loadingID).css("display", "block");
-}
-
-function hideLoadingIcon(){
- $("#" + htmlID).css("display", "block");
- $("#" + loadingID).css("display", "none");
-}
-
-function setExclusiveQuery(exclusive){
- if(allCriteria[criteriaRoot]){
- if(exclusive == true){
- allCriteria[criteriaRoot].operator = 'and';
- }else{
- allCriteria[criteriaRoot].operator = 'or';
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/views/dataset.php
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/views/dataset.php b/balance/modules/cas-browser/views/dataset.php
deleted file mode 100644
index d92966f..0000000
--- a/balance/modules/cas-browser/views/dataset.php
+++ /dev/null
@@ -1,100 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Load the module context for this module
-$module = App::Get()->loadModule();
-
-require_once($module->modulePath . "/classes/CasBrowser.class.php");
-require_once($module->modulePath . "/scripts/widgets/MetadataDisplayWidget.php");
-
-// Get a CAS-Browser XML/RPC client
-$browser = new CasBrowser();
-$client = $browser->getClient();
-
-// Get a Product Type object
-$productType = $client->getProductTypeById(App::Get()->request->segments[0]);
-$ptID = $productType->getId();
-$ptName = $productType->getName();
-
-// Determine the visibility level based on the current user
-$ptVisibilityLevel = $browser->getProductTypeVisibilityLevel($ptID);
-
-// Redirect the user if they are not authorized
-if ($ptVisibilityLevel == CasBrowser::VIS_NONE) {
- App::Get()->redirect(SITE_ROOT . '/errors/403');
-}
-
-// Load a MetadataDisplayWidget with the visible metadata for this product type
-$typeMetadataWidget = new MetadataDisplayWidget(array());
-$typeMetadataWidget->loadMetadata($browser->getVisibleMetadataForProductType($ptID));
-
-// Create a MetadataDisplayWidget to display system metadata (all except typeMetadata)
-$typeMetadata = $productType->toAssocArray();
-unset($typeMetadata['typeMetadata']);
-$systemMetadataWidget = new MetadataDisplayWidget(array());
-$systemMetadataWidget->loadMetadata($typeMetadata);
-
-
-// Prepare BreadcrumbWigdet
-$bcw = new BreadcrumbsWidget();
-$bcw->add('Home',SITE_ROOT . '/');
-$bcw->add("Browse By Type", $module->moduleRoot . '/');
-$bcw->add($ptName);
-?>
-
-
-<div class="container">
- <hr class="space" />
-
- <div id="cas_browser_container">
- <h2><?php echo $sortedMetadata['DataSetName'][0]?> <?php echo $ptName?></h2>
- <hr />
-
- <div id="section_type_metadata">
- <h3>Description:</h3>
- <p><?php echo $productType->getDescription()?></p>
- <hr class="space" />
-
- <ul class="tabmenu">
- <li class="selected"><a href="<?php echo $module->moduleRoot?>/dataset/<?php echo $ptID?>">Additional Information</a></li>
- <li class=""><a href="<?php echo $module->moduleRoot?>/products/<?php echo $ptID?>">Downloadable Files</a></li>
- </ul>
-
- <div id="additional-information">
- <p>The following additional metadata information has been defined for this
- dataset.</p>
-
- <?php if ($ptVisibilityLevel == CasBrowser::VIS_LIMIT):?>
- <div class="notice">Additional information may exist that is not visible
- due to your current access permissions.</div>
- <?php endif;?>
-
- <?php echo $typeMetadataWidget->render()?>
- </div>
-
- <div id="data"></div>
- </div>
-
- <?php if (!App::Get()->settings['browser_suppress_system_metadata']):?>
- <div id="section_system_metadata">
- <h3>System Metadata:</h3>
- <?php echo $systemMetadataWidget->render()?>
- </div>
- <?php endif;?>
- </div>
-</div>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/views/index.php
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/views/index.php b/balance/modules/cas-browser/views/index.php
deleted file mode 100644
index 24cdf31..0000000
--- a/balance/modules/cas-browser/views/index.php
+++ /dev/null
@@ -1,87 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-$module = App::Get()->loadModule();
-require_once( $module->modulePath . "/classes/CasBrowser.class.php");
-require_once( $module->modulePath . "/scripts/widgets/ProductTypeListWidget.php");
-
-// Get a CAS-Browser XML/RPC client
-$browser = new CasBrowser();
-$client = $browser->getClient();
-$isAlive = $client->isAlive();
-if ( !$isAlive ) {
- App::Get()->SetMessage("Filemgr at ". $client->serverURL. " is down. Please start it.<br>",CAS_MSG_ERROR);
-} else{
-
-// Get a list of the product types managed by this server
-$response = $client->getProductTypes();
-$productTypes = array();
-
-foreach ($response as $pt) {
- $ptArray = $pt->toAssocArray();
-
- $ptVisibility = $browser->getProductTypeVisibilityLevel($pt->getId());
-
- if ($ptVisibility == CasBrowser::VIS_NONE) { continue; }
-
- $merged = array(
- "name" => array(
- $ptArray[App::Get()->settings['browser_pt_name_key']],
- $client->getNumProducts($pt)),
- "description" => array($ptArray[App::Get()->settings['browser_pt_desc_key']]),
- "id" => array($ptArray[App::Get()->settings['browser_pt_id_key']]));
- $merged += $ptArray['typeMetadata'];
-
- $productTypes[$ptArray[App::Get()->settings['browser_pt_id_key']]] = $merged;
-}
-$productTypeListWidget = new ProductTypeListWidget(array("productTypes" => $productTypes));
-$productTypeListWidget->setUrlBase($module->moduleRoot);
-}
-
-// Prepare BreadcrumbWigdet
-$bcw = new BreadcrumbsWidget();
-$bcw->add('Home',SITE_ROOT . '/');
-$bcw->add("Browse By Type");
-?>
-
-<script type="text/javascript" src="<?php echo $module->moduleStatic?>/js/jquery.dataTables.min.js"></script>
-<script type="text/javascript">
-$(document).ready(function() {
- // Turn the table into a sortable, searchable table
- $("#productTypeSearch").dataTable();
- // Give the search box the initial focus
- $("#productTypeSearch_filter > input").focus();
-});
-</script>
-
-<div class="container">
-
-<?php if ( $isAlive ) :?>
-<hr class="space"/>
-<div id="cas_browser_container" class="span-22 last prepend-1 append-1">
- <h2 id="cas_browser_title"><?php echo App::Get()->settings['browser_index_title_text']?></h2>
- <ul class="tabmenu">
- <li class="selected"><a href="<?php echo $module->moduleRoot?>/">Browse By Type</a></li>
- <li class=""><a href="<?php echo $module->moduleRoot?>/typesearch/">Browse Across Types</a></li>
- </ul>
- <br class="fiftyPx"/>
-<?php $productTypeListWidget->render();?>
-</div>
-<hr class="space"/>
-</div>
-<?php endif; ?>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/views/product.php
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/views/product.php b/balance/modules/cas-browser/views/product.php
deleted file mode 100644
index 34f6174..0000000
--- a/balance/modules/cas-browser/views/product.php
+++ /dev/null
@@ -1,84 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-$module = App::Get()->loadModule();
-require_once($module->modulePath . "/classes/CasBrowser.class.php");
-require_once($module->modulePath . "/scripts/widgets/MetadataDisplayWidget.php");
-require_once($module->modulePath . "/scripts/widgets/ProductDownloadWidget.php");
-
-// Get a CAS-Browser XML/RPC client
-$browser = new CasBrowser();
-$client = $browser->getClient();
-
-// Get the specified product
-$productId = App::Get()->request->segments[0];
-$product = $client->getProductById($productId);
-$productName = $product->getName();
-$productTypeName = $product->getType()->getName();
-$productTypeId = $product->getType()->getId();
-$productMetadata = $client->getMetadata($product);
-
-// Get metadata for product and productType as associative arrays
-$productTypeInfo = $product->getType()->toAssocArray();
-$productInfo = $productMetadata->toAssocArray();
-
-$productVisibilityLevel = $browser->getProductVisibilityLevel($productId);
-
-// Redirect the user if they are not authorized
-if ($productVisibilityLevel == CasBrowser::VIS_NONE) {
- App::Get()->redirect(SITE_ROOT . '/errors/403');
-}
-
-
-// Create and load a MetadataDisplay widget wit the visible metadata
-$metadataWidget = new MetadataDisplayWidget(array());
-$metadataWidget->loadMetadata($browser->getVisibleMetadataForProduct($productId));
-
-// Record the product page to send the user back to, if provided
-$returnPage = isset(App::Get()->request->segments[1]) ? App::Get()->request->segments[1] : 1;
-
-// Create a ProductDownloadWidget
-$productDownloadWidget = new ProductDownloadWidget(array(
- "dataDeliveryUrl" => App::Get()->settings['browser_datadeliv_url']));
-$productDownloadWidget->setClient($client);
-$productDownloadWidget->load($product);
-
-// Add the cas-browser styles
-App::Get()->response->addStylesheet($module->moduleStatic . '/css/cas-browser.css');
-
-// Prepare BreadcrumbWigdet
-$bcw = new BreadcrumbsWidget();
-$bcw->add('Home',SITE_ROOT . '/');
-$bcw->add('Browse By Type', $module->moduleRoot . '/');
-$bcw->add($productTypeName, $module->moduleRoot."/dataset/{$productTypeId}");
-$bcw->add('Products', $module->moduleRoot."/products/{$productTypeId}/page/{$returnPage}");
-$bcw->add(App::Get()->request->segments[0]);
-?>
-
-
-<hr class="space"/>
-<div class="span-22 last prepend-1 append-1">
- <div id="cas_browser_product_metadata">
- <h2 class="larger loud">Product Metadata: <?php echo wordwrap($productName, 62, "<br />",true);?></h2>
- <?php $metadataWidget->render()?>
- </div>
- <div id="cas_browser_product_download">
- <h2 class="larger loud">Download this Product:</h2>
- <?php $productDownloadWidget->render()?>
- </div>
-</div>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/views/products.php
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/views/products.php b/balance/modules/cas-browser/views/products.php
deleted file mode 100644
index 0792c10..0000000
--- a/balance/modules/cas-browser/views/products.php
+++ /dev/null
@@ -1,156 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-$module = App::Get()->loadModule();
-require_once($module->modulePath . "/classes/CasBrowser.class.php");
-require_once($module->modulePath . "/scripts/widgets/FilterWidget.php");
-require_once($module->modulePath . "/scripts/widgets/ProductPageWidget.php");
-
-// Get a CAS-Browser XML/RPC client
-$browser = new CasBrowser();
-$client = $browser->getClient();
-
-// Get a Product Type object
-$productType = $client->getProductTypeById(App::Get()->request->segments[0]);
-$ptID = $productType->getId();
-$ptName = $productType->getName();
-$typeInfo = $productType->toAssocArray();
-
-// Determine the visibility level based on the current user
-$ptVisibilityLevel = $browser->getProductTypeVisibilityLevel($ptID);
-
-// Redirect the user if they are not authorized
-if ($ptVisibilityLevel == CasBrowser::VIS_NONE) {
- App::Get()->redirect(SITE_ROOT . '/errors/403');
-}
-
-// Store any filter parameters passed in via URL
-$filterParams = array();
-$segments = App::Get()->request->segments;
-for($index = 1; isset($segments[$index]) && $segments[$index] != ""; $index = $index + 2){
- array_push($filterParams, array($segments[$index], $segments[$index + 1]));
-}
-if(count($filterParams) > 0){
- $filterButtonValue = "Hide Filters";
-}else{
- $filterButtonValue = "Show Filters";
-}
-
-// Initialize the FilterWidget
-$querySiteRoot = (isset(App::Get()->settings['query_service_url']))
- ? App::Get()->settings['query_service_url']
- : 'http://' . $_SERVER['HTTP_HOST'] . $module->moduleRoot;
-$resultFormat = "json";
-$filterWidget = new FilterWidget(array(
- 'productType' => $productType,
- 'htmlID' => 'cas_browser_product_list',
- 'loadingID' => 'loading_icon_container',
- 'siteUrl' => $querySiteRoot,
- 'pagedResults' => true,
- 'resultFormat' => $resultFormat));
-$filterWidget->renderScript();
-
-// Determine whether to show the download widget
-$showDownloadWidget = (isset(App::Get()->settings['browser_show_download_widget'])
- && App::Get()->settings['browser_show_download_widget'] == 0)
- ? false
- : true;
-
-// Prepare BreadcrumbWigdet
-$bcw = new BreadcrumbsWidget();
-$bcw->add('Home',SITE_ROOT . '/');
-$bcw->add("Browse By Type", $module->moduleRoot . '/');
-$bcw->add($ptName, $module->moduleRoot."/dataset/{$ptID}");
-$bcw->add("Products");
-?>
-
-<script type="text/javascript">
-$(document).ready(function() {
-
- $('#showFilters').click(function() {
- if ($(this).val() == "Show Filters") {
- $('#filter_widget').fadeIn('slow');
- $(this).val('Hide Filters');
- } else {
- $('#filter_widget').fadeOut('slow');
- $(this).val('Show Filters');
- }
- });
-
- <?php
- if(count($filterParams) > 0){
- foreach($filterParams as $filter){
- echo "createFilter('" . $filter[0] . "','" . $filter[1] . "');\n";
- }
- echo 'displayPermalink();';
- echo '$("#filter_widget").css("display", "block");';
- }
- ?>
-
- sendRequest(<?php echo '"' . $resultFormat . '"'; ?>);
-
-});
-</script>
-<div class="container">
-<hr class="space"/>
-<div id="cas_browser_container" class="span-24 last">
-
- <div id="section_products">
- <h2 ><?php echo $ptName?></h2>
- <hr/>
-
- <div id="section_type_metadata">
- <h3>Description:</h3>
- <p><?php echo $typeInfo['description']?></p>
- <hr class="space"/>
-
- <ul class="tabmenu">
- <li class=""> <a href="<?php echo $module->moduleRoot?>/dataset/<?php echo $ptID?>">Additional Information</a></li>
- <li class="selected"><a href="<?php echo $module->moduleRoot?>/products/<?php echo $ptID?>">Downloadable Files</a></li>
- </ul>
- </div>
- <?php if ( $ptVisibilityLevel == CasBrowser::VIS_LIMIT ):?>
- <div class="notice">
- Additional information may exist that is not visible due to your current access permissions.
- </div>
- <?php endif;?>
-
- <div id="section_filter_tools_container">
- <div id="section_filter_tools_buttons">
- <input type="button" id="showFilters" value=<?php echo '"' . $filterButtonValue . '"';?>/>
- </div>
- <div id="section_filter_tools">
- <div id="filter_widget">
- Filter: <?php $filterWidget->render(); ?>
- <input type="hidden" id="page_num" value="1">
- </div>
- </div>
- </div>
- <?php if ( !App::Get()->settings['browser_private_products_visibility'] && $ptVisibilityLevel == CasBrowser::VIS_LIMIT ):?>
- <h3>Public Downloadable Files for this Dataset</h3>
- <?php else :?>
- <h3>Downloadable Files for this Dataset</h3>
- <?php endif;?>
- <div id="loading_icon_container">
- <img src="<?php echo App::Get()->request->moduleStatic . '/img/loading.gif'; ?>"/>
- </div>
- <div id="cas_browser_product_list"></div>
-
- </div>
-</div>
-</div>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/views/search.php
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/views/search.php b/balance/modules/cas-browser/views/search.php
deleted file mode 100644
index 9db6b1e..0000000
--- a/balance/modules/cas-browser/views/search.php
+++ /dev/null
@@ -1,89 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-$module = App::Get()->loadModule();
-
-require_once($module->modulePath . "/classes/CasBrowser.class.php");
-
-// Get a CAS-Browser XML/RPC client
-$browser = new CasBrowser();
-$client = $browser->getClient();
-
-// Get a Product Type object
-$productType = $client->getProductTypeById(App::Get()->request->segments[0]);
-$productCount = $client->getNumProducts($productType);
-$ptID = $productType->getId();
-$ptName = $productType->getName();
-
-// Determine which search widget to show
-$widgetClassName = isset(App::Get()->settings['browser_product_search_widget'])
- ? App::Get()->settings['browser_product_search_widget']
- : 'FilterWidget';
-
-$querySiteRoot = (isset(App::Get()->settings['query_service_url']))
- ? App::Get()->settings['query_service_url']
- : 'http://' . $_SERVER['HTTP_HOST'] . MODULE_ROOT;
-
-// Create the search widget
-require_once($module->modulePath . "/scripts/widgets/{$widgetClassName}.php");
-$searchWidget = new $widgetClassName(array(
- 'productType'=>$productType,
- 'htmlID'=>'cas_browser_product_list',
- 'siteUrl'=>$querySiteRoot,
- 'pagedResults'=>true,
- 'resultFormat'=>'json'));
-
-// Render search widget javascript
-$searchWidget->renderScript();
-
-// Prepare BreadcrumbWigdet
-$bcw = new BreadcrumbsWidget();
-$bcw->add('Home',SITE_ROOT . '/');
-$bcw->add("Browser", $module->moduleRoot . '/');
-$bcw->add($ptName, $module->moduleRoot."/dataset/{$ptID}");
-$bcw->add("Product Search");
-?>
-
-<div class="container">
-<hr class="space"/>
-<div id="cas_browser_container" class="span-24 last">
- <ul class="tabs">
- <li><a id="tab_metadata" href="<?php echo MODULE_ROOT?>/dataset/<?php echo $ptID?>">Metadata</a></li>
- <li><a id="tab_browse" href="<?php echo MODULE_ROOT?>/products/<?php echo $ptID?>">Browse</a></li>
- <li><a id="tab_search" href="<?php echo MODULE_ROOT?>/search/<?php echo $ptID?>" class="selected">Search</a></li>
- </ul>
- <div id="section_products">
- <h2 class="larger loud">Product Search: <?php echo $ptName?></h2>
- <br/>
- <div id="cas_browser_search_widget" class="span-24 last">
- <?php $searchWidget->render(); ?>
- <input type="hidden" id="page_num" value="1">
- </div>
- <div id="cas_browser_product_list" class="span-16 colborder">
- <h3>Product Search Results</h3>
- </div>
- <div id="cas_browser_dataset_download" class="span-6 last">
- <a href="<?php echo App::Get()->settings['browser_datadeliv_url']?>/dataset?typeID=<?php echo App::Get()->request->segments[0]?>&format=application/x-zip">
- <img src="<?php echo MODULE_STATIC?>/img/zip-icon-smaller.gif" id="zip_icon" alt="zip-icon"/>
- </a>
- Click on the icon to download all <?php echo $productCount ?> data products associated with
- this search as a single Zip archive.<br/>
- </div>
- </div>
-</div>
-</div>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/views/typesearch.php
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/views/typesearch.php b/balance/modules/cas-browser/views/typesearch.php
deleted file mode 100644
index 35fe3ab..0000000
--- a/balance/modules/cas-browser/views/typesearch.php
+++ /dev/null
@@ -1,121 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-$module = App::Get()->loadModule();
-require_once($module->modulePath . "/classes/CasBrowser.class.php");
-require_once($module->modulePath . "/scripts/widgets/CrossTypeSearchWidget.php");
-
-// Get a CAS-Browser XML/RPC client
-$browser = new CasBrowser();
-$client = $browser->getClient();
-
-// Initialize the CrossTypeSearchWidget
-$querySiteRoot = (isset(App::Get()->settings['query_service_url']))
- ? App::Get()->settings['query_service_url']
- : 'http://' . $_SERVER['HTTP_HOST'] . $module->moduleRoot;
-$crossTypeWidget = new CrossTypeSearchWidget(array(
- 'htmlID' => 'cas_browser_product_list',
- 'loadingID' => 'loading_icon_container',
- 'siteUrl' => $querySiteRoot));
-$crossTypeWidget->renderScript();
-
-// Store any filter and exclusive/inclusive parameters passed in via URL
-$urlParams = CrossTypeSearchWidget::parseSegments();
-$queryBoolValue = 'and';
-$exclusiveChecked = true;
-if(isset($urlParams['filterParams'])){
- $filterButtonValue = "Hide Filters";
-}else{
- $filterButtonValue = "Show Filters";
-}
-if(isset($urlParams['exclusive'])){
- $queryBoolValue = $urlParams['exclusive']['bool'];
- $exclusiveChecked = $urlParams['exclusive']['checked'];
-}
-
-// Prepare BreadcrumbWigdet
-$bcw = new BreadcrumbsWidget();
-$bcw->add('Home',SITE_ROOT . '/');
-$bcw->add("Browse Across Types");
-?>
-
-<script type="text/javascript" src="<?php echo $module->moduleStatic?>/js/jquery.dataTables.min.js"></script>
-<script type="text/javascript">
-$(document).ready(function() {
-
- $('#showFilters').click(function() {
- if ($(this).val() == "Show Filters") {
- $('#filter_widget').fadeIn('slow');
- $(this).val('Hide Filters');
- } else {
- $('#filter_widget').fadeOut('slow');
- $(this).val('Show Filters');
- }
- });
-
- pPageSize = 20;
-
- addBooleanCriteria(<?php echo "'" . $queryBoolValue . "'"; ?>, null);
-
- <?php
- if(isset($urlParams['filterParams'])){
- foreach($urlParams['filterParams'] as $filter){
- echo "createFilter('" . $filter[0] . "','" . $filter[1] . "');\n";
- }
- if($exclusiveChecked == false){
- echo '$("#exclusive").attr("checked", false);';
- }
- echo 'displayPermalink();';
- echo '$("#filter_widget").css("display", "block");';
- }
- ?>
-
- sendCrossTypeRequest();
-
-});
-</script>
-<div class="container">
-<hr class="space"/>
-<div id="cas_browser_container" class="span-24 last">
- <div id="section_products">
- <h2 ><?php echo "Cross Product Type Search"?></h2>
- <ul class="tabmenu">
- <li class=""><a href="<?php echo $module->moduleRoot?>/">Browse By Type</a></li>
- <li class="selected"><a href="<?php echo $module->moduleRoot?>/typesearch/">Browse Across Types</a></li>
- </ul>
- <hr class="space"/>
-
- <div id="section_filter_tools_container">
- <div id="section_filter_tools_buttons">
- <input type="button" id="showFilters" value=<?php echo '"' . $filterButtonValue . '"';?> />
- </div>
- <div id="section_filter_tools">
- <div id="filter_widget">
- Filter: <?php $crossTypeWidget->render(); ?>
- </div>
- </div>
- </div>
-
- <br/>
- <div id="loading_icon_container">
- <img src="<?php echo App::Get()->request->moduleStatic . '/img/loading.gif'; ?>"/>
- </div>
- <div id="cas_browser_product_list"></div>
- </div>
-</div>
-</div>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/profile/README.txt
----------------------------------------------------------------------
diff --git a/balance/modules/profile/README.txt b/balance/modules/profile/README.txt
deleted file mode 100644
index f07be3d..0000000
--- a/balance/modules/profile/README.txt
+++ /dev/null
@@ -1,88 +0,0 @@
-Profile Manager - Lightweight profile manager for Balance applications
-======================================================================
-
-Overview
---------
-
-The Profile Manager provides an interface to simplify the process of accessing and
-managing the information within the underlying directory services. The module provides
-views that make it easy to login, browse, and manage profile information for a specified
-user. It also provides a simplified way to create new profiles. However, an administrative
-user must grant the new user privileges from within the underlying directory service. The
-primary use case for this module involves authentication and authorization using LDAP,
-although it should be possible to support additional back-ends with moderate customization.
-
-
-How it Works
-------------
-
-The Profile Manager has been designed so that it is easy to plug in custom back end
-directory services (LDAP, MySql, etc). The profile manager comes with a ready-to-use
-LDAP provider but customizing it is very simple. Once all the attributes in the
-config.ini file are set, the profile manager will display all attributes defined.
-These attributes will be displayed on the view.php page and can be modified through
-the manage.php page. The profile manager also provides the ability to change user
-passwords. Moreover, user groups can be viewed on the groups.php page if authorization
-configurations are setup.
-
-
-Installation
-------------
-
-Copy the Profile module (this directory) to the /modules directory of
-your Balance application.
-
-
-Dependencies
-------------
-
- CAS-Single Sign On ( For LDAP users )
-: If LDAP is used for authentication and/or authorization, the [CAS-SSO](https://svn.apache.org/repos/asf/oodt/tags/0.3/sso/src/main/php/pear/)
- library must be available on the host environment to allow the module to communicate
- with LDAP through this library.
-
-
-Configuration
--------------
-
-All configuration for the Profile Manager takes place in the module's 'config.ini' file.
-See the inline documentation in 'config.ini' for detailed information about each
-configuration option.
-
-
-Developer Guide
----------------
-
-### Including the Profile Manager in your application
-
-In general, the Profile Manager needs to be available on each application view. To avoid
-having to load the module at the top of each view, it is possible to include the module once,
-in the Balance index.php at the root of your application. Simply add the following
-lines to the 'index.php' file where it says 'Initialize any globally required modules here':
-
-// Profile Manager initialization
-$module = App::Get()->loadModule('NAME_OF_PROFILE_DIRECTORY');
-
-
-### Including the Profile Manager in your application views ###
-
-Before displaying the manager first you must initialize the UserStatusWidget by adding the
-following:
-
- // Load profile module for path access
- $module = App::Get()->loadModule('profile');
- // Prepare User login details
- $authentication = App::Get()->getAuthProvider();
- $username = $authentication->getCurrentUsername();
- require_once( $module->modulePath . '/scripts/widgets/UserStatusWidget.php' );
- $userStatus = new UserStatusWidget(
- array( $authentication->isLoggedIn(),
- $username,
- // Set profile management on. 'false' will disable the link to profile management.
- true), true );
-
-To display the user status in your application views simply add the following:
-
- <?php $userStatus->render();?>
-
-
[48/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/DefaultPropView.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/DefaultPropView.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/DefaultPropView.java
deleted file mode 100644
index 3a98e29..0000000
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/DefaultPropView.java
+++ /dev/null
@@ -1,862 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.workflow.gui.perspective.view.impl;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.oodt.cas.metadata.Metadata;
-import org.apache.oodt.cas.workflow.gui.model.ModelGraph;
-import org.apache.oodt.cas.workflow.gui.perspective.view.View;
-import org.apache.oodt.cas.workflow.gui.perspective.view.ViewState;
-import org.apache.oodt.cas.workflow.gui.util.GuiUtils;
-
-import java.awt.BorderLayout;
-import java.awt.Checkbox;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Dimension;
-import java.awt.Font;
-import java.awt.GridLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.text.DecimalFormat;
-import java.text.Format;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Vector;
-
-import javax.swing.BoxLayout;
-import javax.swing.DefaultListModel;
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import javax.swing.JList;
-import javax.swing.JMenuItem;
-import javax.swing.JPanel;
-import javax.swing.JPopupMenu;
-import javax.swing.JScrollPane;
-import javax.swing.JSlider;
-import javax.swing.JTable;
-import javax.swing.JTextField;
-import javax.swing.ListSelectionModel;
-import javax.swing.border.EtchedBorder;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-import javax.swing.table.AbstractTableModel;
-import javax.swing.table.TableCellRenderer;
-import javax.swing.table.TableColumn;
-
-
-/**
- *
- *
- * The default view displaying a workflow property (for a task, or a condition,
- * or set of workflows).
- *
- * @author bfoster
- * @author mattmann
- *
- */
-public class DefaultPropView extends View {
-
- private static final long serialVersionUID = -5521047300551974898L;
-
- private JTable table;
- private JPopupMenu tableMenu;
- private JMenuItem override;
- private JMenuItem delete;
- private static final String OVERRIDE = "Override";
- private static final String DELETE = "Delete";
- private int DEFAULT_PRIORITY = 5;
-
- public DefaultPropView(String name) {
- super(name);
- this.setLayout(new BorderLayout());
- }
-
- private JTable createTable(final ViewState state) {
- JTable table;
- final ModelGraph selected = state.getSelected();
- if (selected != null) {
- final Vector<Vector<String>> rows = new Vector<Vector<String>>();
- ConcurrentHashMap<String, String> keyToGroupMap = new ConcurrentHashMap<String, String>();
- Metadata staticMet = selected.getModel().getStaticMetadata();
- Metadata inheritedMet = selected.getInheritedStaticMetadata(state);
- Metadata completeMet = new Metadata();
- if (staticMet != null) {
- completeMet.replaceMetadata(staticMet.getSubMetadata(state
- .getCurrentMetGroup()));
- }
- if (selected.getModel().getExtendsConfig() != null) {
- for (String configGroup : selected.getModel().getExtendsConfig()) {
- Metadata extendsMetadata = state.getGlobalConfigGroups()
- .get(configGroup).getMetadata()
- .getSubMetadata(state.getCurrentMetGroup());
- for (String key : extendsMetadata.getAllKeys()) {
- if (!completeMet.containsKey(key)) {
- keyToGroupMap.put(key, configGroup);
- completeMet.replaceMetadata(key,
- extendsMetadata.getAllMetadata(key));
- }
- }
- }
- }
- if (inheritedMet != null) {
- Metadata inheritedMetadata = inheritedMet.getSubMetadata(state
- .getCurrentMetGroup());
- for (String key : inheritedMetadata.getAllKeys()) {
- if (!completeMet.containsKey(key)) {
- keyToGroupMap.put(key, "__inherited__");
- completeMet.replaceMetadata(key,
- inheritedMetadata.getAllMetadata(key));
- }
- }
- }
- List<String> keys = completeMet.getAllKeys();
- Collections.sort(keys);
- for (String key : keys) {
- if (key.endsWith("/envReplace")) {
- continue;
- }
- String values = StringUtils.join(completeMet.getAllMetadata(key), ",");
- Vector<String> row = new Vector<String>();
- row.add(keyToGroupMap.get(key));
- row.add(key);
- row.add(values);
- row.add(Boolean.toString(Boolean.parseBoolean(completeMet
- .getMetadata(key + "/envReplace"))));
- rows.add(row);
- }
- table = new JTable();
- table.setModel(new AbstractTableModel() {
- public String getColumnName(int col) {
- switch (col) {
- case 0:
- return "group";
- case 1:
- return "key";
- case 2:
- return "values";
- case 3:
- return "envReplace";
- default:
- return null;
- }
- }
-
- public int getRowCount() {
- return rows.size() + 1;
- }
-
- public int getColumnCount() {
- return 4;
- }
-
- public Object getValueAt(int row, int col) {
- if (row >= rows.size()) {
- return null;
- }
- String value = rows.get(row).get(col);
- if (value == null && col == 3) {
- return "false";
- }
- if (value == null && col == 0) {
- return "__local__";
- }
- return value;
- }
-
- public boolean isCellEditable(int row, int col) {
- if (row >= rows.size()) {
- return selected.getModel().getStaticMetadata()
- .containsGroup(state.getCurrentMetGroup());
- }
- if (col == 0) {
- return false;
- }
- String key = rows.get(row).get(1);
- return key == null
- || (selected.getModel().getStaticMetadata() != null && selected
- .getModel().getStaticMetadata()
- .containsKey(getKey(key, state)));
- }
-
- public void setValueAt(Object value, int row, int col) {
- if (row >= rows.size()) {
- Vector<String> newRow = new Vector<String>(Arrays
- .asList(new String[] { null, null, null, null }));
- newRow.add(col, (String) value);
- rows.add(newRow);
- } else {
- Vector<String> rowValues = rows.get(row);
- rowValues.add(col, (String) value);
- rowValues.remove(col + 1);
- }
- this.fireTableCellUpdated(row, col);
- }
-
- });
- MyTableListener tableListener = new MyTableListener(state);
- table.getModel().addTableModelListener(tableListener);
- table.getSelectionModel().addListSelectionListener(tableListener);
- } else {
- table = new JTable(new Vector<Vector<String>>(), new Vector<String>(
- Arrays.asList(new String[] { "key", "values", "envReplace" })));
- }
-
- table.setSelectionBackground(Color.cyan);
- table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
- TableCellRenderer cellRenderer = new TableCellRenderer() {
-
- public Component getTableCellRendererComponent(JTable table,
- Object value, boolean isSelected, boolean hasFocus, int row,
- int column) {
- JLabel field = new JLabel((String) value);
- if (column == 0) {
- field.setForeground(Color.gray);
- } else {
- if (isSelected) {
- field.setBorder(new EtchedBorder(1));
- }
- if (table.isCellEditable(row, 1)) {
- field.setForeground(Color.black);
- } else {
- field.setForeground(Color.gray);
- }
- }
- return field;
- }
-
- };
- TableColumn groupCol = table.getColumnModel().getColumn(0);
- groupCol.setPreferredWidth(75);
- groupCol.setCellRenderer(cellRenderer);
- TableColumn keyCol = table.getColumnModel().getColumn(1);
- keyCol.setPreferredWidth(200);
- keyCol.setCellRenderer(cellRenderer);
- TableColumn valuesCol = table.getColumnModel().getColumn(2);
- valuesCol.setPreferredWidth(300);
- valuesCol.setCellRenderer(cellRenderer);
- TableColumn envReplaceCol = table.getColumnModel().getColumn(3);
- envReplaceCol.setPreferredWidth(75);
- envReplaceCol.setCellRenderer(cellRenderer);
-
- table.addMouseListener(new MouseListener() {
- public void mouseClicked(MouseEvent e) {
- if (e.getButton() == MouseEvent.BUTTON3
- && DefaultPropView.this.table.getSelectedRow() != -1) {
- int row = DefaultPropView.this.table.getSelectedRow();
- String key = getKey(
- (String) DefaultPropView.this.table.getValueAt(row, 1), state);
- Metadata staticMet = state.getSelected().getModel()
- .getStaticMetadata();
- override.setVisible(staticMet == null || !staticMet.containsKey(key));
- delete.setVisible(staticMet != null && staticMet.containsKey(key));
- tableMenu.show(DefaultPropView.this.table, e.getX(), e.getY());
- }
- }
-
- public void mouseEntered(MouseEvent e) {
- }
-
- public void mouseExited(MouseEvent e) {
- }
-
- public void mousePressed(MouseEvent e) {
- }
-
- public void mouseReleased(MouseEvent e) {
- }
- });
-
- return table;
- }
-
- @Override
- public void refreshView(final ViewState state) {
- this.removeAll();
-
- tableMenu = new JPopupMenu("TableMenu");
- this.add(tableMenu);
- override = new JMenuItem(OVERRIDE);
- override.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- int row = DefaultPropView.this.table.getSelectedRow();
- String key = getKey(
- (String) DefaultPropView.this.table.getValueAt(row, 1), state);
- Metadata staticMet = state.getSelected().getModel().getStaticMetadata();
- if (staticMet == null) {
- staticMet = new Metadata();
- }
- if (e.getActionCommand().equals(OVERRIDE)) {
- if (!staticMet.containsKey(key)) {
- staticMet.addMetadata(key,
- (String) DefaultPropView.this.table.getValueAt(row, 2));
- String envReplace = (String) DefaultPropView.this.table.getValueAt(
- row, 3);
- if (Boolean.valueOf(envReplace)) {
- staticMet.addMetadata(key + "/envReplace", envReplace);
- }
- state.getSelected().getModel().setStaticMetadata(staticMet);
- DefaultPropView.this.notifyListeners();
- }
- }
- }
- });
- delete = new JMenuItem(DELETE);
- delete.addActionListener(new ActionListener() {
-
- public void actionPerformed(ActionEvent e) {
- int row = DefaultPropView.this.table.getSelectedRow();
- String key = getKey(
- (String) DefaultPropView.this.table.getValueAt(row, 1), state);
- Metadata staticMet = state.getSelected().getModel().getStaticMetadata();
- if (staticMet == null) {
- staticMet = new Metadata();
- }
- staticMet.removeMetadata(key);
- staticMet.removeMetadata(key + "/envReplace");
- state.getSelected().getModel().setStaticMetadata(staticMet);
- DefaultPropView.this.notifyListeners();
- }
-
- });
- tableMenu.add(override);
- tableMenu.add(delete);
-
- if (state.getSelected() != null) {
- JPanel masterPanel = new JPanel();
- masterPanel.setLayout(new BoxLayout(masterPanel, BoxLayout.Y_AXIS));
- masterPanel.add(this.getModelIdPanel(state.getSelected(), state));
- masterPanel.add(this.getModelNamePanel(state.getSelected(), state));
- if (!state.getSelected().getModel().isParentType()) {
- masterPanel.add(this.getInstanceClassPanel(state.getSelected(), state));
- }
- masterPanel.add(this.getExecutionTypePanel(state.getSelected(), state));
- masterPanel.add(this.getPriorityPanel(state));
- masterPanel.add(this.getExecusedIds(state.getSelected()));
- if (state.getSelected().getModel().getExecutionType().equals("condition")) {
- masterPanel.add(this.getTimeout(state.getSelected(), state));
- masterPanel.add(this.getOptional(state.getSelected(), state));
- }
- JScrollPane scrollPane = new JScrollPane(table = this.createTable(state),
- JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
- JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
- scrollPane.getHorizontalScrollBar().setUnitIncrement(10);
- scrollPane.getVerticalScrollBar().setUnitIncrement(10);
- JPanel panel = new JPanel();
- panel.setLayout(new BorderLayout());
- panel.setBorder(new EtchedBorder());
- final JLabel metLabel = new JLabel("Static Metadata");
- metLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
- final JLabel extendsLabel = new JLabel("<extends>");
- extendsLabel.setFont(new Font("Serif", Font.PLAIN, 10));
- extendsLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
- extendsLabel.addMouseListener(new MouseListener() {
-
- private JScrollPane availableScroller;
- private JScrollPane mineScroller;
- private JList mineList;
- private JList availableList;
- private DefaultListModel mineModel;
- private DefaultListModel availableModel;
-
- public void mouseClicked(MouseEvent e) {
- final JPopupMenu popup = new JPopupMenu();
- popup.setLayout(new BorderLayout());
-
- JPanel main = new JPanel();
- main.setLayout(new BoxLayout(main, BoxLayout.X_AXIS));
-
- JPanel mine = new JPanel();
- mine.setBorder(new EtchedBorder());
- mine.setLayout(new BorderLayout());
- JLabel mineLabel = new JLabel("Mine");
- mineScroller = new JScrollPane(mineList = createJList(
- mineModel = new DefaultListModel(), state.getSelected()
- .getModel().getExtendsConfig()));
- mineScroller.setPreferredSize(new Dimension(250, 80));
- mine.add(mineLabel, BorderLayout.NORTH);
- mine.add(mineScroller, BorderLayout.CENTER);
-
- JPanel available = new JPanel();
- available.setBorder(new EtchedBorder());
- available.setLayout(new BorderLayout());
- JLabel availableLabel = new JLabel("Available");
- Vector<String> availableGroups = new Vector<String>(state
- .getGlobalConfigGroups().keySet());
- availableGroups.removeAll(state.getSelected().getModel()
- .getExtendsConfig());
- availableScroller = new JScrollPane(availableList = this.createJList(
- availableModel = new DefaultListModel(), availableGroups));
- availableScroller.setPreferredSize(new Dimension(250, 80));
- available.add(availableLabel, BorderLayout.NORTH);
- available.add(availableScroller, BorderLayout.CENTER);
-
- JPanel buttons = new JPanel();
- buttons.setLayout(new BoxLayout(buttons, BoxLayout.Y_AXIS));
- JButton addButton = new JButton("<---");
- addButton.addMouseListener(new MouseListener() {
-
- public void mouseClicked(MouseEvent e) {
- String selected = availableList.getSelectedValue().toString();
- Vector<String> extendsConfig = new Vector<String>(state
- .getSelected().getModel().getExtendsConfig());
- extendsConfig.add(selected);
- state.getSelected().getModel().setExtendsConfig(extendsConfig);
- availableModel.remove(availableList.getSelectedIndex());
- mineModel.addElement(selected);
- popup.revalidate();
- DefaultPropView.this.notifyListeners();
- }
-
- public void mouseEntered(MouseEvent e) {
- }
-
- public void mouseExited(MouseEvent e) {
- }
-
- public void mousePressed(MouseEvent e) {
- }
-
- public void mouseReleased(MouseEvent e) {
- }
-
- });
- JButton removeButton = new JButton("--->");
- removeButton.addMouseListener(new MouseListener() {
-
- public void mouseClicked(MouseEvent e) {
- String selected = mineList.getSelectedValue().toString();
- Vector<String> extendsConfig = new Vector<String>(state
- .getSelected().getModel().getExtendsConfig());
- extendsConfig.remove(selected);
- state.getSelected().getModel().setExtendsConfig(extendsConfig);
- mineModel.remove(mineList.getSelectedIndex());
- availableModel.addElement(selected);
- popup.revalidate();
- DefaultPropView.this.notifyListeners();
- }
-
- public void mouseEntered(MouseEvent e) {
- }
-
- public void mouseExited(MouseEvent e) {
- }
-
- public void mousePressed(MouseEvent e) {
- }
-
- public void mouseReleased(MouseEvent e) {
- }
-
- });
- buttons.add(addButton);
- buttons.add(removeButton);
-
- main.add(mine);
- main.add(buttons);
- main.add(available);
- popup.add(main, BorderLayout.CENTER);
- popup.show(extendsLabel, e.getX(), e.getY());
- }
-
- public void mouseEntered(MouseEvent e) {
- extendsLabel.setForeground(Color.blue);
- }
-
- public void mouseExited(MouseEvent e) {
- extendsLabel.setForeground(Color.black);
- }
-
- public void mousePressed(MouseEvent e) {
- }
-
- public void mouseReleased(MouseEvent e) {
- }
-
- private JList createJList(DefaultListModel model,
- final List<String> list) {
- for (String value : list) {
- model.addElement(value);
- }
- JList jList = new JList(model);
- jList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
- jList.setLayoutOrientation(JList.VERTICAL);
- return jList;
- }
- });
- JLabel metGroupLabel = new JLabel("(Sub-Group: "
- + (state.getCurrentMetGroup() != null ? state.getCurrentMetGroup()
- : "<base>") + ")");
- metGroupLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
- JPanel labelPanel = new JPanel();
- labelPanel.setLayout(new BoxLayout(labelPanel, BoxLayout.Y_AXIS));
- JPanel top = new JPanel();
- top.setLayout(new BoxLayout(top, BoxLayout.Y_AXIS));
- top.add(extendsLabel);
- top.add(metLabel);
- labelPanel.add(top);
- labelPanel.add(metGroupLabel);
- panel.add(labelPanel, BorderLayout.NORTH);
- panel.add(scrollPane, BorderLayout.CENTER);
- masterPanel.add(panel);
- this.add(masterPanel);
- } else {
- this.add(new JPanel());
- }
- this.revalidate();
- }
-
- private JPanel getTimeout(final ModelGraph graph, final ViewState state) {
- JPanel panel = new JPanel();
- panel.setLayout(new BorderLayout());
- panel.setBorder(new EtchedBorder());
- panel.add(new JLabel("Timeout:"), BorderLayout.NORTH);
- JTextField field = new JTextField(String.valueOf(graph.getModel()
- .getTimeout()), 50);
- field.addActionListener(new ActionListener() {
-
- public void actionPerformed(ActionEvent e) {
- if (!graph.getModel().getModelId().equals(e.getActionCommand())) {
- graph.getModel().setTimeout(Long.valueOf(
- e.getActionCommand() != null &&
- !e.getActionCommand().equals("") ?
- e.getActionCommand():"-1"));
- DefaultPropView.this.notifyListeners();
- DefaultPropView.this.refreshView(state);
- }
- }
-
- });
- panel.add(field, BorderLayout.CENTER);
- return panel;
- }
-
- private JPanel getModelIdPanel(final ModelGraph graph, final ViewState state) {
- JPanel panel = new JPanel();
- panel.setLayout(new BorderLayout());
- panel.setBorder(new EtchedBorder());
- panel.add(new JLabel("ModelId:"), BorderLayout.NORTH);
- JTextField field = new JTextField(graph.getModel().getModelId(), 50);
- field.addActionListener(new ActionListener() {
-
- public void actionPerformed(ActionEvent e) {
- if (!graph.getModel().getModelId().equals(e.getActionCommand())) {
- GuiUtils.updateGraphModelId(state, graph.getModel().getId(),
- e.getActionCommand());
- DefaultPropView.this.notifyListeners();
- DefaultPropView.this.refreshView(state);
- }
- }
-
- });
- panel.add(field, BorderLayout.CENTER);
- return panel;
- }
-
- private JPanel getModelNamePanel(final ModelGraph graph, final ViewState state) {
- JPanel panel = new JPanel();
- panel.setLayout(new BorderLayout());
- panel.setBorder(new EtchedBorder());
- panel.add(new JLabel("ModelName:"), BorderLayout.NORTH);
- JTextField field = new JTextField(graph.getModel().getModelName(), 50);
- field.addActionListener(new ActionListener() {
-
- public void actionPerformed(ActionEvent e) {
- if (!graph.getModel().getModelName().equals(e.getActionCommand())) {
- graph.getModel().setModelName(e.getActionCommand());
- DefaultPropView.this.notifyListeners();
- DefaultPropView.this.refreshView(state);
- }
- }
-
- });
- panel.add(field, BorderLayout.CENTER);
- return panel;
- }
-
- private JPanel getInstanceClassPanel(final ModelGraph graph,
- final ViewState state) {
- JPanel panel = new JPanel();
- panel.setLayout(new BorderLayout());
- panel.setBorder(new EtchedBorder());
- panel.add(new JLabel("InstanceClass:"), BorderLayout.NORTH);
- JTextField field = new JTextField(graph.getModel().getInstanceClass(), 50);
- field.addActionListener(new ActionListener() {
-
- public void actionPerformed(ActionEvent e) {
- if (graph.getModel().getInstanceClass() == null
- || !graph.getModel().getInstanceClass()
- .equals(e.getActionCommand())) {
- graph.getModel().setInstanceClass(e.getActionCommand());
- DefaultPropView.this.notifyListeners();
- DefaultPropView.this.refreshView(state);
- }
- }
-
- });
- panel.add(field, BorderLayout.CENTER);
- return panel;
- }
-
- private JPanel getPriorityPanel(final ViewState state) {
- JPanel panel = new JPanel();
- panel.setBorder(new EtchedBorder());
- panel.setLayout(new BorderLayout());
- panel.add(new JLabel("Priority: "), BorderLayout.WEST);
- final JLabel priorityLabel = new JLabel(String.valueOf(DEFAULT_PRIORITY));
- panel.add(priorityLabel, BorderLayout.CENTER);
- JSlider slider = new JSlider(0, 100, (int) 5 * 10);
- slider.setMajorTickSpacing(10);
- slider.setMinorTickSpacing(1);
- slider.setPaintLabels(true);
- slider.setPaintTicks(true);
- slider.setSnapToTicks(false);
- Format f = new DecimalFormat("0.0");
- Hashtable<Integer, JComponent> labels = new Hashtable<Integer, JComponent>();
- for (int i = 0; i <= 10; i += 2) {
- JLabel label = new JLabel(f.format(i));
- label.setFont(label.getFont().deriveFont(Font.PLAIN));
- labels.put(i * 10, label);
- }
- slider.setLabelTable(labels);
- slider.addChangeListener(new ChangeListener() {
-
- public void stateChanged(ChangeEvent e) {
- double value = ((JSlider) e.getSource()).getValue() / 10.0;
- priorityLabel.setText(value + "");
- priorityLabel.revalidate();
- if (!((JSlider) e.getSource()).getValueIsAdjusting()) {
- // FIXME: deal with priorities
- DefaultPropView.this.notifyListeners();
- }
- }
-
- });
-
- panel.add(slider, BorderLayout.SOUTH);
- return panel;
- }
-
- private JPanel getExecutionTypePanel(final ModelGraph graph,
- final ViewState state) {
- JPanel panel = new JPanel();
- panel.setBorder(new EtchedBorder());
- panel.setLayout(new BorderLayout());
- panel.add(new JLabel("ExecutionType:"), BorderLayout.WEST);
- JComboBox comboBox = new JComboBox();
- if (graph.hasChildren()) {
- comboBox.addItem("parallel");
- comboBox.addItem("sequential");
- } else if (graph.getModel().getExecutionType().equals("task")) {
- comboBox.addItem("parallel");
- comboBox.addItem("sequential");
- comboBox.addItem("task");
- } else if (graph.isCondition()
- || graph.getModel().getExecutionType().equals("condition")) {
- comboBox.addItem("parallel");
- comboBox.addItem("sequential");
- comboBox.addItem("condition");
- } else {
- comboBox.addItem("parallel");
- comboBox.addItem("sequential");
- comboBox.addItem("task");
- }
- comboBox.setSelectedItem(graph.getModel().getExecutionType());
- comboBox.addItemListener(new ItemListener() {
- public void itemStateChanged(ItemEvent e) {
- if (!graph.getModel().getExecutionType().equals(e.getItem())) {
- graph.getModel().setExecutionType((String) e.getItem());
- DefaultPropView.this.notifyListeners();
- DefaultPropView.this.refreshView(state);
- }
- }
- });
- panel.add(comboBox, BorderLayout.CENTER);
- return panel;
- }
-
- private JPanel getOptional(final ModelGraph graph, final ViewState state) {
- JPanel panel = new JPanel();
- panel.setLayout(new BorderLayout());
- panel.setBorder(new EtchedBorder());
- panel.add(new JLabel("Optional:"), BorderLayout.NORTH);
- JPanel checkBoxes = new JPanel();
- checkBoxes.setLayout(new GridLayout(1, 1));
- Checkbox checkbox = new Checkbox("ignore", graph.getModel().isOptional());
- checkBoxes.add(checkbox);
- checkbox.addItemListener(new ItemListener() {
-
- public void itemStateChanged(ItemEvent e) {
- if (e.getStateChange() == ItemEvent.DESELECTED) {
- graph.getModel().setOptional(false);
- } else if (e.getStateChange() == ItemEvent.SELECTED) {
- graph.getModel().setOptional(true);
- } else {
- return;
- }
- DefaultPropView.this.notifyListeners();
- DefaultPropView.this.refreshView(state);
- }
-
- });
- panel.add(checkBoxes, BorderLayout.CENTER);
- return panel;
- }
-
-
- private JPanel getExecusedIds(final ModelGraph graph) {
- JPanel panel = new JPanel();
- panel.setLayout(new BorderLayout());
- panel.setBorder(new EtchedBorder());
- panel.add(new JLabel("ExcusedSubProcessorIds:"), BorderLayout.NORTH);
- JPanel checkBoxes = new JPanel();
- checkBoxes.setLayout(new GridLayout(graph.getChildren().size(), 1));
- if (graph.hasChildren()) {
- for (ModelGraph childGraph : graph.getChildren()) {
- final String modelId = childGraph.getModel().getModelId();
- Checkbox checkbox = new Checkbox(modelId, graph.getModel()
- .getExcusedSubProcessorIds().contains(modelId));
- checkBoxes.add(checkbox);
- checkbox.addItemListener(new ItemListener() {
-
- public void itemStateChanged(ItemEvent e) {
- if (e.getStateChange() == ItemEvent.DESELECTED) {
- graph.getModel().getExcusedSubProcessorIds().remove(modelId);
- } else if (e.getStateChange() == ItemEvent.SELECTED) {
- graph.getModel().getExcusedSubProcessorIds().add(modelId);
- } else {
- return;
- }
- DefaultPropView.this.notifyListeners();
- }
-
- });
- }
- }
- panel.add(checkBoxes, BorderLayout.CENTER);
- return panel;
- }
-
- public class MyTableListener implements TableModelListener,
- ListSelectionListener {
-
- String oldKey, oldValue, oldEnvReplace;
-
- private ViewState state;
-
- public MyTableListener(ViewState state) {
- this.state = state;
- }
-
- public void tableChanged(TableModelEvent e) {
- System.out.println(oldKey + " " + oldValue + " " + oldEnvReplace);
- if (e.getType() == TableModelEvent.UPDATE) {
- Metadata staticMet = state.getSelected().getModel().getStaticMetadata();
- if (staticMet == null) {
- staticMet = new Metadata();
- }
- if (e.getColumn() == 1) {
- String newGrouplessKey = (String) table.getValueAt(e.getFirstRow(),
- e.getColumn());
- if (newGrouplessKey.equals("")
- || (newGrouplessKey.equals("envReplace") && !state.getSelected()
- .getModel().getStaticMetadata()
- .containsGroup(state.getCurrentMetGroup()))) {
- notifyListeners();
- return;
- }
- String newKey = getKey(newGrouplessKey, state);
- System.out.println("newKey: " + newKey);
- if (oldKey != null) {
- staticMet.replaceMetadata(newKey, staticMet.getAllMetadata(oldKey));
- if (staticMet.containsKey(oldKey + "/envReplace")) {
- staticMet.replaceMetadata(newKey,
- staticMet.getAllMetadata(oldKey + "/envReplace"));
- }
- if (!newKey.equals(oldKey)) {
- staticMet.removeMetadata(oldKey);
- }
- notifyListeners();
- } else {
- staticMet.replaceMetadata(oldKey = newKey, (String) null);
- }
- } else if (e.getColumn() == 2) {
- if (oldKey != null) {
- String newValue = (String) table.getValueAt(e.getFirstRow(),
- e.getColumn());
- if (oldKey.endsWith("/envReplace")) {
- newValue = newValue.toLowerCase();
- if (newValue.equals("false")) {
- staticMet.removeMetadata(oldKey);
- } else {
- staticMet.replaceMetadata(oldKey,
- Arrays.asList(newValue.split(",")));
- }
- } else {
- staticMet.replaceMetadata(oldKey,
- Arrays.asList(newValue.split(",")));
- }
- notifyListeners();
- }
- } else if (e.getColumn() == 3) {
- if (oldKey != null) {
- String newEnvReplace = ((String) table.getValueAt(e.getFirstRow(),
- e.getColumn())).toLowerCase();
- if (newEnvReplace.equals("true")) {
- staticMet.replaceMetadata(oldKey + "/envReplace", newEnvReplace);
- } else {
- staticMet.removeMetadata(oldKey + "/envReplace");
- }
- notifyListeners();
- }
- }
- state.getSelected().getModel().setStaticMetadata(staticMet);
- }
-
- }
-
- public void valueChanged(ListSelectionEvent e) {
- oldKey = getKey((String) table.getValueAt(e.getFirstIndex(), 1), state);
- oldValue = (String) table.getValueAt(e.getFirstIndex(), 2);
- oldEnvReplace = (String) table.getValueAt(e.getFirstIndex(), 3);
- }
-
- }
-
- private String getKey(String key, ViewState state) {
- if (key != null && state.getCurrentMetGroup() != null) {
- return state.getCurrentMetGroup() + "/" + key;
- } else {
- return key;
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/DefaultTreeView.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/DefaultTreeView.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/DefaultTreeView.java
deleted file mode 100644
index 35e5c20..0000000
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/DefaultTreeView.java
+++ /dev/null
@@ -1,496 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.workflow.gui.perspective.view.impl;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.oodt.cas.metadata.Metadata;
-import org.apache.oodt.cas.workflow.gui.model.ModelGraph;
-import org.apache.oodt.cas.workflow.gui.perspective.view.View;
-import org.apache.oodt.cas.workflow.gui.perspective.view.ViewChange;
-import org.apache.oodt.cas.workflow.gui.perspective.view.ViewState;
-import org.apache.oodt.cas.workflow.gui.util.GuiUtils;
-
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.MenuItem;
-import java.awt.PopupMenu;
-import java.awt.Rectangle;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.util.List;
-import java.util.Stack;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTree;
-import javax.swing.event.TreeSelectionEvent;
-import javax.swing.event.TreeSelectionListener;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.TreeCellRenderer;
-import javax.swing.tree.TreePath;
-
-
-/**
- *
- * The default Workflow GUI editor view shell.
- *
- * @author bfoster
- * @author mattmann
- *
- */
-public class DefaultTreeView extends View {
-
- private static final long serialVersionUID = -8295070597651190576L;
-
- private JTree tree;
- private PopupMenu actionsMenu, orderSubMenu;
- private JScrollPane scrollPane;
-
- private static final String EXPAND_STATIC_METADATA = "DefaultTreeView/expand/static-metadata";
- private static final String EXPAND_PRECONDITIONS = "DefaultTreeView/expand/pre-conditions";
- private static final String EXPAND_POSTCONDITIONS = "DefaultTreeView/expand/post-conditions";
-
- public DefaultTreeView(String name) {
- super(name);
- this.setLayout(new BorderLayout());
- }
-
- public TreePath getTreePath(DefaultMutableTreeNode node, ModelGraph graph) {
- if (node.getUserObject().equals(graph)) {
- return new TreePath(node.getPath());
- } else {
- for (int i = 0; i < node.getChildCount(); i++) {
- // System.out.println("i: " + ((DefaultMutableTreeNode)
- // node.getChildAt(i)).getUserObject());
- TreePath treePath = this.getTreePath(
- (DefaultMutableTreeNode) node.getChildAt(i), graph);
- if (treePath != null) {
- return treePath;
- }
- }
- return null;
- }
- }
-
- private TreePath getTreePath(TreePath currentPath, ViewState state) {
- String lookingForPath = state.getCurrentMetGroup();
- Stack<DefaultMutableTreeNode> stack = new Stack<DefaultMutableTreeNode>();
- DefaultMutableTreeNode baseNode = (DefaultMutableTreeNode) currentPath
- .getLastPathComponent();
- for (int i = 0; i < baseNode.getChildCount(); i++) {
- stack.push((DefaultMutableTreeNode) baseNode.getChildAt(i));
- }
- while (!stack.empty()) {
- DefaultMutableTreeNode node = stack.pop();
- if (node.getUserObject().equals("static-metadata")) {
- for (int i = 0; i < node.getChildCount(); i++) {
- stack.push((DefaultMutableTreeNode) node.getChildAt(i));
- }
- } else if (node.getUserObject() instanceof ConcurrentHashMap) {
- String key = (String) ((ConcurrentHashMap<String, String>) node.getUserObject())
- .keySet().iterator().next();
- if (lookingForPath.equals(key)) {
- return new TreePath(node.getPath());
- } else if (lookingForPath.startsWith(key + "/")) {
- lookingForPath = lookingForPath
- .substring(lookingForPath.indexOf("/") + 1);
- stack.clear();
- for (int i = 0; i < node.getChildCount(); i++) {
- stack.add((DefaultMutableTreeNode) node.getChildAt(i));
- }
- }
- }
- }
- return currentPath;
- }
-
- private void resetProperties(ViewState state) {
- state.setProperty(EXPAND_STATIC_METADATA, "false");
- state.setProperty(EXPAND_PRECONDITIONS, "false");
- state.setProperty(EXPAND_POSTCONDITIONS, "false");
- }
-
- @Override
- public void refreshView(final ViewState state) {
- Rectangle visibleRect = null;
- if (this.tree != null) {
- visibleRect = this.tree.getVisibleRect();
- }
-
- this.removeAll();
-
- this.actionsMenu = this.createPopupMenu(state);
-
- DefaultMutableTreeNode root = new DefaultMutableTreeNode("WORKFLOWS");
- for (ModelGraph graph : state.getGraphs()) {
- root.add(this.buildTree(graph, state));
- }
- tree = new JTree(root);
- tree.setShowsRootHandles(true);
- tree.setRootVisible(false);
- tree.add(this.actionsMenu);
-
- if (state.getSelected() != null) {
- TreePath treePath = this.getTreePath(root, state.getSelected());
- if (state.getCurrentMetGroup() != null) {
- treePath = this.getTreePath(treePath, state);
- } else if (Boolean.parseBoolean(state
- .getFirstPropertyValue(EXPAND_STATIC_METADATA))) {
- DefaultMutableTreeNode baseNode = (DefaultMutableTreeNode) treePath
- .getLastPathComponent();
- for (int i = 0; i < baseNode.getChildCount(); i++) {
- if (((DefaultMutableTreeNode) baseNode.getChildAt(i)).getUserObject()
- .equals("static-metadata")) {
- treePath = new TreePath(
- ((DefaultMutableTreeNode) baseNode.getChildAt(i)).getPath());
- break;
- }
- }
- } else if (Boolean.parseBoolean(state
- .getFirstPropertyValue(EXPAND_PRECONDITIONS))) {
- if (treePath == null) {
- treePath = this.getTreePath(root, state.getSelected()
- .getPreConditions());
- }
- DefaultMutableTreeNode baseNode = (DefaultMutableTreeNode) treePath
- .getLastPathComponent();
- for (int i = 0; i < baseNode.getChildCount(); i++) {
- if (((DefaultMutableTreeNode) baseNode.getChildAt(i)).getUserObject()
- .equals("pre-conditions")) {
- treePath = new TreePath(
- ((DefaultMutableTreeNode) baseNode.getChildAt(i)).getPath());
- break;
- }
- }
- } else if (Boolean.parseBoolean(state
- .getFirstPropertyValue(EXPAND_POSTCONDITIONS))) {
- if (treePath == null) {
- treePath = this.getTreePath(root, state.getSelected()
- .getPostConditions());
- }
- DefaultMutableTreeNode baseNode = (DefaultMutableTreeNode) treePath
- .getLastPathComponent();
- for (int i = 0; i < baseNode.getChildCount(); i++) {
- if (((DefaultMutableTreeNode) baseNode.getChildAt(i)).getUserObject()
- .equals("post-conditions")) {
- treePath = new TreePath(
- ((DefaultMutableTreeNode) baseNode.getChildAt(i)).getPath());
- break;
- }
- }
- }
- this.tree.expandPath(treePath);
- this.tree.setSelectionPath(treePath);
- }
-
- tree.addTreeSelectionListener(new TreeSelectionListener() {
-
- public void valueChanged(TreeSelectionEvent e) {
- if (e.getPath().getLastPathComponent() instanceof DefaultMutableTreeNode) {
- DefaultTreeView.this.resetProperties(state);
- DefaultMutableTreeNode node = (DefaultMutableTreeNode) e.getPath()
- .getLastPathComponent();
- if (node.getUserObject() instanceof ModelGraph) {
- state.setSelected((ModelGraph) node.getUserObject());
- state.setCurrentMetGroup(null);
- DefaultTreeView.this.notifyListeners();
- } else if (node.getUserObject().equals("static-metadata")
- || node.getUserObject().equals("pre-conditions")
- || node.getUserObject().equals("post-conditions")) {
- state.setSelected((ModelGraph) ((DefaultMutableTreeNode) node
- .getParent()).getUserObject());
- state.setCurrentMetGroup(null);
- state.setProperty(EXPAND_STATIC_METADATA, Boolean.toString(node
- .getUserObject().equals("static-metadata")));
- state.setProperty(EXPAND_PRECONDITIONS,
- Boolean.toString(node.getUserObject().equals("pre-conditions")));
- state.setProperty(EXPAND_POSTCONDITIONS, Boolean.toString(node
- .getUserObject().equals("post-conditions")));
- DefaultTreeView.this.notifyListeners();
- } else if (node.getUserObject() instanceof ConcurrentHashMap) {
- DefaultMutableTreeNode metNode = null;
- String group = null;
- Object[] path = e.getPath().getPath();
- for (int i = path.length - 1; i >= 0; i--) {
- if (((DefaultMutableTreeNode) path[i]).getUserObject() instanceof ModelGraph) {
- metNode = (DefaultMutableTreeNode) path[i];
- break;
- } else if (((DefaultMutableTreeNode) path[i]).getUserObject() instanceof ConcurrentHashMap) {
- if (group == null) {
- group = (String) ((ConcurrentHashMap<String, String>) ((DefaultMutableTreeNode) path[i])
- .getUserObject()).keySet().iterator().next();
- } else {
- group = (String) ((ConcurrentHashMap<String, String>) ((DefaultMutableTreeNode) path[i])
- .getUserObject()).keySet().iterator().next()
- + "/"
- + group;
- }
- }
- }
- ModelGraph graph = (ModelGraph) metNode.getUserObject();
- state.setSelected(graph);
- state.setCurrentMetGroup(group);
- DefaultTreeView.this.notifyListeners();
- } else {
- state.setSelected(null);
- DefaultTreeView.this.notifyListeners();
- }
- }
- }
-
- });
- tree.setCellRenderer(new TreeCellRenderer() {
-
- public Component getTreeCellRendererComponent(JTree tree, Object value,
- boolean selected, boolean expanded, boolean leaf, int row,
- boolean hasFocus) {
- DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
- if (node.getUserObject() instanceof String) {
- JPanel panel = new JPanel();
- panel.setLayout(new BorderLayout());
- JLabel label = new JLabel((String) node.getUserObject());
- label.setForeground(Color.blue);
- panel.add(label, BorderLayout.CENTER);
- panel.setBackground(selected ? Color.lightGray : Color.white);
- return panel;
- } else if (node.getUserObject() instanceof ModelGraph) {
- JPanel panel = new JPanel();
- panel.setLayout(new BorderLayout());
- JLabel iconLabel = new JLabel(((ModelGraph) node.getUserObject())
- .getModel().getExecutionType() + ": ");
- iconLabel.setForeground(((ModelGraph) node.getUserObject())
- .getModel().getColor());
- iconLabel.setBackground(Color.white);
- JLabel idLabel = new JLabel(((ModelGraph) node.getUserObject())
- .getModel().getModelName());
- idLabel.setBackground(Color.white);
- panel.add(iconLabel, BorderLayout.WEST);
- panel.add(idLabel, BorderLayout.CENTER);
- panel.setBackground(selected ? Color.lightGray : Color.white);
- return panel;
- } else if (node.getUserObject() instanceof ConcurrentHashMap) {
- JPanel panel = new JPanel();
- panel.setLayout(new BorderLayout());
- String group = (String) ((ConcurrentHashMap<String, String>) node
- .getUserObject()).keySet().iterator().next();
- JLabel nameLabel = new JLabel(group + " : ");
- nameLabel.setForeground(Color.blue);
- nameLabel.setBackground(Color.white);
- JLabel valueLabel = new JLabel(((ConcurrentHashMap<String, String>) node
- .getUserObject()).get(group));
- valueLabel.setForeground(Color.darkGray);
- valueLabel.setBackground(Color.white);
- panel.add(nameLabel, BorderLayout.WEST);
- panel.add(valueLabel, BorderLayout.EAST);
- panel.setBackground(selected ? Color.lightGray : Color.white);
- return panel;
- } else {
- return new JLabel();
- }
- }
-
- });
- tree.addMouseListener(new MouseListener() {
- public void mouseClicked(MouseEvent e) {
- if (e.getButton() == MouseEvent.BUTTON3
- && DefaultTreeView.this.tree.getSelectionPath() != null) {
- DefaultMutableTreeNode node = (DefaultMutableTreeNode) DefaultTreeView.this.tree
- .getSelectionPath().getLastPathComponent();
- if (node.getUserObject() instanceof String
- && !(node.getUserObject().equals("pre-conditions") || node
- .getUserObject().equals("post-conditions"))) {
- return;
- }
- orderSubMenu.setEnabled(node.getUserObject() instanceof ModelGraph
- && !((ModelGraph) node.getUserObject()).isCondition()
- && ((ModelGraph) node.getUserObject()).getParent() != null);
- DefaultTreeView.this.actionsMenu.show(DefaultTreeView.this.tree,
- e.getX(), e.getY());
- }
- }
-
- public void mouseEntered(MouseEvent e) {
- }
-
- public void mouseExited(MouseEvent e) {
- }
-
- public void mousePressed(MouseEvent e) {
- }
-
- public void mouseReleased(MouseEvent e) {
- }
- });
- this.scrollPane = new JScrollPane(tree,
- JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
- JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
- this.add(this.scrollPane, BorderLayout.CENTER);
- if (visibleRect != null) {
- this.tree.scrollRectToVisible(visibleRect);
- }
-
- this.revalidate();
- }
-
- private DefaultMutableTreeNode buildTree(ModelGraph graph, ViewState state) {
- DefaultMutableTreeNode node = new DefaultMutableTreeNode(graph);
- DefaultMutableTreeNode metadataNode = new DefaultMutableTreeNode(
- "static-metadata");
- Metadata staticMetadata = new Metadata();
- if (graph.getInheritedStaticMetadata(state) != null) {
- staticMetadata.replaceMetadata(graph.getInheritedStaticMetadata(state));
- }
- if (graph.getModel().getStaticMetadata() != null) {
- staticMetadata.replaceMetadata(graph.getModel().getStaticMetadata());
- }
- this.addMetadataNodes(metadataNode, staticMetadata);
- if (!metadataNode.isLeaf()) {
- node.add(metadataNode);
- }
-
- if (graph.getPreConditions() != null) {
- DefaultMutableTreeNode preConditions = new DefaultMutableTreeNode(
- "pre-conditions");
- List<ModelGraph> leafNodes = graph.getPreConditions().getLeafNodes();
- for (ModelGraph cond : leafNodes) {
- DefaultMutableTreeNode condNode = new DefaultMutableTreeNode(cond);
- preConditions.add(condNode);
- }
- node.add(preConditions);
- }
- if (graph.getPostConditions() != null) {
- DefaultMutableTreeNode postConditions = new DefaultMutableTreeNode(
- "post-conditions");
- List<ModelGraph> leafNodes = graph.getPostConditions().getLeafNodes();
- for (ModelGraph cond : leafNodes) {
- DefaultMutableTreeNode condNode = new DefaultMutableTreeNode(cond);
- postConditions.add(condNode);
- }
- node.add(postConditions);
- }
- for (ModelGraph child : graph.getChildren()) {
- if (!GuiUtils.isDummyNode(child.getModel())) {
- node.add(this.buildTree(child, state));
- }
- }
- return node;
- }
-
- private void addMetadataNodes(DefaultMutableTreeNode metadataNode,
- Metadata staticMetadata) {
- for (String group : staticMetadata.getGroups()) {
- Object userObj;
- if (staticMetadata.getMetadata(group) != null) {
- ConcurrentHashMap<String, String> map = new ConcurrentHashMap<String, String>();
- map.put(group,
- StringUtils.join(staticMetadata.getAllMetadata(group), ","));
- userObj = map;
- } else {
- ConcurrentHashMap<String, String> map = new ConcurrentHashMap<String, String>();
- map.put(group, null);
- userObj = map;
- }
- DefaultMutableTreeNode groupNode = new DefaultMutableTreeNode(userObj);
- metadataNode.add(groupNode);
- this.addMetadataNodes(groupNode, staticMetadata.getSubMetadata(group));
- }
- }
-
- private PopupMenu createPopupMenu(final ViewState state) {
- final String ACTIONS_POP_MENU_NAME = "Actions";
- final String VIEW_CONDITION_MAP = "View...";
- PopupMenu actionsMenu = new PopupMenu(ACTIONS_POP_MENU_NAME);
- actionsMenu.add(new MenuItem(VIEW_CONDITION_MAP));
- actionsMenu.addActionListener(new ActionListener() {
-
- public void actionPerformed(ActionEvent e) {
- if (e.getActionCommand().equals(VIEW_CONDITION_MAP)) {
- DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree
- .getSelectionPath().getLastPathComponent();
- ModelGraph graphToFocus = null;
- if (Boolean.parseBoolean(state
- .getFirstPropertyValue(EXPAND_PRECONDITIONS))
- || Boolean.parseBoolean(state
- .getFirstPropertyValue(EXPAND_POSTCONDITIONS))) {
- ModelGraph graph = state.getSelected();
- if (Boolean.parseBoolean(state
- .getFirstPropertyValue(EXPAND_PRECONDITIONS))) {
- graphToFocus = graph.getPreConditions();
- } else {
- graphToFocus = graph.getPostConditions();
- }
- } else if (node.getUserObject() instanceof ModelGraph) {
- graphToFocus = (ModelGraph) node.getUserObject();
- }
- DefaultTreeView.this.notifyListeners(new ViewChange.NEW_VIEW(
- graphToFocus, DefaultTreeView.this));
- }
- }
-
- });
-
- final String ORDER_SUB_POP_MENU_NAME = "Order";
- final String TO_FRONT_ITEM_NAME = "Move To Front";
- final String TO_BACK_ITEM_NAME = "Move To Back";
- final String FORWARD_ITEM_NAME = "Move Forward";
- final String BACKWARDS_ITEM_NAME = "Move Backwards";
- actionsMenu.add(orderSubMenu = new PopupMenu(ORDER_SUB_POP_MENU_NAME));
- orderSubMenu.add(new MenuItem(TO_FRONT_ITEM_NAME));
- orderSubMenu.add(new MenuItem(TO_BACK_ITEM_NAME));
- orderSubMenu.add(new MenuItem(FORWARD_ITEM_NAME));
- orderSubMenu.add(new MenuItem(BACKWARDS_ITEM_NAME));
- orderSubMenu.addActionListener(new ActionListener() {
-
- public void actionPerformed(ActionEvent e) {
- ModelGraph graph = state.getSelected();
- ModelGraph parent = graph.getParent();
- if (e.getActionCommand().equals(TO_FRONT_ITEM_NAME)) {
- if (parent.getChildren().remove(graph)) {
- parent.getChildren().add(0, graph);
- }
- } else if (e.getActionCommand().equals(TO_BACK_ITEM_NAME)) {
- if (parent.getChildren().remove(graph)) {
- parent.getChildren().add(graph);
- }
- } else if (e.getActionCommand().equals(FORWARD_ITEM_NAME)) {
- int index = parent.getChildren().indexOf(graph);
- if (index != -1) {
- parent.getChildren().remove(index);
- parent.getChildren().add(Math.max(0, index + 1), graph);
- }
- } else if (e.getActionCommand().equals(BACKWARDS_ITEM_NAME)) {
- int index = parent.getChildren().indexOf(graph);
- if (index != -1) {
- parent.getChildren().remove(index);
- parent.getChildren().add(Math.max(0, index - 1), graph);
- }
- }
- DefaultTreeView.this.notifyListeners();
- DefaultTreeView.this.refreshView(state);
- }
-
- });
- return actionsMenu;
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/GlobalConfigView.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/GlobalConfigView.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/GlobalConfigView.java
deleted file mode 100644
index a73c698..0000000
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/GlobalConfigView.java
+++ /dev/null
@@ -1,270 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.workflow.gui.perspective.view.impl;
-
-//JDK imports
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Rectangle;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Vector;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTabbedPane;
-import javax.swing.JTree;
-import javax.swing.border.EtchedBorder;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.TreeCellRenderer;
-
-//Apache imports
-import org.apache.commons.lang.StringUtils;
-
-//OODT imports
-import org.apache.oodt.cas.workflow.gui.model.repo.XmlWorkflowModelRepository.ConfigGroup;
-import org.apache.oodt.cas.workflow.gui.perspective.view.View;
-import org.apache.oodt.cas.workflow.gui.perspective.view.ViewState;
-
-/**
- *
- * Displays information about global config properties loaded from the
- * Workflows.
- *
- * @author bfoster
- * @author mattmann
- *
- */
-public class GlobalConfigView extends View {
-
- private static final long serialVersionUID = 3899104909278232407L;
- private JTree tree;
- private JTabbedPane tabbedPane;
- private Map<String, ConfigGroup> globalConfig;
-
- public GlobalConfigView(String name) {
- super(name);
- this.setLayout(new BorderLayout());
- }
-
- @Override
- public void refreshView(ViewState state) {
-
- Rectangle visibleRect = null;
- if (this.tree != null) {
- visibleRect = this.tree.getVisibleRect();
- }
-
- DefaultMutableTreeNode root = new DefaultMutableTreeNode("GlobalConfig");
-
- if (state != null && state.getGlobalConfigGroups() != null) {
- if (globalConfig != null
- && globalConfig.keySet().equals(
- state.getGlobalConfigGroups().keySet())
- && globalConfig.values().equals(
- state.getGlobalConfigGroups().values())) {
- return;
- }
-
- this.removeAll();
-
- for (ConfigGroup group : (globalConfig = state.getGlobalConfigGroups())
- .values()) {
- HashSet<String> keys = new HashSet<String>();
- DefaultMutableTreeNode groupNode = new DefaultMutableTreeNode(
- new Group(group.getName()));
- root.add(groupNode);
- for (String key : group.getMetadata().getAllKeys()) {
- keys.add(key);
- DefaultMutableTreeNode keyNode = new DefaultMutableTreeNode(new Key(
- key));
- groupNode.add(keyNode);
- DefaultMutableTreeNode valueNode = new DefaultMutableTreeNode(
- new Value(StringUtils.join(group.getMetadata()
- .getAllMetadata(key), ",")));
- keyNode.add(valueNode);
- }
- if (group.getExtends() != null) {
- List<String> extendsGroups = new Vector<String>(group.getExtends());
- Collections.reverse(extendsGroups);
- for (String extendsGroup : extendsGroups) {
- List<String> groupKeys = state.getGlobalConfigGroups()
- .get(extendsGroup).getMetadata().getAllKeys();
- groupKeys.removeAll(keys);
- if (groupKeys.size() > 0) {
- for (String key : groupKeys) {
- if (!keys.contains(key)) {
- keys.add(key);
- DefaultMutableTreeNode keyNode = new DefaultMutableTreeNode(
- new ExtendsKey(extendsGroup, key));
- groupNode.add(keyNode);
- DefaultMutableTreeNode valueNode = new DefaultMutableTreeNode(
- new ExtendsValue(StringUtils.join(state
- .getGlobalConfigGroups().get(extendsGroup)
- .getMetadata().getAllMetadata(key), ",")));
- keyNode.add(valueNode);
- }
- }
- }
- }
- }
- }
-
- tree = new JTree(root);
- tree.setShowsRootHandles(true);
- tree.setRootVisible(false);
-
- tree.setCellRenderer(new TreeCellRenderer() {
-
- public Component getTreeCellRendererComponent(JTree tree, Object value,
- boolean selected, boolean expanded, boolean leaf, int row,
- boolean hasFocus) {
- DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
- if (node.getUserObject() instanceof Key) {
- JPanel panel = new JPanel();
- panel.setLayout(new BorderLayout());
- JLabel label = new JLabel(node.getUserObject().toString());
- label.setForeground(Color.darkGray);
- panel.add(label, BorderLayout.CENTER);
- panel.setBackground(selected ? Color.lightGray : Color.white);
- return panel;
- } else if (node.getUserObject() instanceof ExtendsKey) {
- JPanel panel = new JPanel();
- panel.setLayout(new BorderLayout());
- ExtendsKey key = (ExtendsKey) node.getUserObject();
- JLabel groupLabel = new JLabel("(" + key.getGroup() + ") ");
- groupLabel.setForeground(Color.black);
- JLabel keyLabel = new JLabel(key.getValue());
- keyLabel.setForeground(Color.gray);
- panel.add(groupLabel, BorderLayout.WEST);
- panel.add(keyLabel, BorderLayout.CENTER);
- panel.setBackground(selected ? Color.lightGray : Color.white);
- return panel;
- } else if (node.getUserObject() instanceof Group) {
- JPanel panel = new JPanel();
- panel.setLayout(new BorderLayout());
- JLabel label = new JLabel(node.getUserObject().toString());
- label.setForeground(Color.black);
- label.setBackground(Color.white);
- panel.add(label, BorderLayout.CENTER);
- panel.setBackground(selected ? Color.lightGray : Color.white);
- return panel;
- } else if (node.getUserObject() instanceof Value) {
- JPanel panel = new JPanel();
- panel.setLayout(new BorderLayout());
- panel.setBorder(new EtchedBorder(1));
- JLabel label = new JLabel(node.getUserObject().toString());
- label.setForeground(Color.black);
- panel.add(label, BorderLayout.CENTER);
- panel.setBackground(selected ? Color.lightGray : Color.white);
- return panel;
- } else if (node.getUserObject() instanceof ExtendsValue) {
- JPanel panel = new JPanel();
- panel.setLayout(new BorderLayout());
- panel.setBorder(new EtchedBorder(1));
- JLabel label = new JLabel(node.getUserObject().toString());
- label.setForeground(Color.gray);
- panel.add(label, BorderLayout.CENTER);
- panel.setBackground(selected ? Color.lightGray : Color.white);
- return panel;
- } else {
- return new JLabel();
- }
- }
-
- });
- }
-
- this.setBorder(new EtchedBorder());
- JLabel panelName = new JLabel("Global-Config Groups");
- panelName.setBorder(new EtchedBorder());
- this.add(panelName, BorderLayout.NORTH);
- JScrollPane scrollPane = new JScrollPane(tree,
- JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
- JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
-
- tabbedPane = new JTabbedPane();
- tabbedPane.addTab("Tree", scrollPane);
- tabbedPane.addTab("Table", new JPanel());
-
- this.add(tabbedPane, BorderLayout.CENTER);
-
- if (visibleRect != null) {
- this.tree.scrollRectToVisible(visibleRect);
- }
-
- this.revalidate();
- }
-
- public class StringNode {
- private String value;
-
- public StringNode(String value) {
- this.value = value;
- }
-
- public String getValue() {
- return this.value;
- }
-
- public String toString() {
- return this.value;
- }
- }
-
- public class Key extends StringNode {
- public Key(String value) {
- super(value);
- }
- }
-
- public class ExtendsKey extends StringNode {
- private String group;
-
- public ExtendsKey(String group, String value) {
- super(value);
- this.group = group;
- }
-
- public String getGroup() {
- return this.group;
- }
- }
-
- public class ExtendsValue extends StringNode {
- public ExtendsValue(String value) {
- super(value);
- }
- }
-
- public class Value extends StringNode {
- public Value(String value) {
- super(value);
- }
- }
-
- public class Group extends StringNode {
- public Group(String group) {
- super(group);
- }
- }
-
-}
[36/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/static/js/editor/gollum.editor.js
----------------------------------------------------------------------
diff --git a/balance/modules/puny/static/js/editor/gollum.editor.js b/balance/modules/puny/static/js/editor/gollum.editor.js
deleted file mode 100644
index de09357..0000000
--- a/balance/modules/puny/static/js/editor/gollum.editor.js
+++ /dev/null
@@ -1,1090 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * gollum.editor.js
- * A jQuery plugin that creates the Gollum Editor.
- *
- * Usage:
- * $.GollumEditor(); on DOM ready.
- */
-(function($) {
-
- // Editor options
- var DefaultOptions = {
- MarkupType: 'markdown',
- EditorMode: 'code',
- NewFile: false,
- HasFunctionBar: true,
- Debug: false,
- NoDefinitionsFor: []
- };
- var ActiveOptions = {};
-
- /**
- * $.GollumEditor
- *
- * You don't need to do anything. Just run this on DOM ready.
- */
- $.GollumEditor = function( IncomingOptions ) {
-
- ActiveOptions = $.extend( DefaultOptions );
-
- debug('GollumEditor loading');
-
- if ( EditorHas.baseEditorMarkup() ) {
-
- if ( EditorHas.titleDisplayed() ) {
- $('#gollum-editor-title-field').addClass('active');
- }
-
- if ( EditorHas.editSummaryMarkup() ) {
- $.GollumEditor.Placeholder.add($('#gollum-editor-edit-summary input'));
- $('#gollum-editor form[name="gollum-editor"]').submit(function( e ) {
- e.preventDefault();
- $.GollumEditor.Placeholder.clearAll();
- debug('submitting');
- $(this).unbind('submit');
- $(this).submit();
- });
- }
-
- if ( EditorHas.collapsibleInputs() ) {
- $('#gollum-editor .collapsed a.button, ' +
- '#gollum-editor .expanded a.button').click(function( e ) {
- e.preventDefault();
- $(this).parent().toggleClass('expanded');
- $(this).parent().toggleClass('collapsed');
- });
- }
-
- if ( EditorHas.previewButton() ) {
- var formAction =
- $('#gollum-editor #gollum-editor-preview').click(function() {
- // make a dummy form, submit to new target window
- // get form fields
- var oldAction = $('#gollum-editor form').attr('action');
- var $form = $($('#gollum-editor form').get(0));
- $form.attr('action', this.href || '/preview');
- $form.attr('target', '_blank');
- $form.submit();
-
-
- $form.attr('action', oldAction);
- $form.removeAttr('target');
- return false;
- });
- }
-
- // Initialize the function bar by loading proper definitions
- if ( EditorHas.functionBar() ) {
-
- var htmlSetMarkupLang =
- $('#gollum-editor-body').attr('data-markup-lang');
-
- if ( htmlSetMarkupLang ) {
- ActiveOptions.MarkupType = htmlSetMarkupLang;
- }
-
- // load language definition
- LanguageDefinition.setActiveLanguage( ActiveOptions.MarkupType );
- if ( EditorHas.formatSelector() ) {
- FormatSelector.init(
- $('#gollum-editor-format-selector select') );
- }
-
- if ( EditorHas.help() ) {
- $('#gollum-editor-help').hide();
- $('#gollum-editor-help').removeClass('jaws');
- }
-
- }
- // EditorHas.functionBar
- }
- // EditorHas.baseEditorMarkup
- };
-
-
-
- /**
- * $.GollumEditor.defineLanguage
- * Defines a set of language actions that Gollum can use.
- * Used by the definitions in langs/ to register language definitions.
- */
- $.GollumEditor.defineLanguage = function( language_name, languageObject ) {
- if ( typeof languageObject == 'object' ) {
- LanguageDefinition.define( language_name, languageObject );
- } else {
- debug('GollumEditor.defineLanguage: definition for ' + language_name +
- ' is not an object');
- }
- };
-
-
- /**
- * debug
- * Prints debug information to console.log if debug output is enabled.
- *
- * @param mixed Whatever you want to dump to console.log
- * @return void
- */
- var debug = function(m) {
- if ( ActiveOptions.Debug &&
- typeof console != 'undefined' ) {
- console.log( m );
- }
- };
-
-
-
- /**
- * LanguageDefinition
- * Language definition file handler
- * Loads language definition files as necessary.
- */
- var LanguageDefinition = {
-
- _ACTIVE_LANG: '',
- _LOADED_LANGS: [],
- _LANG: {},
-
- /**
- * Defines a language
- *
- * @param name string The name of the language
- * @param name object The definition object
- */
- define: function( name, definitionObject ) {
- LanguageDefinition._ACTIVE_LANG = name;
- LanguageDefinition._LOADED_LANGS.push( name );
- if ( typeof $.GollumEditor.WikiLanguage == 'object' ) {
- var definition = {};
- $.extend(definition, $.GollumEditor.WikiLanguage, definitionObject);
- LanguageDefinition._LANG[name] = definition;
- } else {
- LanguageDefinition._LANG[name] = definitionObject;
- }
- },
-
- getActiveLanguage: function() {
- return LanguageDefinition._ACTIVE_LANG;
- },
-
- setActiveLanguage: function( name ) {
- if ( !LanguageDefinition.isLoadedFor(name) ) {
- LanguageDefinition._ACTIVE_LANG = null;
- LanguageDefinition.loadFor( name, function(x, t) {
- if ( t != 'success' ) {
- debug('Failed to load language definition for ' + name);
- // well, fake it and turn everything off for this one
- LanguageDefinition.define( name, {} );
- }
-
- // update features that rely on the language definition
- if ( EditorHas.functionBar() ) {
- FunctionBar.refresh();
- }
-
- if ( LanguageDefinition.isValid() && EditorHas.formatSelector() ) {
- FormatSelector.updateSelected();
- }
-
- } );
- } else {
- LanguageDefinition._ACTIVE_LANG = name;
- FunctionBar.refresh();
- }
- },
-
-
- /**
- * gets a definition object for a specified attribute
- *
- * @param string attr The specified attribute.
- * @param string specified_lang The language to pull a definition for.
- * @return object if exists, null otherwise
- */
- getDefinitionFor: function( attr, specified_lang ) {
- if ( !specified_lang ) {
- specified_lang = LanguageDefinition._ACTIVE_LANG;
- }
-
- if ( LanguageDefinition.isLoadedFor(specified_lang) &&
- LanguageDefinition._LANG[specified_lang][attr] &&
- typeof LanguageDefinition._LANG[specified_lang][attr] == 'object' ) {
- return LanguageDefinition._LANG[specified_lang][attr];
- }
-
- return null;
- },
-
-
- /**
- * loadFor
- * Asynchronously loads a definition file for the current markup.
- * Definition files are necessary to use the code editor.
- *
- * @param string markup_name The markup name you want to load
- * @return void
- */
- loadFor: function( markup_name, on_complete ) {
- // Keep us from hitting 404s on our site, check the definition blacklist
- if ( ActiveOptions.NoDefinitionsFor.length ) {
- for ( var i=0; i < ActiveOptions.NoDefinitionsFor.length; i++ ) {
- if ( markup_name == ActiveOptions.NoDefinitionsFor[i] ) {
- // we don't have this. get out.
- if ( typeof on_complete == 'function' ) {
- on_complete( null, 'error' );
- return;
- }
- }
- }
- }
-
- // attempt to load the definition for this language
- var script_uri = puny_module_static + '/js/editor/langs/' + markup_name + '.js';
- $.ajax({
- url: script_uri,
- dataType: 'script',
- complete: function( xhr, textStatus ) {
- if ( typeof on_complete == 'function' ) {
- on_complete( xhr, textStatus );
- }
- }
- });
- },
-
-
- /**
- * isLoadedFor
- * Checks to see if a definition file has been loaded for the
- * specified markup language.
- *
- * @param string markup_name The name of the markup.
- * @return boolean
- */
- isLoadedFor: function( markup_name ) {
- if ( LanguageDefinition._LOADED_LANGS.length === 0 ) {
- return false;
- }
-
- for ( var i=0; i < LanguageDefinition._LOADED_LANGS.length; i++ ) {
- if ( LanguageDefinition._LOADED_LANGS[i] == markup_name ) {
- return true;
- }
- }
- return false;
- },
-
- isValid: function() {
- return ( LanguageDefinition._ACTIVE_LANG &&
- typeof LanguageDefinition._LANG[LanguageDefinition._ACTIVE_LANG] ==
- 'object' );
- }
-
- };
-
-
- /**
- * EditorHas
- * Various conditionals to check what features of the Gollum Editor are
- * active/operational.
- */
- var EditorHas = {
-
-
- /**
- * EditorHas.baseEditorMarkup
- * True if the basic editor form is in place.
- *
- * @return boolean
- */
- baseEditorMarkup: function() {
- return ( $('#gollum-editor').length &&
- $('#gollum-editor-body').length );
- },
-
-
- /**
- * EditorHas.collapsibleInputs
- * True if the editor contains collapsible inputs for things like the
- * sidebar or footer, false otherwise.
- *
- * @return boolean
- */
- collapsibleInputs: function() {
- return $('#gollum-editor .collapsed, #gollum-editor .expanded').length;
- },
-
-
- /**
- * EditorHas.formatSelector
- * True if the editor has a format selector (for switching between
- * language types), false otherwise.
- *
- * @return boolean
- */
- formatSelector: function() {
- return $('#gollum-editor-format-selector select').length;
- },
-
-
- /**
- * EditorHas.functionBar
- * True if the Function Bar markup exists.
- *
- * @return boolean
- */
- functionBar: function() {
- return ( ActiveOptions.HasFunctionBar &&
- $('#gollum-editor-function-bar').length );
- },
-
-
- /**
- * EditorHas.ff4Environment
- * True if in a Firefox 4.0 Beta environment.
- *
- * @return boolean
- */
- ff4Environment: function() {
- var ua = new RegExp(/Firefox\/4.0b/);
- return ( ua.test( navigator.userAgent ) );
- },
-
-
- /**
- * EditorHas.editSummaryMarkup
- * True if the editor has a summary field (Gollum's commit message),
- * false otherwise.
- *
- * @return boolean
- */
- editSummaryMarkup: function() {
- return ( $('input#gollum-editor-message-field').length > 0 );
- },
-
-
- /**
- * EditorHas.help
- * True if the editor contains the inline help sector, false otherwise.
- *
- * @return boolean
- */
- help: function() {
- return ( $('#gollum-editor #gollum-editor-help').length &&
- $('#gollum-editor #function-help').length );
- },
-
-
- /**
- * EditorHas.previewButton
- * True if the editor has a preview button, false otherwise.
- *
- * @return boolean
- */
- previewButton: function() {
- return ( $('#gollum-editor #gollum-editor-preview').length );
- },
-
-
- /**
- * EditorHas.titleDisplayed
- * True if the editor is displaying a title field, false otherwise.
- *
- * @return boolean
- */
- titleDisplayed: function() {
- return ( ActiveOptions.NewFile );
- }
-
- };
-
-
- /**
- * FunctionBar
- *
- * Things the function bar does.
- */
- var FunctionBar = {
-
- isActive: false,
-
-
- /**
- * FunctionBar.activate
- * Activates the function bar, attaching all click events
- * and displaying the bar.
- *
- */
- activate: function() {
- debug('Activating function bar');
-
- // check these out
- $('#gollum-editor-function-bar a.function-button').each(function() {
- if ( LanguageDefinition.getDefinitionFor( $(this).attr('id') ) ) {
- $(this).click( FunctionBar.evtFunctionButtonClick );
- $(this).removeClass('disabled');
- }
- else if ( $(this).attr('id') != 'function-help' ) {
- $(this).addClass('disabled');
- }
- });
-
- // show bar as active
- $('#gollum-editor-function-bar').addClass( 'active' );
- FunctionBar.isActive = true;
- },
-
-
- deactivate: function() {
- $('#gollum-editor-function-bar a.function-button').unbind('click');
- $('#gollum-editor-function-bar').removeClass( 'active' );
- FunctionBar.isActive = false;
- },
-
-
- /**
- * FunctionBar.evtFunctionButtonClick
- * Event handler for the function buttons. Traps the click and
- * executes the proper language action.
- *
- * @param jQuery.Event jQuery event object.
- */
- evtFunctionButtonClick: function(e) {
- e.preventDefault();
- var def = LanguageDefinition.getDefinitionFor( $(this).attr('id') );
- if ( typeof def == 'object' ) {
- FunctionBar.executeAction( def );
- }
- },
-
-
- /**
- * FunctionBar.executeAction
- * Executes a language-specific defined action for a function button.
- *
- */
- executeAction: function( definitionObject ) {
- // get the selected text from the textarea
- var txt = $('#gollum-editor-body').val();
- // hmm, I'm not sure this will work in a textarea
- var selPos = FunctionBar
- .getFieldSelectionPosition( $('#gollum-editor-body') );
- var selText = FunctionBar.getFieldSelection( $('#gollum-editor-body') );
- var repText = selText;
- var reselect = true;
- var cursor = null;
-
- // execute a replacement function if one exists
- if ( definitionObject.exec &&
- typeof definitionObject.exec == 'function' ) {
- definitionObject.exec( txt, selText, $('#gollum-editor-body') );
- return;
- }
-
- // execute a search/replace if they exist
- var searchExp = /([^\n]+)/gi;
- if ( definitionObject.search &&
- typeof definitionObject.search == 'object' ) {
- debug('Replacing search Regex');
- searchExp = null;
- searchExp = new RegExp ( definitionObject.search );
- debug( searchExp );
- }
- debug('repText is ' + '"' + repText + '"');
- // replace text
- if ( definitionObject.replace &&
- typeof definitionObject.replace == 'string' ) {
- debug('Running replacement - using ' + definitionObject.replace);
- var rt = definitionObject.replace;
- repText = repText.replace( searchExp, rt );
- // remove backreferences
- repText = repText.replace( /\$[\d]/g, '' );
-
- if ( repText === '' ) {
- debug('Search string is empty');
-
- // find position of $1 - this is where we will place the cursor
- cursor = rt.indexOf('$1');
-
- // we have an empty string, so just remove backreferences
- repText = rt.replace( /\$[\d]/g, '' );
-
- // if the position of $1 doesn't exist, stick the cursor in
- // the middle
- if ( cursor == -1 ) {
- cursor = Math.floor( rt.length / 2 );
- }
- }
- }
-
- // append if necessary
- if ( definitionObject.append &&
- typeof definitionObject.append == 'string' ) {
- if ( repText == selText ) {
- reselect = false;
- }
- repText += definitionObject.append;
- }
-
- if ( repText ) {
- FunctionBar.replaceFieldSelection( $('#gollum-editor-body'),
- repText, reselect, cursor );
- }
-
- },
-
-
- /**
- * getFieldSelectionPosition
- * Retrieves the selection range for the textarea.
- *
- * @return object the .start and .end offsets in the string
- */
- getFieldSelectionPosition: function( $field ) {
- if ($field.length) {
- var start = 0, end = 0;
- var el = $field.get(0);
-
- if (typeof el.selectionStart == "number" &&
- typeof el.selectionEnd == "number") {
- start = el.selectionStart;
- end = el.selectionEnd;
- } else {
- var range = document.selection.createRange();
- var stored_range = range.duplicate();
- stored_range.moveToElementText( el );
- stored_range.setEndPoint( 'EndToEnd', range );
- start = stored_range.text.length - range.text.length;
- end = start + range.text.length;
-
- // so, uh, we're close, but we need to search for line breaks and
- // adjust the start/end points accordingly since IE counts them as
- // 2 characters in TextRange.
- var s = start;
- var lb = 0;
- var i;
- debug('IE: start position is currently ' + s);
- for ( i=0; i < s; i++ ) {
- if ( el.value.charAt(i).match(/\r/) ) {
- ++lb;
- }
- }
-
- if ( lb ) {
- debug('IE start: compensating for ' + lb + ' line breaks');
- start = start - lb;
- lb = 0;
- }
-
- var e = end;
- for ( i=0; i < e; i++ ) {
- if ( el.value.charAt(i).match(/\r/) ) {
- ++lb;
- }
- }
-
- if ( lb ) {
- debug('IE end: compensating for ' + lb + ' line breaks');
- end = end - lb;
- }
- }
-
- return {
- start: start,
- end: end
- };
- } // end if ($field.length)
- },
-
-
- /**
- * getFieldSelection
- * Returns the currently selected substring of the textarea.
- *
- * @param jQuery A jQuery object for the textarea.
- * @return string Selected string.
- */
- getFieldSelection: function( $field ) {
- var selStr = '';
- var selPos;
-
- if ( $field.length ) {
- selPos = FunctionBar.getFieldSelectionPosition( $field );
- selStr = $field.val().substring( selPos.start, selPos.end );
- debug('Selected: ' + selStr + ' (' + selPos.start + ', ' +
- selPos.end + ')');
- return selStr;
- }
- return false;
- },
-
-
- isShown: function() {
- return ($('#gollum-editor-function-bar').is(':visible'));
- },
-
- refresh: function() {
- if ( EditorHas.functionBar() ) {
- debug('Refreshing function bar');
- if ( LanguageDefinition.isValid() ) {
- $('#gollum-editor-function-bar a.function-button').unbind('click');
- FunctionBar.activate();
- if ( Help ) {
- Help.setActiveHelp( LanguageDefinition.getActiveLanguage() );
- }
- } else {
- debug('Language definition is invalid.');
- if ( FunctionBar.isShown() ) {
- // deactivate the function bar; it's not gonna work now
- FunctionBar.deactivate();
- }
- if ( Help.isShown() ) {
- Help.hide();
- }
- }
- }
- },
-
-
- /**
- * replaceFieldSelection
- * Replaces the currently selected substring of the textarea with
- * a new string.
- *
- * @param jQuery A jQuery object for the textarea.
- * @param string The string to replace the current selection with.
- * @param boolean Reselect the new text range.
- */
- replaceFieldSelection: function( $field, replaceText, reselect, cursorOffset ) {
- var selPos = FunctionBar.getFieldSelectionPosition( $field );
- var fullStr = $field.val();
- var selectNew = true;
- if ( reselect === false) {
- selectNew = false;
- }
-
- var scrollTop = null;
- if ( $field[0].scrollTop ) {
- scrollTop = $field[0].scrollTop;
- }
-
- $field.val( fullStr.substring(0, selPos.start) + replaceText +
- fullStr.substring(selPos.end) );
- $field[0].focus();
-
- if ( selectNew ) {
- if ( $field[0].setSelectionRange ) {
- if ( cursorOffset ) {
- $field[0].setSelectionRange(
- selPos.start + cursorOffset,
- selPos.start + cursorOffset
- );
- } else {
- $field[0].setSelectionRange( selPos.start,
- selPos.start + replaceText.length );
- }
- } else if ( $field[0].createTextRange ) {
- var range = $field[0].createTextRange();
- range.collapse( true );
- if ( cursorOffset ) {
- range.moveEnd( selPos.start + cursorOffset );
- range.moveStart( selPos.start + cursorOffset );
- } else {
- range.moveEnd( 'character', selPos.start + replaceText.length );
- range.moveStart( 'character', selPos.start );
- }
- range.select();
- }
- }
-
- if ( scrollTop ) {
- // this jumps sometimes in FF
- $field[0].scrollTop = scrollTop;
- }
- }
- };
-
-
-
- /**
- * FormatSelector
- *
- * Functions relating to the format selector (if it exists)
- */
- var FormatSelector = {
-
- $_SELECTOR: null,
-
- /**
- * FormatSelector.evtChangeFormat
- * Event handler for when a format has been changed by the format
- * selector. Will automatically load a new language definition
- * via JS if necessary.
- *
- * @return void
- */
- evtChangeFormat: function( e ) {
- var newMarkup = $(this).val();
- LanguageDefinition.setActiveLanguage( newMarkup );
- },
-
-
- /**
- * FormatSelector.init
- * Initializes the format selector.
- *
- * @return void
- */
- init: function( $sel ) {
- debug('Initializing format selector');
-
- // unbind events if init is being called twice for some reason
- if ( FormatSelector.$_SELECTOR &&
- typeof FormatSelector.$_SELECTOR == 'object' ) {
- FormatSelector.$_SELECTOR.unbind( 'change' );
- }
-
- FormatSelector.$_SELECTOR = $sel;
-
- // set format selector to the current language
- FormatSelector.updateSelected();
- FormatSelector.$_SELECTOR.change( FormatSelector.evtChangeFormat );
- },
-
-
- /**
- * FormatSelector.update
- */
- updateSelected: function() {
- var currentLang = LanguageDefinition.getActiveLanguage();
- FormatSelector.$_SELECTOR.val( currentLang );
- }
-
- };
-
-
-
- /**
- * Help
- *
- * Functions that manage the display and loading of inline help files.
- */
- var Help = {
-
- _ACTIVE_HELP: '',
- _LOADED_HELP_LANGS: [],
- _HELP: {},
-
- /**
- * Help.define
- *
- * Defines a new help context and enables the help function if it
- * exists in the Gollum Function Bar.
- *
- * @param string name The name you're giving to this help context.
- * Generally, this should match the language name.
- * @param object definitionObject The definition object being loaded from a
- * language / help definition file.
- * @return void
- */
- define: function( name, definitionObject ) {
- if ( Help.isValidHelpFormat( definitionObject ) ) {
- debug('help is a valid format');
-
- Help._ACTIVE_HELP_LANG = name;
- Help._LOADED_HELP_LANGS.push( name );
- Help._HELP[name] = definitionObject;
-
- if ( $("#function-help").length ) {
- if ( $('#function-help').hasClass('disabled') ) {
- $('#function-help').removeClass('disabled');
- }
- $('#function-help').unbind('click');
- $('#function-help').click( Help.evtHelpButtonClick );
-
- // generate help menus
- Help.generateHelpMenuFor( name );
-
- if ( $('#gollum-editor-help').length &&
- typeof $('#gollum-editor-help').attr('data-autodisplay') !== 'undefined' &&
- $('#gollum-editor-help').attr('data-autodisplay') === 'true' ) {
- Help.show();
- }
- }
- } else {
- if ( $('#function-help').length ) {
- $('#function-help').addClass('disabled');
- }
- }
- },
-
- /**
- * Help.generateHelpMenuFor
- * Generates the markup for the main help menu given a context name.
- *
- * @param string name The context name.
- * @return void
- */
- generateHelpMenuFor: function( name ) {
- if ( !Help._HELP[name] ) {
- debug('Help is not defined for ' + name.toString());
- return false;
- }
- var helpData = Help._HELP[name];
-
- // clear this shiz out
- $('#gollum-editor-help-parent').html('');
- $('#gollum-editor-help-list').html('');
- $('#gollum-editor-help-content').html('');
-
- // go go inefficient algorithm
- for ( var i=0; i < helpData.length; i++ ) {
- if ( typeof helpData[i] != 'object' ) {
- break;
- }
-
- var $newLi = $('<li><a href="#" rel="' + i + '">' +
- helpData[i].menuName + '</a></li>');
- $('#gollum-editor-help-parent').append( $newLi );
- if ( i === 0 ) {
- // select on first run
- $newLi.children('a').addClass('selected');
- }
- $newLi.children('a').click( Help.evtParentMenuClick );
- }
-
- // generate parent submenu on first run
- Help.generateSubMenu( helpData[0], 0 );
- $($('#gollum-editor-help-list li a').get(0)).click();
-
- },
-
- /**
- * Help.generateSubMenu
- * Generates the markup for the inline help sub-menu given the data
- * object for the submenu and the array index to start at.
- *
- * @param object subData The data for the sub-menu.
- * @param integer index The index clicked on (parent menu index).
- * @return void
- */
- generateSubMenu: function( subData, index ) {
- $('#gollum-editor-help-list').html('');
- $('#gollum-editor-help-content').html('');
- for ( var i=0; i < subData.content.length; i++ ) {
- if ( typeof subData.content[i] != 'object' ) {
- break;
- }
-
- var $subLi = $('<li><a href="#" rel="' + index + ':' + i + '">' +
- subData.content[i].menuName + '</a></li>');
-
-
- $('#gollum-editor-help-list').append( $subLi );
- $subLi.children('a').click( Help.evtSubMenuClick );
- }
- },
-
- hide: function() {
- if ( $.browser.msie ) {
- $('#gollum-editor-help').css('display', 'none');
- } else {
- $('#gollum-editor-help').animate({
- opacity: 0
- }, 200, function() {
- $('#gollum-editor-help')
- .animate({ height: 'hide' }, 200);
- });
- }
- },
-
- show: function() {
- if ( $.browser.msie ) {
- // bypass effects for internet explorer, since it does weird crap
- // to text antialiasing with opacity animations
- $('#gollum-editor-help').css('display', 'block');
- } else {
- $('#gollum-editor-help').animate({
- height: 'show'
- }, 200, function() {
- $('#gollum-editor-help')
- .animate({ opacity: 1 }, 300);
- });
- }
- },
-
- /**
- * Help.showHelpFor
- * Displays the actual help content given the two menu indexes, which are
- * rendered in the rel="" attributes of the help menus
- *
- * @param integer index1 parent index
- * @param integer index2 submenu index
- * @return void
- */
- showHelpFor: function( index1, index2 ) {
- var html =
- Help._HELP[Help._ACTIVE_HELP_LANG][index1].content[index2].data;
- $('#gollum-editor-help-content').html(html);
- },
-
- /**
- * Help.isLoadedFor
- * Returns true if help is loaded for a specific markup language,
- * false otherwise.
- *
- * @param string name The name of the markup language.
- * @return boolean
- */
- isLoadedFor: function( name ) {
- for ( var i=0; i < Help._LOADED_HELP_LANGS.length; i++ ) {
- if ( name == Help._LOADED_HELP_LANGS[i] ) {
- return true;
- }
- }
- return false;
- },
-
- isShown: function() {
- return ($('#gollum-editor-help').is(':visible'));
- },
-
- /**
- * Help.isValidHelpFormat
- * Does a quick check to make sure that the help definition isn't in a
- * completely messed-up format.
- *
- * @param object (Array) helpArr The help definition array.
- * @return boolean
- */
- isValidHelpFormat: function( helpArr ) {
- return ( typeof helpArr == 'object' &&
- helpArr.length &&
- typeof helpArr[0].menuName == 'string' &&
- typeof helpArr[0].content == 'object' &&
- helpArr[0].content.length );
- },
-
- /**
- * Help.setActiveHelp
- * Sets the active help definition to the one defined in the argument,
- * re-rendering the help menu to match the new definition.
- *
- * @param string name The name of the help definition.
- * @return void
- */
- setActiveHelp: function( name ) {
- if ( !Help.isLoadedFor( name ) ) {
- if ( $('#function-help').length ) {
- $('#function-help').addClass('disabled');
- }
- if ( Help.isShown() ) {
- Help.hide();
- }
- } else {
- Help._ACTIVE_HELP_LANG = name;
- if ( $("#function-help").length ) {
- if ( $('#function-help').hasClass('disabled') ) {
- $('#function-help').removeClass('disabled');
- }
- $('#function-help').unbind('click');
- $('#function-help').click( Help.evtHelpButtonClick );
- Help.generateHelpMenuFor( name );
- }
- }
- },
-
- /**
- * Help.evtHelpButtonClick
- * Event handler for clicking the help button in the function bar.
- *
- * @param jQuery.Event e The jQuery event object.
- * @return void
- */
- evtHelpButtonClick: function( e ) {
- e.preventDefault();
- if ( Help.isShown() ) {
- // turn off autodisplay if it's on
- if ( $('#gollum-editor-help').length &&
- $('#gollum-editor-help').attr('data-autodisplay') !== 'undefined' &&
- $('#gollum-editor-help').attr('data-autodisplay') === 'true' ) {
- $.post('/wiki/help?_method=delete');
- $('#gollum-editor-help').attr('data-autodisplay', '');
- }
- Help.hide(); }
- else { Help.show(); }
- },
-
- /**
- * Help.evtParentMenuClick
- * Event handler for clicking on an item in the parent menu. Automatically
- * renders the submenu for the parent menu as well as the first result for
- * the actual plain text.
- *
- * @param jQuery.Event e The jQuery event object.
- * @return void
- */
- evtParentMenuClick: function( e ) {
- e.preventDefault();
- // short circuit if we've selected this already
- if ( $(this).hasClass('selected') ) { return; }
-
- // populate from help data for this
- var helpIndex = $(this).attr('rel');
- var subData = Help._HELP[Help._ACTIVE_HELP_LANG][helpIndex];
-
- $('#gollum-editor-help-parent li a').removeClass('selected');
- $(this).addClass('selected');
- Help.generateSubMenu( subData, helpIndex );
- $($('#gollum-editor-help-list li a').get(0)).click();
- },
-
- /**
- * Help.evtSubMenuClick
- * Event handler for clicking an item in a help submenu. Renders the
- * appropriate text for the submenu link.
- *
- * @param jQuery.Event e The jQuery event object.
- * @return void
- */
- evtSubMenuClick: function( e ) {
- e.preventDefault();
- if ( $(this).hasClass('selected') ) { return; }
-
- // split index rel data
- var rawIndex = $(this).attr('rel').split(':');
- $('#gollum-editor-help-list li a').removeClass('selected');
- $(this).addClass('selected');
- Help.showHelpFor( rawIndex[0], rawIndex[1] );
- }
- };
-
- // Publicly-accessible function to Help.define
- $.GollumEditor.defineHelp = Help.define;
-
- // Dialog exists as its own thing now
- $.GollumEditor.Dialog = $.GollumDialog;
- $.GollumEditor.replaceSelection = function( repText ) {
- FunctionBar.replaceFieldSelection( $('#gollum-editor-body'), repText );
- };
-
- // Placeholder exists as its own thing now
- $.GollumEditor.Placeholder = $.GollumPlaceholder;
-
-})(jQuery);
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/static/js/editor/langs/markdown.js
----------------------------------------------------------------------
diff --git a/balance/modules/puny/static/js/editor/langs/markdown.js b/balance/modules/puny/static/js/editor/langs/markdown.js
deleted file mode 100644
index 1ac8e3b..0000000
--- a/balance/modules/puny/static/js/editor/langs/markdown.js
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Markdown Language Definition
- *
- * A language definition for string manipulation operations, in this case
- * for the Markdown, uh, markup language. Uses regexes for various functions
- * by default. If regexes won't do and you need to do some serious
- * manipulation, you can declare a function in the object instead.
- *
- * Code example:
- * 'functionbar-id' : {
- * exec: function(text, selectedText) {
- * functionStuffHere();
- * },
- * search: /somesearchregex/gi,
- * replace: 'replace text for RegExp.replace',
- * append: "just add this where the cursor is"
- * }
- *
-**/
-(function($) {
-
-var MarkDown = {
-
- 'function-bold' : {
- search: /([^\n]+)([\n\s]*)/g,
- replace: "**$1**$2"
- },
-
- 'function-italic' : {
- search: /([^\n]+)([\n\s]*)/g,
- replace: "_$1_$2"
- },
-
- 'function-code' : {
- search: /(^[\n]+)([\n\s]*)/g,
- replace: "`$1`$2"
- },
-
- 'function-hr' : {
- append: "\n***\n"
- },
-
- 'function-ul' : {
- search: /(.+)([\n]?)/g,
- replace: "* $1$2"
- },
-
- /* This looks silly but is completely valid Markdown */
- 'function-ol' : {
- search: /(.+)([\n]?)/g,
- replace: "1. $1$2"
- },
-
- 'function-blockquote' : {
- search: /(.+)([\n]?)/g,
- replace: "> $1$2"
- },
-
- 'function-h1' : {
- search: /(.+)([\n]?)/g,
- replace: "# $1$2"
- },
-
- 'function-h2' : {
- search: /(.+)([\n]?)/g,
- replace: "## $1$2"
- },
-
- 'function-h3' : {
- search: /(.+)([\n]?)/g,
- replace: "### $1$2"
- },
-
- 'function-link' : {
- exec: function( txt, selText, $field ) {
- var results = null;
- $.GollumEditor.Dialog.init({
- title: 'Insert Link',
- fields: [
- {
- id: 'text',
- name: 'Link Text',
- type: 'text'
- },
- {
- id: 'href',
- name: 'URL',
- type: 'text'
- }
- ],
- OK: function( res ) {
- var rep = '';
- if ( res['text'] && res['href'] ) {
- rep = '[' + res['text'] + '](' +
- res['href'] + ')';
- }
- $.GollumEditor.replaceSelection( rep );
- }
- });
- }
- },
-
- 'function-image' : {
- exec: function( txt, selText, $field ) {
- var results = null;
- $.GollumEditor.Dialog.init({
- title: 'Insert Image',
- fields: [
- {
- id: 'url',
- name: 'Image URL',
- type: 'text'
- },
- {
- id: 'alt',
- name: 'Alt Text',
- type: 'text'
- }
- ],
- OK: function( res ) {
- var rep = '';
- if ( res['url'] && res['alt'] ) {
- rep = '![' + res['alt'] + ']' +
- '(' + res['url'] + ')';
- }
- $.GollumEditor.replaceSelection( rep );
- }
- });
- }
- }
-
-};
-
-var MarkDownHelp = [
-
- {
- menuName: 'Block Elements',
- content: [
- {
- menuName: 'Paragraphs & Breaks',
- data: '<p>To create a paragraph, simply create a block of text that is not separated by one or more blank lines. Blocks of text separated by one or more blank lines will be parsed as paragraphs.</p><p>If you want to create a line break, end a line with two or more spaces, then hit Return/Enter.</p>'
- },
- {
- menuName: 'Headers',
- data: '<p>Markdown supports two header formats. The wiki editor uses the “atx’-style headers. Simply prefix your header text with the number of <code>#</code> characters to specify heading depth. For example: <code># Header 1</code>, <code>## Header 2</code> and <code>### Header 3</code> will be progressively smaller headers. You may end your headers with any number of hashes.</p>'
- },
- {
- menuName: 'Blockquotes',
- data: '<p>Markdown creates blockquotes email-style by prefixing each line with the <code>></code>. This looks best if you decide to hard-wrap text and prefix each line with a <code>></code> character, but Markdown supports just putting <code>></code> before your paragraph.</p>'
- },
- {
- menuName: 'Lists',
- data: '<p>Markdown supports both ordered and unordered lists. To create an ordered list, simply prefix each line with a number (any number will do — this is why the editor only uses one number.) To create an unordered list, you can prefix each line with <code>*</code>, <code>+</code> or <code>-</code>.</p> List items can contain multiple paragraphs, however each paragraph must be indented by at least 4 spaces or a tab.'
- },
- {
- menuName: 'Code Blocks',
- data: '<p>Markdown wraps code blocks in pre-formatted tags to preserve indentation in your code blocks. To create a code block, indent the entire block by at least 4 spaces or one tab. Markdown will strip the extra indentation you’ve added to the code block.</p>'
- },
- {
- menuName: 'Horizontal Rules',
- data: 'Horizontal rules are created by placing three or more hyphens, asterisks or underscores on a line by themselves. Spaces are allowed between the hyphens, asterisks or underscores.'
- }
- ]
- },
-
- {
- menuName: 'Span Elements',
- content: [
- {
- menuName: 'Links',
- data: '<p>Markdown has two types of links: <strong>inline</strong> and <strong>reference</strong>. For both types of links, the text you want to display to the user is placed in square brackets. For example, if you want your link to display the text “GitHub”, you write <code>[GitHub]</code>.</p><p>To create an inline link, create a set of parentheses immediately after the brackets and write your URL within the parentheses. (e.g., <code>[GitHub](http://github.com/)</code>). Relative paths are allowed in inline links.</p><p>To create a reference link, use two sets of square brackets. <code>[my internal link][internal-ref]</code> will link to the internal reference <code>internal-ref</code>.</p>'
- },
-
- {
- menuName: 'Emphasis',
- data: '<p>Asterisks (<code>*</code>) and underscores (<code>_</code>) are treated as emphasis and are wrapped with an <code><em></code> tag, which usually displays as italics in most browsers. Double asterisks (<code>**</code>) or double underscores (<code>__</code>) are treated as bold using the <code><strong></code> tag. To create italic or bold text, simply wrap your words in single/double asterisks/underscores. For example, <code>**My double emphasis text**</code> becomes <strong>My double emphasis text</strong>, and <code>*My single emphasis text*</code> becomes <em>My single emphasis text</em>.</p>'
- },
-
- {
- menuName: 'Code',
- data: '<p>To create inline spans of code, simply wrap the code in backticks (<code>`</code>). Markdown will turn <code>`myFunction`</code> into <code>myFunction</code>.</p>'
- },
-
- {
- menuName: 'Images',
- data: '<p>Markdown image syntax looks a lot like the syntax for links; it is essentially the same syntax preceded by an exclamation point (<code>!</code>). For example, if you want to link to an image at <code>http://github.com/unicorn.png</code> with the alternate text <code>My Unicorn</code>, you would write <code></code>.</p>'
- }
- ]
- },
-
- {
- menuName: 'Miscellaneous',
- content: [
- {
- menuName: 'Automatic Links',
- data: '<p>If you want to create a link that displays the actual URL, markdown allows you to quickly wrap the URL in <code><</code> and <code>></code> to do so. For example, the link <a href="javascript:void(0);">http://github.com/</a> is easily produced by writing <code><http://github.com/></code>.</p>'
- },
-
- {
- menuName: 'Escaping',
- data: '<p>If you want to use a special Markdown character in your document (such as displaying literal asterisks), you can escape the character with the backslash (<code>\\</code>). Markdown will ignore the character directly after a backslash.'
- }
- ]
- }
-];
-
-
-$.GollumEditor.defineLanguage('markdown', MarkDown);
-$.GollumEditor.defineHelp('markdown', MarkDownHelp);
-
-})(jQuery);
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/static/js/gollum.dialog.js
----------------------------------------------------------------------
diff --git a/balance/modules/puny/static/js/gollum.dialog.js b/balance/modules/puny/static/js/gollum.dialog.js
deleted file mode 100644
index 6aecc7c..0000000
--- a/balance/modules/puny/static/js/gollum.dialog.js
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * gollum.dialog.js
- *
- * Used for dialogs. Duh.
- *
- */
-
-(function($) {
-
- var Dialog = {
-
- debugOn: false,
- markupCreated: false,
- markup: '',
-
- attachEvents: function( evtOK ) {
- $('#gollum-dialog-action-ok').click(function( e ) {
- Dialog.eventOK( e, evtOK );
- });
- $('#gollum-dialog-action-cancel').click( Dialog.eventCancel );
- $('#gollum-dialog-dialog input[type="text"]').keydown(function( e ) {
- if ( e.keyCode == 13 ) {
- Dialog.eventOK( e, evtOK );
- }
- });
- },
-
- detachEvents: function() {
- $('#gollum-dialog-action-ok').unbind('click');
- $('#gollum-dialog-action-cancel').unbind('click');
- },
-
- createFieldMarkup: function( fieldArray ) {
- var fieldMarkup = '<fieldset>';
- for ( var i=0; i < fieldArray.length; i++ ) {
- if ( typeof fieldArray[i] == 'object' ) {
- fieldMarkup += '<div class="field">';
- switch ( fieldArray[i].type ) {
-
- // only text is supported for now
- case 'text':
- fieldMarkup += Dialog.createFieldText( fieldArray[i] );
- break;
-
- default:
- break;
-
- }
- fieldMarkup += '</div>';
- }
-
- }
- fieldMarkup += '</fieldset>';
- return fieldMarkup;
- },
-
- createFieldText: function( fieldAttributes ) {
- var html = '';
-
- if ( fieldAttributes.name ) {
- html += '<label';
- if ( fieldAttributes.id ) {
- html += ' for="' + fieldAttributes.name + '"';
- }
- html += '>' + fieldAttributes.name + '</label>';
- }
-
- html += '<input type="text"';
-
- if ( fieldAttributes.id ) {
- html += ' name="' + fieldAttributes.id + '"'
- if ( fieldAttributes.type == 'code' ) {
- html+= ' class="code"';
- }
- html += ' id="gollum-dialog-dialog-generated-field-' +
- fieldAttributes.id + '">';
- }
-
- return html;
- },
-
- createMarkup: function( title, body ) {
- Dialog.markupCreated = true;
- if ($.facebox) {
- return '<div id="gollum-dialog-dialog">' +
- '<div id="gollum-dialog-dialog-title"><h4>' +
- title +'</h4></div>' +
- '<div id="gollum-dialog-dialog-body">' + body + '</div>' +
- '<div id="gollum-dialog-dialog-buttons">' +
- '<a href="#" title="Cancel" id="gollum-dialog-action-cancel" ' +
- 'class="gollum-minibutton">Cancel</a>' +
- '<a href="#" title="OK" id="gollum-dialog-action-ok" '+
- 'class="gollum-minibutton">OK</a>' +
- '</div>' +
- '</div>';
- } else {
- return '<div id="gollum-dialog-dialog">' +
- '<div id="gollum-dialog-dialog-inner">' +
- '<div id="gollum-dialog-dialog-bg">' +
- '<div id="gollum-dialog-dialog-title"><h4>' +
- title +'</h4></div>' +
- '<div id="gollum-dialog-dialog-body">' + body + '</div>' +
- '<div id="gollum-dialog-dialog-buttons">' +
- '<a href="#" title="Cancel" id="gollum-dialog-action-cancel" ' +
- 'class="minibutton">Cancel</a>' +
- '<a href="#" title="OK" id="gollum-dialog-action-ok" '+
- 'class="minibutton">OK</a>' +
- '</div>' +
- '</div>' +
- '</div>' +
- '</div>';
- }
- },
-
- eventCancel: function( e ) {
- e.preventDefault();
- debug('Cancelled dialog.');
- Dialog.hide();
- },
-
- eventOK: function( e, evtOK ) {
- e.preventDefault();
-
- var results = [];
- // get the results from each field and build them into the object
- $('#gollum-dialog-dialog-body input').each(function() {
- results[$(this).attr('name')] = $(this).val();
- });
-
- // pass them to evtOK if it exists (which it should)
- if ( evtOK &&
- typeof evtOK == 'function' ) {
- evtOK( results );
- }
- Dialog.hide();
- },
-
- hide: function() {
- if ( $.facebox ) {
- Dialog.markupCreated = false;
- $(document).trigger('close.facebox');
- Dialog.detachEvents();
- } else {
- if ( $.browser.msie ) {
- $('#gollum-dialog-dialog').hide().removeClass('active');
- $('select').css('visibility', 'visible');
- } else {
- $('#gollum-dialog-dialog').animate({ opacity: 0 }, {
- duration: 200,
- complete: function() {
- $('#gollum-dialog-dialog').removeClass('active');
- }
- });
- }
- }
- },
-
- init: function( argObject ) {
- var title = '';
- var body = '';
-
- // bail out if necessary
- if ( !argObject ||
- typeof argObject != 'object' ) {
- debug('Editor Dialog: Cannot init; invalid init object');
- return;
- }
-
- if ( argObject.body && typeof argObject.body == 'string' ) {
- body = '<p>' + argObject.body + '</p>';
- }
-
- // alright, build out fields
- if ( argObject.fields && typeof argObject.fields == 'object' ) {
- body += Dialog.createFieldMarkup( argObject.fields );
- }
-
- if ( argObject.title && typeof argObject.title == 'string' ) {
- title = argObject.title;
- }
-
- if ( Dialog.markupCreated ) {
- if ($.facebox) {
- $(document).trigger('close.facebox');
- } else {
- $('#gollum-dialog-dialog').remove();
- }
- }
-
- Dialog.markup = Dialog.createMarkup( title, body );
-
- if ($.facebox) {
- $(document).bind('reveal.facebox', function() {
- if ( argObject.OK &&
- typeof argObject.OK == 'function' ) {
- Dialog.attachEvents( argObject.OK );
- $($('#facebox input[type="text"]').get(0)).focus();
- }
- });
- } else {
- $('body').append( Dialog.markup );
- if ( argObject.OK &&
- typeof argObject.OK == 'function' ) {
- Dialog.attachEvents( argObject.OK );
- }
- }
-
- Dialog.show();
- },
-
- show: function() {
- if ( !Dialog.markupCreated ) {
- debug('Dialog: No markup to show. Please use init first.');
- } else {
- debug('Showing dialog');
- if ($.facebox) {
- $.facebox( Dialog.markup );
- } else {
- if ( $.browser.msie ) {
- $('#gollum-dialog.dialog').addClass('active');
- Dialog.position();
- $('select').css('visibility', 'hidden');
- } else {
- $('#gollum-dialog.dialog').css('display', 'none');
- $('#gollum-dialog-dialog').animate({ opacity: 0 }, {
- duration: 0,
- complete: function() {
- $('#gollum-dialog-dialog').css('display', 'block');
- Dialog.position(); // position this thing
- $('#gollum-dialog-dialog').animate({ opacity: 1 }, {
- duration: 500
- });
- }
- });
- }
- }
- }
- },
-
- position: function() {
- var dialogHeight = $('#gollum-dialog-dialog-inner').height();
- $('#gollum-dialog-dialog-inner')
- .css('height', dialogHeight + 'px');
- }
- };
-
- if ($.facebox) {
- $(document).bind('reveal.facebox', function() {
- $('#facebox img.close_image').remove();
- });
- }
-
- var debug = function(m) {
- if ( Dialog.debugOn
- && typeof console != 'undefined' ) {
- console.log( m );
- }
- };
-
- $.GollumDialog = Dialog;
-
-})(jQuery);
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/static/js/gollum.js
----------------------------------------------------------------------
diff --git a/balance/modules/puny/static/js/gollum.js b/balance/modules/puny/static/js/gollum.js
deleted file mode 100644
index 5acca0c..0000000
--- a/balance/modules/puny/static/js/gollum.js
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// ua
-$(document).ready(function() {
- var nodeSelector = {
- node1: null,
- node2: null,
-
- selectNodeRange: function( n1, n2 ) {
- if ( nodeSelector.node1 && nodeSelector.node2 ) {
- $('#wiki-history td.selected').removeClass('selected');
- nodeSelector.node1.addClass('selected');
- nodeSelector.node2.addClass('selected');
-
- // swap the nodes around if they went in reverse
- if ( nodeSelector.nodeComesAfter( nodeSelector.node1,
- nodeSelector.node2 ) ) {
- var n = nodeSelector.node1;
- nodeSelector.node1 = nodeSelector.node2;
- nodeSelector.node2 = n;
- }
-
- var s = true;
- var $nextNode = nodeSelector.node1.next();
- while ( $nextNode ) {
- $nextNode.addClass('selected');
- if ( $nextNode[0] == nodeSelector.node2[0] ) {
- break;
- }
- $nextNode = $nextNode.next();
- }
- }
- },
-
- nodeComesAfter: function ( n1, n2 ) {
- var s = false;
- $(n1).prevAll().each(function() {
- if ( $(this)[0] == $(n2)[0] ) {
- s = true;
- }
- });
- return s;
- },
-
- checkNode: function( nodeCheckbox ) {
- var $nodeCheckbox = nodeCheckbox;
- var $node = $(nodeCheckbox).parent().parent();
- // if we're unchecking
- if ( !$nodeCheckbox.is(':checked') ) {
-
- // remove the range, since we're breaking it
- $('#wiki-history tr.selected').each(function() {
- if ( $(this).find('td.checkbox input').is(':checked') ) {
- return;
- }
- $(this).removeClass('selected');
- });
-
- // no longer track this
- if ( $node[0] == nodeSelector.node1[0] ) {
- nodeSelector.node1 = null;
- if ( nodeSelector.node2 ) {
- nodeSelector.node1 = nodeSelector.node2;
- nodeSelector.node2 = null;
- }
- } else if ( $node[0] == nodeSelector.node2[0] ) {
- nodeSelector.node2 = null;
- }
-
- } else {
- if ( !nodeSelector.node1 ) {
- nodeSelector.node1 = $node;
- nodeSelector.node1.addClass('selected');
- } else if ( !nodeSelector.node2 ) {
- // okay, we don't have a node 2 but have a node1
- nodeSelector.node2 = $node;
- nodeSelector.node2.addClass('selected');
- nodeSelector.selectNodeRange( nodeSelector.node1,
- nodeSelector.node2 );
- } else {
- // we have two selected already
- $nodeCheckbox[0].checked = false;
- }
- }
- }
- };
-
- // ua detection
- if ($.browser.mozilla) {
- $('body').addClass('ff');
- } else if ($.browser.webkit) {
- $('body').addClass('webkit');
- } else if ($.browser.msie) {
- $('body').addClass('ie');
- if ($.browser.version == "7.0") {
- $('body').addClass('ie7');
- } else if ($.browser.version == "8.0") {
- $('body').addClass('ie8');
- }
- }
-
- if ($('#minibutton-new-page').length) {
- $('#minibutton-new-page').removeClass('jaws');
- $('#minibutton-new-page').click(function(e) {
- e.preventDefault();
- $.GollumDialog.init({
- title: 'Create New Page',
- fields: [
- {
- id: 'name',
- name: 'Page Name',
- type: 'text'
- }
- ],
- OK: function( res ) {
- var n = 'New Page';
- if ( res['name'] )
- var n = res['name'];
- n = encodeURIComponent( n );
- window.location = '/' + n;
- }
- });
- });
- }
-
- if ($('#wiki-wrapper').hasClass('history')) {
- $('#wiki-history td.checkbox input').each(function() {
- $(this).click(function() {
- nodeSelector.checkNode($(this));
- });
- if ( $(this).is(':checked') ) {
- nodeSelector.checkNode($(this));
- }
- });
-
- if ($('.history a.action-compare-revision').length) {
- $('.history a.action-compare-revision').click(function() {
- $("#version-form").submit();
- });
- }
- }
-
- if ($('#searchbar a#search-submit').length) {
- $.GollumPlaceholder.add($('#searchbar #search-query'));
- $('#searchbar a#search-submit').click(function(e) {
- e.preventDefault();
- $('#searchbar #search-form')[0].submit();
- });
- $('#searchbar #search-form').submit(function(e) {
- $.GollumPlaceholder.clearAll();
- $(this).unbind('submit');
- $(this).submit();
- });
- }
-
- if ($('#gollum-revert-form').length &&
- $('.gollum-revert-button').length ) {
- $('a.gollum-revert-button').click(function(e) {
- e.preventDefault();
- $('#gollum-revert-form').submit();
- });
- }
-});
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/puny/static/js/gollum.placeholder.js
----------------------------------------------------------------------
diff --git a/balance/modules/puny/static/js/gollum.placeholder.js b/balance/modules/puny/static/js/gollum.placeholder.js
deleted file mode 100644
index 882f1bb..0000000
--- a/balance/modules/puny/static/js/gollum.placeholder.js
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-(function($) {
-
- var Placeholder = {
-
- _PLACEHOLDERS : [],
-
- _p : function( $field ) {
-
- this.fieldObject = $field;
- this.placeholderText = $field.val();
- var placeholderText = $field.val();
-
- $field.addClass('ph');
-
- $field.blur(function() {
- if ( $(this).val() == '' ) {
- $(this).val( placeholderText );
- $(this).addClass('ph');
- }
- });
-
- $field.focus(function() {
- $(this).removeClass('ph');
- if ( $(this).val() == placeholderText ) {
- $(this).val('');
- } else {
- $(this)[0].select();
- }
- });
-
- },
-
- add : function( $field ) {
- Placeholder._PLACEHOLDERS.push( new Placeholder._p( $field ) );
- },
-
- clearAll: function() {
- for ( var i=0; i < Placeholder._PLACEHOLDERS.length; i++ ) {
- if ( Placeholder._PLACEHOLDERS[i].fieldObject.val() ==
- Placeholder._PLACEHOLDERS[i].placeholderText ) {
- Placeholder._PLACEHOLDERS[i].fieldObject.val('');
- }
- }
- },
-
- exists : function() {
- return ( _PLACEHOLDERS.length );
- }
-
- };
-
- $.GollumPlaceholder = Placeholder;
-
-})(jQuery);
\ No newline at end of file
[04/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/vagrant/radix/vagrant/provision.sh
----------------------------------------------------------------------
diff --git a/vagrant/radix/vagrant/provision.sh b/vagrant/radix/vagrant/provision.sh
deleted file mode 100644
index ed90950..0000000
--- a/vagrant/radix/vagrant/provision.sh
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/bin/bash
-# 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.
-
-##################################################
-# #
-# OODT RADiX Vagrant Provision Script #
-# #
-##################################################
-
-# Load config file
-source /vagrant/vagrant/env.sh
-
-echo "Update Ubuntu’s package index"
-sudo apt-get update
-
-# --------- GENERAL INSTALL/CONFIG ---------------------------------------------------------
-sudo apt-get install -y vim
-sudo apt-get install -y subversion
-sudo apt-get install -y git
-sudo apt-get install -y tree
-sudo apt-get install -y curl
-sudo apt-get install -y maven2
-sudo apt-get install -y default-jdk
-sudo apt-get install -y ack
-
-# --------- General config/install ----------
-sudo cp /vagrant/vagrant/conf/terminal/bashrc /home/vagrant/.bashrc
-source /home/vagrant/.bashrc
-sudo mkdir ${OODT_DEPLOYMENT_HOME}
-sudo chown -R vagrant:vagrant ${OODT_DEPLOYMENT_HOME}
-
-
-# ---------- OODT Installation --------------
-# NOTE: Checking out and installing OODT is only necessary for the SNAPSHOT versions of OODT
-# TO DO: Set up some logic for differentiating between SNAPSHOT (trunk) and tagged releases
-echo "Checking out latest (trunk) OODT from SVN"
-cd /usr/local/src
-sudo svn export ${OODT_SRC_REPO} oodt-${OODT_VERSION}
-sudo chown -R vagrant:vagrant oodt-${OODT_VERSION}
-echo "Build OODT and RADiX archetype"
-cd oodt-${OODT_VERSION}
-mvn -Dmaven.test.skip=true clean install
-cd mvn/archetypes/radix
-sudo mvn install
-
-# ---------- Setup new RADiX project --------
-cd /usr/local/src
-sudo mvn archetype:generate -DinteractiveMode=false -DarchetypeGroupId=org.apache.oodt -DarchetypeArtifactId=radix-archetype -DarchetypeVersion=${OODT_VERSION} -Doodt=${OODT_VERSION} -DgroupId=${PROJECT_GROUP_ID} -DartifactId=${PROJECT_ARTIFACT_ID} -Dversion=0.1-SNAPSHOT
-cd ${PROJECT_ARTIFACT_ID}
-sudo mvn package ${BUILD_FLAGS}
-tar zxf distribution/target/${PROJECT_ARTIFACT_ID}-distribution-*-bin.tar.gz -C ${OODT_DEPLOYMENT_HOME}
-
-# ---------- Start OODT ----------
-cd ${OODT_DEPLOYMENT_HOME}/bin
-./oodt start
-echo ""
-echo "OODT started, please navigate to: http://localhost:8080/opsui"
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/.gitignore
----------------------------------------------------------------------
diff --git a/xmlps/.gitignore b/xmlps/.gitignore
deleted file mode 100644
index b54523f..0000000
--- a/xmlps/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/maven-eclipse.xml
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/pom.xml
----------------------------------------------------------------------
diff --git a/xmlps/pom.xml b/xmlps/pom.xml
deleted file mode 100644
index 01b49c3..0000000
--- a/xmlps/pom.xml
+++ /dev/null
@@ -1,146 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version
- 2.0 (the "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0 Unless required by
- applicable law or agreed to in writing, software distributed under the
- License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
- CONDITIONS OF ANY KIND, either express or implied. See the License for
- the specific language governing permissions and limitations under the
- License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.oodt</groupId>
- <artifactId>oodt-core</artifactId>
- <version>1.1-SNAPSHOT</version>
- <relativePath>../core/pom.xml</relativePath>
- </parent>
- <artifactId>oodt-xmlps</artifactId>
- <version>1.1-SNAPSHOT</version>
- <name>XML-configured, DBMS-based Product and Profile Server</name>
- <description>An XML-configured DBMS-based Product and Profile meant to easily
- sit on top of Web-Grid and other Product and Profile server contexts
- for rapid deployment and integration.</description>
- <!-- All dependencies should be listed in core/pom.xml and be ordered alphabetically by package and artifact.
- Once the dependency is in the core pom, it can then be used in other modules without the version tags.
- For example, within core/pom.xml:
-
- <dependency>
- <groupId>com.amazonaws</groupId>
- <artifactId>aws-java-sdk</artifactId>
- <version>1.7.4</version>
- </dependency>
-
- Elsewhere in the platform:
- <dependency>
- <groupId>com.amazonaws</groupId>
- <artifactId>aws-java-sdk</artifactId>
- </dependency>
-
- Where possible the same dependency version should be used across the whole platform but if required the version
- can be overridden in a specific pom and should have a comment explaing why the version has been overridden
- -->
- <dependencies>
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- <optional />
- </dependency>
- <dependency>
- <groupId>commons-dbcp</groupId>
- <artifactId>commons-dbcp</artifactId>
- <optional />
- </dependency>
- <dependency>
- <groupId>commons-pool</groupId>
- <artifactId>commons-pool</artifactId>
- <optional />
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.oodt</groupId>
- <artifactId>cas-metadata</artifactId>
- <optional />
- </dependency>
- <dependency>
- <groupId>org.apache.oodt</groupId>
- <artifactId>oodt-commons</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.oodt</groupId>
- <artifactId>oodt-product</artifactId>
- <optional />
- </dependency>
- <dependency>
- <groupId>org.apache.oodt</groupId>
- <artifactId>oodt-profile</artifactId>
- <optional />
- </dependency>
- <dependency>
- <groupId>org.apache.oodt</groupId>
- <artifactId>oodt-xmlquery</artifactId>
- </dependency>
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymock</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <build>
- <testSourceDirectory>${basedir}/src/test/java</testSourceDirectory>
- <resources>
- <resource>
- <targetPath>org/apache/oodt/xmlps</targetPath>
- <directory>${basedir}/src/main/conf</directory>
- </resource>
- </resources>
- <testResources>
- <testResource>
- <targetPath>org/apache/oodt/xmlps/mapping</targetPath>
- <filtering />
- <directory>${basedir}/src/test/resources</directory>
- <includes />
- <excludes />
- </testResource>
- </testResources>
-
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <configuration>
- <descriptorRefs>
- <descriptorRef>jar-with-dependencies</descriptorRef>
- </descriptorRefs>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <forkMode>pertest</forkMode>
- <systemProperties>
- <property>
- <name>java.util.logging.config.file</name>
- <value>${basedir}/src/test/resources/logging.properties</value>
- </property>
- </systemProperties>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/main/conf/example-ps.xml
----------------------------------------------------------------------
diff --git a/xmlps/src/main/conf/example-ps.xml b/xmlps/src/main/conf/example-ps.xml
deleted file mode 100644
index 82cb08c..0000000
--- a/xmlps/src/main/conf/example-ps.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-<!-- Example XML mapping configuration file -->
-<oodt:xmlps xmlns:oodt="http://incubator.apache.org/oodt/0.1-incubating"
- name="Example Query Handler" id="project:subproject:exampleps">
- <!--
- attribute:
- default (required): This is the name of the master table part of the
- from clause in the generated query. The default table *does not*
- require a definition in the underlying <table.. tags below, though
- post OODT-548 these will be silently ignored.
- -->
- <tables default="Table1">
- <table name="Table2" join="join_key" tofld="base_table_join_key" />
- <table name="Table3" join="join_key" tofld="base_table_join_key" />
- </tables>
- <!--
- field:
-
- type (required): dynamic or constant. If you choose dynamic, then the field
- value is read from the row in the ResultSet returned
- from the database. If constant, then each returned row
- from the ResultSet is annotated with the value specified
- in the 'value' attribute.
-
- name (required): the name of the attribute that you want returned
- in the product server.
-
- string (optional): whether or not the internal db representation at the local
- site for this field is a STRING, or something else (e.g., a number, etc.). Possible
- values for this attribute are "true", to indicate that the field is a string, or
- "false", to indicate that it is something else. If this attribute is omitted, a value
- of "false" is assumed, and the attribute will not be quoted in the where clause of
- the underlying SQL statement generated.
-
- dbname (optional): the name of the field within the underlying db. If not
- specified, then assumed to be name
-
- table (optional): if provided, then the attribute a is selected as
- 'table'.'a',and then returned. If omitted, the attribute
- is assumed to come from the default table returned from the
- PS query.
-
- value (optional): is necessary to provide if type='constant' is selected.
-
- scope (optional): limits the scope of a field's existence: acceptable values
- are "query", which signifies that the field is only applicable when
- translating queries: and "return", which signifies the field is only
- applicable as a return field when converting database results into CDEResults.
-
- -->
- <field type="dynamic" name="CDE_NAME1" dbname="site_specific_name1" table="Table1" />
- <field type="dynamic" name="CDE_NAME2" dbname="site_specific_name2" table="Table2" />
- <field type="dynamic" name="CDE_NAME3" dbname="site_specific_name3" table="Table2" />
- <field type="constant" name="CDE_NAME4" value="constant_value" />
-</oodt:xmlps>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/main/conf/example.db.properties
----------------------------------------------------------------------
diff --git a/xmlps/src/main/conf/example.db.properties b/xmlps/src/main/conf/example.db.properties
deleted file mode 100644
index ac31f6a..0000000
--- a/xmlps/src/main/conf/example.db.properties
+++ /dev/null
@@ -1,21 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Example data source configuration file
-
-xmlps.datasource.jdbc.url=<driver>:<server_type>://<server>[:<port>][/<database>][;<property>=<value>[;...]]
-xmlps.datasource.jdbc.user=USERNAME
-xmlps.datasource.jdbc.pass=PASSWORD
-xmlps.datasource.jdbc.driver=java.sql.Driver
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/main/java/org/apache/oodt/xmlps/exceptions/XmlpsException.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/exceptions/XmlpsException.java b/xmlps/src/main/java/org/apache/oodt/xmlps/exceptions/XmlpsException.java
deleted file mode 100644
index 9a4f765..0000000
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/exceptions/XmlpsException.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.xmlps.exceptions;
-
-/**
- * XmlpsException for internally thrown exceptions.
- */
-public class XmlpsException extends Exception {
-
- public XmlpsException(String message){
- super(message);
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/DatabaseTable.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/DatabaseTable.java b/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/DatabaseTable.java
deleted file mode 100644
index ae4bb8a..0000000
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/DatabaseTable.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.xmlps.mapping;
-
-/**
- *
- * <p>
- * Description of a local site's database table that will be used as a model to
- * query against and select data from.
- * </p>.
- */
-public class DatabaseTable {
-
- private String name;
-
- private String joinFieldName;
-
- private String defaultTableJoinFieldName;
-
- private String defaultTableJoin;
-
- /**
- * @param name
- * @param joinFieldName
- * @param defaultTableJoinFieldName
- * @param defaultTableJoin
- */
- public DatabaseTable(String name, String joinFieldName,
- String defaultTableJoinFieldName, String defaultTableJoin) {
- super();
- this.name = name;
- this.joinFieldName = joinFieldName;
- this.defaultTableJoinFieldName = defaultTableJoinFieldName;
- this.defaultTableJoin = defaultTableJoin;
- }
-
- /**
- *
- */
- public DatabaseTable() {
- }
-
- /**
- * @return the joinFieldName
- */
- public String getJoinFieldName() {
- return joinFieldName;
- }
-
- /**
- * @param joinFieldName
- * the joinFieldName to set
- */
- public void setJoinFieldName(String joinFieldName) {
- this.joinFieldName = joinFieldName;
- }
-
- /**
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param name
- * the name to set
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * @return the defaultTableJoinFieldName
- */
- public String getDefaultTableJoinFieldName() {
- return defaultTableJoinFieldName;
- }
-
- /**
- * @param defaultTableJoinFieldName
- * the defaultTableJoinFieldName to set
- */
- public void setDefaultTableJoinFieldName(String defaultTableJoinFieldName) {
- this.defaultTableJoinFieldName = defaultTableJoinFieldName;
- }
-
- /**
- * @return the defaultTableJoin
- */
- public String getDefaultTableJoin() {
- return defaultTableJoin;
- }
-
- /**
- * @param defaultTableJoin
- * the defaultTableJoin to set
- */
- public void setDefaultTableJoin(String defaultTableJoin) {
- this.defaultTableJoin = defaultTableJoin;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/DatabaseTableGroup.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/DatabaseTableGroup.java b/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/DatabaseTableGroup.java
deleted file mode 100644
index 5f42558..0000000
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/DatabaseTableGroup.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.xmlps.mapping;
-
-//JDK imports
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-import java.util.Vector;
-
-/**
- *
- * <p>
- * A collection of {@link DatabaseTable}s
- * </p>.
- */
-public class DatabaseTableGroup {
-
- private Map<String, DatabaseTable> group;
-
- private List<DatabaseTable> orderedGroup;
-
- private String defaultTable;
-
- public DatabaseTableGroup() {
- this.group = new TreeMap<String, DatabaseTable>();
- this.orderedGroup = new Vector<DatabaseTable>();
- }
-
- public void addTable(String tblName, DatabaseTable tbl) {
- this.group.put(tblName, tbl);
- this.orderedGroup.add(tbl);
- }
-
- public DatabaseTable getTableByName(String name) {
- return this.group.get(name);
- }
-
- public int getNumTables() {
- return this.group.keySet().size();
- }
-
- public List<String> getTableNames() {
- List<String> names = new Vector<String>();
- for (DatabaseTable tbl : this.orderedGroup) {
- names.add(tbl.getName());
- }
-
- return names;
- }
-
- /**
- * @return the defaultTable
- */
- public String getDefaultTable() {
- return defaultTable;
- }
-
- /**
- * @param defaultTable
- * the defaultTable to set
- */
- public void setDefaultTable(String defaultTable) {
- this.defaultTable = defaultTable;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/FieldScope.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/FieldScope.java b/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/FieldScope.java
deleted file mode 100644
index 40e7273..0000000
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/FieldScope.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.xmlps.mapping;
-
-/**
- *
- * <p>
- * Defines the scope of a {@link MappingField}.
- * </p>.
- */
-public enum FieldScope {
-
- QUERY,
- RETURN;
-
- public String getType() {
- return toString().toLowerCase();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/FieldType.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/FieldType.java b/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/FieldType.java
deleted file mode 100644
index a2751aa..0000000
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/FieldType.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.xmlps.mapping;
-
-/**
- *
- * <p>
- * Defines the type of a {@link MappingField}
- * </p>.
- */
-public enum FieldType {
-
- DYNAMIC,
- CONSTANT;
-
- public String getType() {
- return toString().toLowerCase();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/Mapping.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/Mapping.java b/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/Mapping.java
deleted file mode 100644
index 18e2ca3..0000000
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/Mapping.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.xmlps.mapping;
-
-//JDK imports
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-
-/**
- *
- * <p>
- * An Mapping is a {@link List} of {@link MappingField}s that define the
- * translation of common ontological queries into queries against a local site's
- * DBMS
- * </p>
- * .
- */
-public class Mapping {
-
- private final Map<String, MappingField> fields;
-
- private final DatabaseTableGroup tables;
-
- private String id;
-
- private String name;
-
- /**
- *
- */
- public Mapping() {
- this.fields = new TreeMap<String, MappingField>();
- this.tables = new DatabaseTableGroup();
- }
-
- public Mapping(Map<String, MappingField> fields, DatabaseTableGroup tables,
- String id, String name) {
- super();
- this.fields = fields;
- this.id = id;
- this.name = name;
- this.tables = tables;
- }
-
- public void addField(String fldName, MappingField field) {
- this.fields.put(fldName, field);
- }
-
- public MappingField getFieldByLocalName(String localName) {
- if (this.fields == null || (this.fields.keySet().size() == 0)) {
- return null;
- }
-
- for (MappingField fld : this.fields.values()) {
- if (fld.getLocalName().equals(localName)) {
- return fld;
- }
- }
-
- return null;
- }
-
- public MappingField getFieldByName(String name) {
- return this.fields.get(name);
- }
-
- public boolean constantField(String localName) {
- MappingField fld = getFieldByLocalName(localName);
-
- if (fld == null) {
- return true; // leave it out
- }
-
- return fld.getType() == FieldType.CONSTANT;
- }
-
- public int getNumFields() {
- return this.fields.keySet().size();
- }
-
- public void addTable(String tblName, DatabaseTable tbl) {
- this.tables.addTable(tblName, tbl);
- }
-
- public DatabaseTable getTableByName(String name) {
- return this.tables.getTableByName(name);
- }
-
- public int getNumTables() {
- return this.tables.getNumTables();
- }
-
- public List<String> getTableNames() {
- return this.tables.getTableNames();
- }
-
- public List<String> getFieldNames() {
- return Arrays.asList(this.fields.keySet().toArray(new String[] { "" }));
- }
-
- /**
- * @return the id
- */
- public String getId() {
- return id;
- }
-
- /**
- * @param id
- * the id to set
- */
- public void setId(String id) {
- this.id = id;
- }
-
- /**
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param name
- * the name to set
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * @return the defaultTable
- */
- public String getDefaultTable() {
- return this.tables.getDefaultTable();
- }
-
- /**
- * @param defaultTable
- * the defaultTable to set
- */
- public void setDefaultTable(String defaultTable) {
- this.tables.setDefaultTable(defaultTable);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/MappingField.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/MappingField.java b/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/MappingField.java
deleted file mode 100644
index 317950d..0000000
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/MappingField.java
+++ /dev/null
@@ -1,251 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.xmlps.mapping;
-
-//OODT imports
-import org.apache.oodt.xmlps.mapping.funcs.MappingFunc;
-
-import java.util.List;
-import java.util.Vector;
-
-/**
- *
- * <p>
- * A field within a mapping.xml file that defines the relationship between CDEs
- * and the underlying attributes of a local site's DBMS.
- * </p>
- * .
- */
-public class MappingField {
-
- private String name;
-
- private FieldType type;
-
- private String dbName;
-
- private String tableName;
-
- private String constantValue;
-
- private FieldScope scope;
-
- private List<MappingFunc> funcs;
-
- private boolean string;
-
- /**
- * @param name
- * @param type
- * @param dbName
- * @param tableName
- * @param constantValue
- * @param scope
- * @param funcs
- * @param string
- */
- public MappingField(String name, FieldType type, String dbName,
- String tableName, String constantValue, FieldScope scope,
- List<MappingFunc> funcs, boolean string) {
- super();
- this.name = name;
- this.type = type;
- this.dbName = dbName;
- this.tableName = tableName;
- this.constantValue = constantValue;
- this.scope = scope;
- this.funcs = funcs;
- this.string = string;
- }
-
- /**
- *
- */
- public MappingField() {
- this.name = null;
- this.dbName = null;
- this.tableName = null;
- this.constantValue = null;
- this.scope = null;
- this.string = false;
- this.funcs = new Vector<MappingFunc>();
- }
-
- /**
- * @return the constantValue
- */
- public String getConstantValue() {
- return constantValue;
- }
-
- /**
- * @param constantValue
- * the constantValue to set
- */
- public void setConstantValue(String constantValue) {
- this.constantValue = constantValue;
- }
-
- /**
- * @return the dbName
- */
- public String getDbName() {
- return dbName;
- }
-
- /**
- * @param dbName
- * the dbName to set
- */
- public void setDbName(String dbName) {
- this.dbName = dbName;
- }
-
- /**
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param name
- * the name to set
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * @return the scope
- */
- public FieldScope getScope() {
- return scope;
- }
-
- /**
- * @param scope
- * the scope to set
- */
- public void setScope(FieldScope scope) {
- this.scope = scope;
- }
-
- /**
- * @return the tableName
- */
- public String getTableName() {
- return tableName;
- }
-
- /**
- * @param tableName
- * the tableName to set
- */
- public void setTableName(String tableName) {
- this.tableName = tableName;
- }
-
- /**
- * @return the type
- */
- public FieldType getType() {
- return type;
- }
-
- /**
- * @param type
- * the type to set
- */
- public void setType(FieldType type) {
- this.type = type;
- }
-
- /**
- * @return the funcs
- */
- public List<MappingFunc> getFuncs() {
- return funcs;
- }
-
- /**
- * @param funcs
- * the funcs to set
- */
- public void setFuncs(List<MappingFunc> funcs) {
- this.funcs = funcs;
- }
-
- @Override
- public String toString() {
- return "[name=" + this.name + ",dbname=" + this.dbName + ",constant_value=" + this.constantValue + ",table_name="
- + this.tableName + ",scope=" + (this.scope.equals(FieldScope.RETURN) ? "return" : "query") + ",type=" + (
- this.type.equals(FieldType.CONSTANT) ? "constant" : "dynamic") + ",funcs=" + printClassNames(this.funcs)
- + ",string=" + String.valueOf(this.string) + "]";
- }
-
- private String printClassNames(List<MappingFunc> funcs) {
- StringBuilder buf = new StringBuilder();
-
- if (funcs == null || (funcs.size() == 0)) {
- return "";
- } else {
- for (MappingFunc func : funcs) {
- buf.append(func.getClass().getName());
- buf.append(",");
- }
-
- buf.deleteCharAt(buf.length() - 1);
-
- return buf.toString();
- }
- }
-
- /**
- * @return the string
- */
- public boolean isString() {
- return string;
- }
-
- /**
- * @param string
- * the string to set
- */
- public void setString(boolean string) {
- this.string = string;
- }
-
- /**
- * If dbname exists and is not empty, it is used as the field name.
- * If the table exists and is not empty,
- * return tableName.fieldName, otherwise return fieldName.
- * @return the column name understood by the local db
- */
- public String getLocalName() {
- String dbColName = getName();
- if (getDbName() != null && !getDbName().isEmpty()) {
- dbColName = getDbName();
- }
- if (getTableName() == null || getTableName().isEmpty()) {
- return dbColName;
- }
- return getTableName() + "." + dbColName;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/MappingReader.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/MappingReader.java b/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/MappingReader.java
deleted file mode 100644
index cf7ab3a..0000000
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/MappingReader.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.xmlps.mapping;
-
-//OODT imports
-
-import org.apache.oodt.commons.xml.XMLUtils;
-import org.apache.oodt.xmlps.exceptions.XmlpsException;
-import org.apache.oodt.xmlps.mapping.funcs.MappingFunc;
-import org.apache.oodt.xmlps.util.GenericCDEObjectFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.List;
-import java.util.Properties;
-import java.util.Vector;
-
-/**
- *
- * <p>
- * A static final reader class for reading {@link Mapping}s.
- * </p>
- * .
- */
-public final class MappingReader implements MappingReaderMetKeys {
-
- private MappingReader() throws InstantiationException {
- throw new InstantiationException("Don't construct reader objects!");
- }
-
- public static Mapping getMapping(InputStream is) throws XmlpsException {
- Document mappingDoc = XMLUtils.getDocumentRoot(is);
- Mapping map = new Mapping();
-
- Element rootElem = mappingDoc.getDocumentElement();
-
- map.setId(rootElem.getAttribute("id"));
- map.setName(rootElem.getAttribute("name"));
- readTables(rootElem, map);
- readFields(rootElem, map);
-
- return map;
-
- }
-
- public static Mapping getMapping(URL mappingUrl) throws IOException, XmlpsException {
- return getMapping(mappingUrl.openStream());
- }
-
- public static Mapping getMapping(String filePath) throws FileNotFoundException, XmlpsException {
- return getMapping(new FileInputStream(filePath));
-
- }
-
- private static void readTables(Element rootElem, Mapping map)
- throws XmlpsException {
- Element tblsElem = XMLUtils.getFirstElement(TABLES_OUTER_TAG, rootElem);
- if (tblsElem == null) {
- throw new XmlpsException("Unable to parse mapping XML file: [" + map.getName()
- + "]: reason: no defined tables tag element!");
-
- }
-
- String defaultTbl = tblsElem.getAttribute("default");
- // make sure that the default attribute is set
- if (defaultTbl == null || (defaultTbl.equals(""))) {
- throw new XmlpsException("Unable to parse mapping XML file: [" + map.getName()
- + "]: reason: there needs to be a default table defined "
- + "by the \"default\" attribute!");
- }
-
- map.setDefaultTable(defaultTbl);
-
- // get a list of all the tables, and process them one by one
- NodeList tableNodes = tblsElem.getElementsByTagName(TABLE_TAG);
- if (tableNodes != null && tableNodes.getLength() > 0) {
- for (int i = 0; i < tableNodes.getLength(); i++) {
- Element tableElem = (Element) tableNodes.item(i);
- DatabaseTable tbl = readTable(tableElem);
- if (tbl.getDefaultTableJoin() == null || tbl.getDefaultTableJoin().isEmpty()) {
- tbl.setDefaultTableJoin(map.getDefaultTable());
- }
- map.addTable(tbl.getName(), tbl);
- }
- }
- }
-
- private static DatabaseTable readTable(Element tableElem) {
- DatabaseTable tbl = new DatabaseTable();
- tbl.setJoinFieldName(tableElem.getAttribute(TABLE_ATTR_JOIN_FLD));
- tbl.setName(tableElem.getAttribute(TABLE_ATTR_NAME));
- tbl.setDefaultTableJoinFieldName(tableElem
- .getAttribute(TABLE_ATTR_BASE_TBL_JOIN_FLD));
- tbl.setDefaultTableJoin(tableElem
- .getAttribute(TABLE_ATTR_BASE_TBL_JOIN_TABLE));
- return tbl;
- }
-
- private static void readFields(Element rootElem, Mapping map) {
- NodeList fldNodes = rootElem.getElementsByTagName(FIELD_TAG);
-
- if (fldNodes != null && fldNodes.getLength() > 0) {
- for (int i = 0; i < fldNodes.getLength(); i++) {
- MappingField fld = readField((Element) fldNodes.item(i));
- if (fld.getTableName() == null || fld.getTableName().isEmpty()) {
- fld.setTableName(map.getDefaultTable());
- }
- map.addField(fld.getName(), fld);
- }
- }
-
- }
-
- private static MappingField readField(Element fldElem) {
- MappingField field = new MappingField();
- field.setTableName(fldElem.getAttribute(FIELD_ATTR_TABLE));
- field.setName(fldElem.getAttribute(FIELD_ATTR_NAME));
- field
- .setType(fldElem.getAttribute(FIELD_ATTR_TYPE).equals("dynamic") ? FieldType.DYNAMIC
- : FieldType.CONSTANT);
- field.setString(Boolean.valueOf(fldElem.getAttribute(FIELD_ATTR_STRING)));
- field.setConstantValue(fldElem.getAttribute(FIELD_ATTR_VALUE));
- field.setDbName(fldElem.getAttribute(FIELD_ATTR_DBNAME));
- if (fldElem.getAttribute(FIELD_ATTR_SCOPE) != null
- && !fldElem.getAttribute(FIELD_ATTR_SCOPE).equals("")) {
-
- field
- .setScope(fldElem.getAttribute(FIELD_ATTR_SCOPE).equals("query") ? FieldScope.QUERY
- : FieldScope.RETURN);
- }
-
- field.setFuncs(getTranslateFuncs(fldElem));
-
- return field;
-
- }
-
- private static List<MappingFunc> getTranslateFuncs(Element fldElem) {
- Element translateElem = XMLUtils.getFirstElement(FIELD_TRANSLATE_TAG,
- fldElem);
-
- List<MappingFunc> funcs = new Vector<MappingFunc>();
-
- if (translateElem != null) {
- // check for func tags
- NodeList funcNodes = translateElem.getElementsByTagName(FUNC_TAG);
- if (funcNodes != null && funcNodes.getLength() > 0) {
- for (int i = 0; i < funcNodes.getLength(); i++) {
- Element funcElem = (Element) funcNodes.item(i);
- funcs.add(getFunc(funcElem));
- }
- }
- }
-
- return funcs;
- }
-
- private static MappingFunc getFunc(Element funcElem) {
- String funcClass = funcElem.getAttribute(FUNC_ATTR_CLASS);
- MappingFunc func = GenericCDEObjectFactory
- .getMappingFuncFromClassName(funcClass);
-
- if (func != null) {
- func.configure(getPropsFromElementAttrs(funcElem.getAttributes()));
- }
-
- return func;
- }
-
- private static Properties getPropsFromElementAttrs(NamedNodeMap map) {
- Properties props = new Properties();
-
- if (map != null) {
- for (int i = 0; i < map.getLength(); i++) {
- Node mapNode = map.item(i);
- props.setProperty(mapNode.getNodeName(), mapNode.getNodeValue());
- }
- }
-
- return props;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/MappingReaderMetKeys.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/MappingReaderMetKeys.java b/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/MappingReaderMetKeys.java
deleted file mode 100644
index 09e617f..0000000
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/MappingReaderMetKeys.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.xmlps.mapping;
-
-/**
- *
- * <p>
- * Met Keys for the {@link MappingReader}
- * </p>.
- */
-public interface MappingReaderMetKeys {
-
- String FIELD_TAG = "field";
-
- String TABLES_OUTER_TAG = "tables";
-
- String TABLE_TAG = "table";
-
- String TABLE_ATTR_JOIN_FLD = "join";
-
- String TABLE_ATTR_BASE_TBL_JOIN_TABLE = "to";
-
- String TABLE_ATTR_BASE_TBL_JOIN_FLD = "tofld";
-
- String TABLE_ATTR_NAME = "name";
-
- String FIELD_ATTR_TYPE = "type";
-
- String FIELD_ATTR_NAME = "name";
-
- String FIELD_ATTR_DBNAME = "dbname";
-
- String FIELD_ATTR_SCOPE = "scope";
-
- String FIELD_ATTR_VALUE = "value";
-
- String FIELD_ATTR_TABLE = "table";
-
- String FIELD_ATTR_STRING = "string";
-
- String FIELD_TRANSLATE_TAG = "translate";
-
- String FUNC_TAG = "func";
-
- String FUNC_ATTR_CLASS = "class";
-
- String FIELD_ATTR_APPEND_TABLE_NAME = "appendTableName";
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/funcs/MappingFunc.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/funcs/MappingFunc.java b/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/funcs/MappingFunc.java
deleted file mode 100644
index 6849349..0000000
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/funcs/MappingFunc.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.xmlps.mapping.funcs;
-
-//JDK imports
-import java.util.Properties;
-
-//OODT imports
-import org.apache.oodt.xmlps.structs.CDEValue;
-
-/**
- *
- * <p>
- * A function to convert {@link CDEValue}s from a CDE domain vocabulary into a
- * SDE domain vocabulary
- * </p>.
- */
-public interface MappingFunc {
-
- /**
- * Translates the original CDE {@link CDEValue} into a local site's SDE
- * {@link CDEValue}.
- *
- * @param orig
- * The original {@link CDEValue} to translate.
- * @return The translated {@link CDEValue}.
- */
- CDEValue translate(CDEValue orig);
-
- /**
- * Translates the local site's SDE {@link CDEValue} back into its CDE
- * {@link CDEValue}.
- *
- * @param orig
- * The local site's SDE {@link CDEValue} to translate back into
- * a CDE.
- * @return The translated {@link CDEValue}.
- */
- CDEValue inverseTranslate(CDEValue orig);
-
- /**
- * Configures the MappingFunc with the appropriate {@link Properties}.
- *
- * @param props
- * The {@link Properties} to use to configure the MappingFunc.
- */
- void configure(Properties props);
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/funcs/ReplaceFunc.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/funcs/ReplaceFunc.java b/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/funcs/ReplaceFunc.java
deleted file mode 100644
index 80fb41f..0000000
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/funcs/ReplaceFunc.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.xmlps.mapping.funcs;
-
-//JDK imports
-import java.util.Properties;
-
-//OODT imports
-import org.apache.oodt.xmlps.structs.CDEValue;
-
-/**
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class ReplaceFunc implements MappingFunc {
-
- private String orig;
-
- private String with;
-
- public ReplaceFunc() {
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.oodt.xmlps.mapping.funcs.MappingFunc#translate(org.apache.oodt.xmlps.structs.CDEValue)
- */
- public CDEValue translate(CDEValue orig) {
- CDEValue cdeVal = new CDEValue(orig.getCdeName(), orig.getVal());
- String newVal = orig.getVal().equals(this.orig) ? with : orig.getVal();
- cdeVal.setVal(newVal);
- return cdeVal;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.oodt.xmlps.mapping.funcs.MappingFunc#configure(java.util.Properties)
- */
- public void configure(Properties props) {
- orig = props.getProperty("orig");
- with = props.getProperty("with");
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.oodt.xmlps.mapping.funcs.MappingFunc#inverseTranslate(org.apache.oodt.xmlps.structs.CDEValue)
- */
- public CDEValue inverseTranslate(CDEValue orig) {
- CDEValue cdeVal = new CDEValue(orig.getCdeName(), orig.getVal());
- String newVal = orig.getVal().equals(this.with) ? this.orig : orig
- .getVal();
- cdeVal.setVal(newVal);
- return cdeVal;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/main/java/org/apache/oodt/xmlps/product/DBMSExecutor.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/product/DBMSExecutor.java b/xmlps/src/main/java/org/apache/oodt/xmlps/product/DBMSExecutor.java
deleted file mode 100644
index 8046479..0000000
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/product/DBMSExecutor.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.xmlps.product;
-
-//OODT imports
-
-import org.apache.oodt.commons.database.DatabaseConnectionBuilder;
-import org.apache.oodt.xmlps.structs.CDEResult;
-
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.sql.DataSource;
-
-/**
- *
- * <p>
- * Executes CDE Queries against an underlying JDBC database, backed by Apache
- * commons-pool and commons-dbcp.
- * </p>
- * .
- */
-public class DBMSExecutor {
- private static Logger LOG = Logger.getLogger(DBMSExecutor.class.getName());
- private final DataSource dataSource;
-
- public DBMSExecutor() {
- String jdbcUrl = System.getProperty("xmlps.datasource.jdbc.url");
- String user = System.getProperty("xmlps.datasource.jdbc.user");
- String pass = System.getProperty("xmlps.datasource.jdbc.pass");
- String driver = System.getProperty("xmlps.datasource.jdbc.driver");
- dataSource = DatabaseConnectionBuilder.buildDataSource(user, pass, driver, jdbcUrl);
- }
-
- public CDEResult executeLocalQuery(String sql) throws SQLException {
- try {
- Connection conn = dataSource.getConnection();
- Statement statement = conn.createStatement();
- ResultSet rs = statement.executeQuery(sql);
- return new CDEResult(rs, conn);
- } catch (SQLException e) {
- LOG.log(Level.SEVERE, e.getMessage());
- throw e;
- }
- // do not close the Statement or Connection here
- // call CDEResult#close() to close ResultSet and Connection
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/main/java/org/apache/oodt/xmlps/product/XMLPSProductHandler.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/product/XMLPSProductHandler.java b/xmlps/src/main/java/org/apache/oodt/xmlps/product/XMLPSProductHandler.java
deleted file mode 100644
index efd5e58..0000000
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/product/XMLPSProductHandler.java
+++ /dev/null
@@ -1,390 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.xmlps.product;
-
-//OODT imports
-
-import org.apache.oodt.product.ProductException;
-import org.apache.oodt.product.QueryHandler;
-import org.apache.oodt.xmlps.exceptions.XmlpsException;
-import org.apache.oodt.xmlps.mapping.DatabaseTable;
-import org.apache.oodt.xmlps.mapping.FieldScope;
-import org.apache.oodt.xmlps.mapping.Mapping;
-import org.apache.oodt.xmlps.mapping.MappingField;
-import org.apache.oodt.xmlps.mapping.MappingReader;
-import org.apache.oodt.xmlps.mapping.funcs.MappingFunc;
-import org.apache.oodt.xmlps.queryparser.Expression;
-import org.apache.oodt.xmlps.queryparser.HandlerQueryParser;
-import org.apache.oodt.xmlps.structs.CDEResult;
-import org.apache.oodt.xmlps.structs.CDEValue;
-import org.apache.oodt.xmlps.util.XMLQueryHelper;
-import org.apache.oodt.xmlquery.QueryElement;
-import org.apache.oodt.xmlquery.XMLQuery;
-
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.Stack;
-import java.util.Vector;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- *
- * <p>
- * An XML configurable version of a Product Server that requires no code
- * to be written to plug into a local site's relational backend DBMS.
- * </p>.
- */
-public class XMLPSProductHandler implements QueryHandler {
-
- /* our log stream */
- private static final Logger LOG = Logger
- .getLogger(XMLPSProductHandler.class.getName());
-
- protected Mapping mapping;
-
- private DBMSExecutor executor;
-
- protected XMLPSProductHandler(String phony) {
- /* this is to get around invoking the default constructor in sub-classes */
- }
-
- public XMLPSProductHandler() throws InstantiationException {
- String MappingFilePath = System
- .getProperty("org.apache.oodt.xmlps.xml.mapFilePath");
-
- if (MappingFilePath == null) {
- throw new InstantiationException(
- "Need to specify path to xml mapping file!");
- }
-
- try {
- mapping = MappingReader.getMapping(MappingFilePath);
- } catch (Exception e) {
- throw new InstantiationException(
- "Unable to parse mapping xml file: ["
- + MappingFilePath + "]: reason: "
- + e.getMessage());
- }
-
- /* load the db properties file */
- /*
- * if one exists: otherwise, don't bother and just print out the SQL to
- * the console.
- */
- String dbPropFilePath = System
- .getProperty("org.apache.oodt.xmlps.xml.dbPropFilePath");
- if (dbPropFilePath != null) {
- try {
- System.getProperties()
- .load(new FileInputStream(dbPropFilePath));
- } catch (FileNotFoundException e) {
- // TODO Auto-generated catch block
- LOG.log(Level.SEVERE, e.getMessage());
- } catch (IOException e) {
- LOG.log(Level.SEVERE, e.getMessage());
- throw new InstantiationException(e.getMessage());
- }
-
- executor = new DBMSExecutor();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.oodt.product.QueryHandler#query(org.apache.oodt.xmlquery.XMLQuery)
- */
- public XMLQuery query(XMLQuery query) throws ProductException {
- List<QueryElement> whereSet = query.getWhereElementSet();
- List<QueryElement> selectSet = query.getSelectElementSet();
- try {
- translateToDomain(selectSet, true);
- translateToDomain(whereSet, false);
- } catch (Exception e) {
- LOG.severe(e.getMessage());
- throw new ProductException(e.getMessage());
- }
-
- queryAndPackageResults(query);
-
- return query;
- }
-
- public static void main(String[] args) throws InstantiationException, ProductException {
- String usage = "XMLPSProductHandler <query>\n";
-
- if (args.length != 1) {
- System.err.println(usage);
- System.exit(1);
- }
-
- XMLPSProductHandler handler = new XMLPSProductHandler();
- XMLQuery q = handler.query(XMLQueryHelper
- .getDefaultQueryFromQueryString(args[0]));
- System.out.println(q.getXMLDocString());
- }
-
- protected List<QueryElement> getElemNamesFromQueryElemSet(
- List<QueryElement> origSet) {
- if (origSet == null || (origSet.size() == 0)) {
- return Collections.emptyList();
- }
-
- List<QueryElement> newSet = new Vector<QueryElement>();
-
- for (QueryElement elem : origSet) {
- if (elem.getRole().equals(XMLQueryHelper.ROLE_ELEMNAME)
- && !mapping.constantField(elem.getValue())) {
- newSet.add(elem);
-
- }
-
- }
-
- return newSet;
-
- }
-
- protected List<QueryElement> getConstElemNamesFromQueryElemSet(
- List<QueryElement> origSet) {
- if (origSet == null || (origSet.size() == 0)) {
- return Collections.emptyList();
- }
-
- List<QueryElement> newSet = new Vector<QueryElement>();
-
- for (QueryElement elem : origSet) {
- if (elem.getRole().equals(XMLQueryHelper.ROLE_ELEMNAME)
- && mapping.constantField(elem.getValue())) {
- newSet.add(elem);
- }
- }
-
- return newSet;
- }
-
- protected void queryAndPackageResults(XMLQuery query) {
- Stack<QueryElement> queryStack = HandlerQueryParser
- .createQueryStack(query.getWhereElementSet());
- Expression parsedQuery = HandlerQueryParser.parse(queryStack,
- this.mapping);
- List<QueryElement> selectNames = getElemNamesFromQueryElemSet(query
- .getSelectElementSet());
-
- String querySelectNames = toSQLSelectColumns(selectNames);
-
- StringBuilder sqlBuf = new StringBuilder("SELECT ");
- sqlBuf.append(querySelectNames);
- sqlBuf.append(" FROM ");
- sqlBuf.append(mapping.getDefaultTable());
- sqlBuf.append(" ");
-
- if (mapping.getNumTables() > 0) {
- List<QueryElement> whereNames = getElemNamesFromQueryElemSet(query.getWhereElementSet());
- Set<DatabaseTable> requiredTables = getRequiredTables(whereNames, selectNames);
- for (DatabaseTable tbl : requiredTables) {
- sqlBuf.append("INNER JOIN ");
- sqlBuf.append(tbl.getName());
- sqlBuf.append(" ON ");
- sqlBuf.append(tbl.getName());
- sqlBuf.append(".");
- sqlBuf.append(tbl.getJoinFieldName());
- sqlBuf.append(" = ");
- sqlBuf.append(tbl.getDefaultTableJoin());
- sqlBuf.append(".");
- sqlBuf.append(tbl.getDefaultTableJoinFieldName());
- sqlBuf.append(" ");
- }
- }
-
- if(parsedQuery != null){
- sqlBuf.append(" WHERE ");
- sqlBuf.append(parsedQuery.evaluate());
- }
-
- LOG.log(Level.INFO, sqlBuf.toString());
-
- if (executor != null) {
- try {
- CDEResult res = executor.executeLocalQuery(sqlBuf.toString());
- res.setOrderedFields(query.getSelectElementSet());
- res.setMapping(mapping);
- res.setConstValues(getConstValuesForQuery(query));
- query.getResults().add(res);
- } catch (SQLException e) {
- LOG.log(Level.SEVERE, e.getMessage());
- LOG.log(Level.WARNING, "Error executing sql: ["
- + sqlBuf.toString() + "]: Message: " + e.getMessage());
- }
- }
-
- }
-
- private List<CDEValue> getConstValuesForQuery(XMLQuery query) {
- List<QueryElement> select = query.getSelectElementSet();
- List<QueryElement> constNames = getConstElemNamesFromQueryElemSet(select);
- List<CDEValue> constValues = new ArrayList<CDEValue>();
- if (constNames != null) {
- for (QueryElement qe : constNames) {
- MappingField fld = mapping.getFieldByLocalName(qe.getValue());
- if (fld != null) {
- constValues.add(new CDEValue(fld.getName(), fld.getConstantValue()));
- }
- }
- }
- return constValues;
- }
-
- private String toSQLSelectColumns(List<QueryElement> elems) {
- if (elems == null || (elems.size() == 0)) {
- return null;
- }
-
- StringBuilder buf = new StringBuilder();
- for (QueryElement qe : elems) {
- MappingField fld = this.mapping.getFieldByLocalName(qe.getValue());
- if (fld != null) {
- buf.append(fld.getLocalName());
- buf.append(" as ");
- buf.append(fld.getName());
- buf.append(",");
- }
- }
-
- buf.deleteCharAt(buf.length() - 1);
-
- return buf.toString();
- }
-
- protected void translateToDomain(List<QueryElement> elemSet,
- boolean selectSet) throws XmlpsException {
- // go through each query element: use the mapping fields
- // to translate the names
-
- for (Iterator<QueryElement> i = elemSet.iterator(); i.hasNext();) {
- QueryElement elem = i.next();
- if (elem.getRole().equals(XMLQueryHelper.ROLE_ELEMNAME)) {
- // do the translation
- String elemValue = elem.getValue();
- MappingField fld = this.mapping.getFieldByName(elemValue);
- // make sure fld is not null
- if (fld == null) {
- continue;
- }
-
- // make sure scope is null, or if it's not null, then it's
- // FieldScope.QUERY
-
- if (fld.getScope() != null
- && fld.getScope().equals(FieldScope.RETURN)) {
- // skip
- continue;
- }
-
- // check to see if it has a dbname attr, if not, then the name
- // stays
- // the same
- String newFldName = fld.getLocalName();
-
- elem.setValue(newFldName);
-
- // now translate the domain vocab if there are translate funcs
- // present and this isn't the select set
-
- if (!selectSet && fld.getFuncs() != null
- && fld.getFuncs().size() > 0) {
- // the next query element should be
- // XMLQueryHelper.ROLE_LITERAL
- if (!i.hasNext()) {
- break;
- }
- QueryElement litElem = i.next();
- if (!litElem.getRole().equals(XMLQueryHelper.ROLE_LITERAL)) {
- throw new XmlpsException("next query element not "
- + XMLQueryHelper.ROLE_LITERAL + "! role is "
- + litElem.getRole() + " instead!");
- }
-
- for (MappingFunc func : fld.getFuncs()) {
- CDEValue origVal = new CDEValue(fld.getName(),
- litElem.getValue());
- CDEValue newVal = func.inverseTranslate(origVal);
- litElem.setValue(newVal.getVal());
- }
-
- }
-
- }
- }
-
- }
-
- protected Set<DatabaseTable> getRequiredTables(
- List<QueryElement> whereElemNames, List<QueryElement> selectElemNames) {
- Set<DatabaseTable> tables = new HashSet<DatabaseTable>();
- // add tables from where element set
- if (whereElemNames != null) {
- for (QueryElement qe : whereElemNames) {
- MappingField fld = mapping.getFieldByLocalName(qe.getValue());
- if (fld != null) {
- DatabaseTable t = mapping.getTableByName(fld.getTableName());
- if (t != null && !tables.contains(t) && !t.getName().equals(mapping.getDefaultTable())) {
- tables.add(t);
- }
- }
- }
- }
- // add tables from select element set
- if (selectElemNames != null) {
- for (QueryElement qe : selectElemNames) {
- MappingField fld = mapping.getFieldByLocalName(qe.getValue());
- if (fld != null) {
- DatabaseTable t = mapping.getTableByName(fld.getTableName());
- if (t != null && !tables.contains(t) && !t.getName().equals(mapping.getDefaultTable())) {
- tables.add(t);
- }
- }
- }
- }
- // the tables found may be joined on columns from tables we haven't found
- // yet
- // add additional required join tables
- Set<DatabaseTable> moreTables = new HashSet<DatabaseTable>(tables);
- for (DatabaseTable t : tables) {
- DatabaseTable join = mapping.getTableByName(t.getDefaultTableJoin());
- // recursively add all join tables until we get to either
- // (a) the mapping default table (join == null)
- // (b) or a table already found (moreTables.contains(join))
- while (join != null && !moreTables.contains(join) && !join.getName().equals(mapping.getDefaultTable())) {
- moreTables.add(join);
- join = mapping.getTableByName(join.getDefaultTableJoin());
- }
- }
- return moreTables;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/main/java/org/apache/oodt/xmlps/profile/DBMSExecutor.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/profile/DBMSExecutor.java b/xmlps/src/main/java/org/apache/oodt/xmlps/profile/DBMSExecutor.java
deleted file mode 100644
index bd9d70f..0000000
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/profile/DBMSExecutor.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.xmlps.profile;
-
-//OODT imports
-import org.apache.oodt.cas.metadata.Metadata;
-import org.apache.oodt.cas.metadata.util.PathUtils;
-import org.apache.oodt.commons.database.DatabaseConnectionBuilder;
-import org.apache.oodt.profile.EnumeratedProfileElement;
-import org.apache.oodt.profile.Profile;
-import org.apache.oodt.profile.ProfileAttributes;
-import org.apache.oodt.profile.ProfileElement;
-import org.apache.oodt.profile.ResourceAttributes;
-import org.apache.oodt.xmlps.mapping.FieldType;
-import org.apache.oodt.xmlps.mapping.Mapping;
-import org.apache.oodt.xmlps.mapping.MappingField;
-import org.apache.oodt.xmlps.mapping.funcs.MappingFunc;
-import org.apache.oodt.xmlps.structs.CDEValue;
-
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.List;
-import java.util.Vector;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.sql.DataSource;
-
-/**
- *
- * <p>
- * Executes Profile Queries against an underlying JDBC database, backed by
- * Apache commons-pool and commons-dbcp.
- * </p>
- * .
- */
-public class DBMSExecutor {
-
- private final DataSource dataSource;
-
- private static final Logger LOG = Logger.getLogger(DBMSExecutor.class
- .getName());
-
- public DBMSExecutor() {
- String jdbcUrl = System.getProperty("xmlps.datasource.jdbc.url");
- String user = System.getProperty("xmlps.datasource.jdbc.user");
- String pass = System.getProperty("xmlps.datasource.jdbc.pass");
- String driver = System.getProperty("xmlps.datasource.jdbc.driver");
- try {
- Class.forName(driver);
- } catch (ClassNotFoundException ignore) {
- }
-
- this.dataSource = DatabaseConnectionBuilder.buildDataSource(user, pass,
- driver, jdbcUrl);
-
- }
-
- public List<Profile> executeLocalQuery(Mapping map, String sql,
- String resLocationSpec) throws SQLException {
- Connection conn = null;
- Statement statement = null;
-
- List<Profile> profiles = null;
-
- try {
- conn = dataSource.getConnection();
- statement = conn.createStatement();
- ResultSet rs = statement.executeQuery(sql);
-
- profiles = new Vector<Profile>();
-
- while (rs.next()) {
- Profile prof = toProfile(rs, map, resLocationSpec);
- profiles.add(prof);
- }
-
- } catch (SQLException e) {
- LOG.log(Level.SEVERE, e.getMessage());
- throw e;
- } finally {
- if (statement != null) {
- try {
- statement.close();
- } catch (Exception ignore) {
- }
-
- }
-
- if (conn != null) {
- try {
- conn.close();
- } catch (Exception ignore) {
- }
-
- }
- }
-
- return profiles;
-
- }
-
- @SuppressWarnings("unchecked")
- private Profile toProfile(ResultSet rs, Mapping map, String resLocationSpec) {
- Profile profile = new Profile();
- ResourceAttributes resAttr = profile.getResourceAttributes();
- ProfileAttributes profAttr = profile.getProfileAttributes();
- resAttr.setResClass("system.profile");
- profAttr.setStatusID("active");
- profAttr.setType("profile");
-
- Metadata met = new Metadata();
-
- for (String fldName : map.getFieldNames()) {
- MappingField fld = map.getFieldByName(fldName);
- ProfileElement elem = new EnumeratedProfileElement(profile);
- elem.setName(fld.getName());
-
- try {
- if (fld.getType().equals(FieldType.CONSTANT)) {
- elem.getValues().add(fld.getConstantValue());
- } else {
- String elemDbVal = rs.getString(fld.getDbName());
- for (MappingFunc func : fld.getFuncs()) {
- CDEValue origVal = new CDEValue(fld.getName(), elemDbVal);
- CDEValue newVal = func.translate(origVal);
- elemDbVal = newVal.getVal();
- }
-
- elem.getValues().add(elemDbVal);
- }
- } catch (SQLException e) {
- LOG.log(Level.SEVERE, e.getMessage());
- LOG.log(Level.WARNING, "Unable to obtain field: ["
- + fld.getLocalName() + "] from result set: message: "
- + e.getMessage());
- }
-
- met.addMetadata(elem.getName(), (String) elem.getValues().get(0));
-
- profile.getProfileElements().put(fld.getName(), elem);
- }
-
- if (resLocationSpec != null) {
- resAttr.getResLocations().add(
- PathUtils.replaceEnvVariables(resLocationSpec, met));
- }
-
- return profile;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/main/java/org/apache/oodt/xmlps/profile/XMLPSProfileHandler.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/profile/XMLPSProfileHandler.java b/xmlps/src/main/java/org/apache/oodt/xmlps/profile/XMLPSProfileHandler.java
deleted file mode 100644
index fd7150a..0000000
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/profile/XMLPSProfileHandler.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.xmlps.profile;
-
-import org.apache.oodt.profile.Profile;
-import org.apache.oodt.profile.ProfileException;
-import org.apache.oodt.profile.handlers.ProfileHandler;
-import org.apache.oodt.xmlps.exceptions.XmlpsException;
-import org.apache.oodt.xmlps.mapping.DatabaseTable;
-import org.apache.oodt.xmlps.mapping.MappingReader;
-import org.apache.oodt.xmlps.product.XMLPSProductHandler;
-import org.apache.oodt.xmlps.queryparser.Expression;
-import org.apache.oodt.xmlps.queryparser.HandlerQueryParser;
-import org.apache.oodt.xmlquery.QueryElement;
-import org.apache.oodt.xmlquery.XMLQuery;
-
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.sql.SQLException;
-import java.util.List;
-import java.util.Stack;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-
-/**
- *
- * <p>
- * An implementation of a {@link ProfileHandler} that extends the capabilities
- * of the {@link XMLPSProductHandler}, and uses the XML Specification defined
- * by the mapping file to represent its field mapping information.
- * </p>.
- */
-public class XMLPSProfileHandler extends XMLPSProductHandler implements
- ProfileHandler {
-
- private DBMSExecutor executor;
-
- /* our log stream */
- private static final Logger LOG = Logger.getLogger(XMLPSProfileHandler.class
- .getName());
-
- private String resLocationSpec;
-
- public XMLPSProfileHandler() throws InstantiationException {
- super(null);
- String mappingFilePath = System
- .getProperty("org.apache.oodt.xmlps.profile.xml.mapFilePath");
-
- if (mappingFilePath == null) {
- throw new InstantiationException(
- "Need to specify path to xml mapping file!");
- }
-
- try {
- mapping = MappingReader.getMapping(mappingFilePath);
- } catch (Exception e) {
- throw new InstantiationException(
- "Unable to parse profile mapping xml file: ["
- + mappingFilePath + "]: reason: "
- + e.getMessage());
- }
-
- // load the db properties file
- // if one exists: otherwise, don't bother and just print out the SQL to
- // the console.
- //
- String dbPropFilePath = System
- .getProperty("org.apache.oodt.xmlps.profile.xml.dbPropFilePath");
- if (dbPropFilePath != null) {
- try {
- System.getProperties()
- .load(new FileInputStream(dbPropFilePath));
- } catch (FileNotFoundException e) {
- // TODO Auto-generated catch block
- LOG.log(Level.SEVERE, e.getMessage());
- } catch (IOException e) {
- LOG.log(Level.SEVERE, e.getMessage());
- throw new InstantiationException(e.getMessage());
- }
-
- executor = new DBMSExecutor();
- }
-
- this.resLocationSpec = System
- .getProperty("org.apache.oodt.xmlps.profile.xml.resLocationSpec");
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.oodt.profile.handlers.ProfileHandler#findProfiles(org.apache.oodt.xmlquery.XMLQuery)
- */
- public List<Profile> findProfiles(XMLQuery query) throws ProfileException {
- List<QueryElement> whereSet = query.getWhereElementSet();
- List<QueryElement> selectSet = query.getSelectElementSet();
- try {
- translateToDomain(selectSet, true);
- translateToDomain(whereSet, false);
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- throw new ProfileException(e.getMessage());
- }
- return queryAndPackageProfiles(query);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.oodt.profile.handlers.ProfileHandler#get(java.lang.String)
- */
- public Profile get(String id) throws ProfileException {
- throw new ProfileException("Method not implemented!");
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.oodt.profile.handlers.ProfileHandler#getID()
- */
- public String getID() {
- return mapping.getId();
- }
-
- protected List<Profile> queryAndPackageProfiles(XMLQuery query) {
- Stack<QueryElement> queryStack = HandlerQueryParser
- .createQueryStack(query.getWhereElementSet());
- Expression parsedQuery = HandlerQueryParser.parse(queryStack,
- this.mapping);
- List<Profile> profs = null;
-
- StringBuilder sqlBuf = new StringBuilder("SELECT *");
- sqlBuf.append(" FROM ");
- sqlBuf.append(mapping.getDefaultTable());
- sqlBuf.append(" ");
-
- if (mapping.getNumTables() > 0) {
- for (String tableName : mapping.getTableNames()) {
- if (tableName.equals(mapping.getDefaultTable())) {
- continue;
- }
- DatabaseTable tbl = mapping.getTableByName(tableName);
- sqlBuf.append("INNER JOIN ");
- sqlBuf.append(tbl.getName());
- sqlBuf.append(" ON ");
- sqlBuf.append(tbl.getName());
- sqlBuf.append(".");
- sqlBuf.append(tbl.getJoinFieldName());
- sqlBuf.append(" = ");
- sqlBuf.append(tbl.getDefaultTableJoin());
- sqlBuf.append(".");
- sqlBuf.append(tbl.getDefaultTableJoinFieldName());
- sqlBuf.append(" ");
- }
- }
-
- if (parsedQuery != null) {
- sqlBuf.append(" WHERE ");
- sqlBuf.append(parsedQuery.evaluate());
- }
-
- LOG.log(Level.INFO, sqlBuf.toString());
-
- if (executor != null) {
- try {
- profs = executor.executeLocalQuery(this.mapping, sqlBuf
- .toString(), this.resLocationSpec);
-
- } catch (SQLException e) {
- LOG.log(Level.SEVERE, e.getMessage());
- LOG.log(Level.WARNING, "Error executing sql: ["
- + sqlBuf.toString() + "]: Message: " + e.getMessage());
- }
- }
-
- return profs;
- }
-
- protected void translateToDomain(List<QueryElement> elemSet,
- boolean selectSet) throws XmlpsException {
- super.translateToDomain(elemSet, selectSet);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/AndExpression.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/AndExpression.java b/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/AndExpression.java
deleted file mode 100644
index dc97b00..0000000
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/AndExpression.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.xmlps.queryparser;
-
-/**
- *
- * <p>A logical and expression</p>.
- */
-public class AndExpression extends LogOpExpression implements ParseConstants{
-
- public AndExpression(Expression lhs, Expression rhs) {
- super(SQL_AND, lhs, rhs);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/ContainsExpression.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/ContainsExpression.java b/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/ContainsExpression.java
deleted file mode 100644
index b12ef63..0000000
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/ContainsExpression.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.xmlps.queryparser;
-
-/**
- *
- * A logical contains expression.
- */
-public class ContainsExpression extends RelOpExpression implements ParseConstants {
-
- public ContainsExpression(String lhs, Expression literal) {
- super(SQL_LIKE, lhs, literal);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/EqualsExpression.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/EqualsExpression.java b/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/EqualsExpression.java
deleted file mode 100644
index bfc3aaf..0000000
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/EqualsExpression.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.xmlps.queryparser;
-
-/**
- *
- * Operator equals expression.
- */
-public class EqualsExpression extends RelOpExpression implements ParseConstants {
-
- public EqualsExpression(String lhs, Expression literal) {
- super(SQL_EQUAL, lhs, literal);
- }
-
-}
[06/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/util/ExpressionValidator.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/util/ExpressionValidator.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/util/ExpressionValidator.java
deleted file mode 100644
index 0e821d6..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/util/ExpressionValidator.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.util;
-
-//AWT Imports
-
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.GridLayout;
-import java.awt.Toolkit;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.swing.BorderFactory;
-import javax.swing.JButton;
-import javax.swing.JFormattedTextField;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.SwingUtilities;
-
-//Swing Imports
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>Use to evaluate whether your regular expressions are
- * accepting the correct strings
- * </p>.
- */
-public class ExpressionValidator extends JPanel {
- private static Logger LOG = Logger.getLogger(ExpressionValidator.class.getName());
- private static final long serialVersionUID = -2840589940304298547L;
-
- private JLabel exprLabel;
- private JLabel validateLabel;
- private JLabel resultLabel;
-
- private JFormattedTextField exprField;
- private JFormattedTextField validateField;
- private JFormattedTextField resultField;
-
- public ExpressionValidator() {
- super(new BorderLayout());
-
- exprLabel = new JLabel("Regular Expression: ");
- validateLabel = new JLabel("Validate String: ");
- resultLabel = new JLabel("Result: ");
-
- exprField = new JFormattedTextField();
- exprField.setColumns(60);
-
- validateField = new JFormattedTextField();
- validateField.setColumns(60);
-
- resultField = new JFormattedTextField();
- resultField.setColumns(60);
- resultField.setEditable(false);
- resultField.setForeground(Color.red);
-
- exprLabel.setLabelFor(exprField);
- validateLabel.setLabelFor(validateField);
- resultLabel.setLabelFor(resultField);
-
- JPanel labelPane = new JPanel(new GridLayout(0, 1));
- labelPane.add(exprLabel);
- labelPane.add(validateLabel);
- labelPane.add(resultLabel);
-
- JPanel fieldPane = new JPanel(new GridLayout(0, 1));
- fieldPane.add(exprField);
- fieldPane.add(validateField);
- fieldPane.add(resultField);
-
- JPanel buttonPane = new JPanel(new BorderLayout());
- JButton validate = new JButton("Validate");
- validate.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent event) {
- try {
- boolean value = ((String) validateField.getText()).matches((String) exprField.getText());
- resultField.setText(value + "");
- }catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- }
- }
- });
- buttonPane.add(validate, BorderLayout.EAST);
-
- setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
- add(labelPane, BorderLayout.WEST);
- add(fieldPane, BorderLayout.CENTER);
- add(buttonPane, BorderLayout.EAST);
- }
-
- public static void main(String[] args) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
- JFrame frame = new JFrame("Regular Expression Evaluator");
- frame.setSize(dim.width / 2, dim.height / 2);
- frame.setLocation(dim.width / 3, dim.height / 3);
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- frame.add(new ExpressionValidator());
- frame.pack();
- frame.setVisible(true);
- }
- });
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/resources/REMOVE.log
----------------------------------------------------------------------
diff --git a/pushpull/src/main/resources/REMOVE.log b/pushpull/src/main/resources/REMOVE.log
deleted file mode 100644
index cb27d16..0000000
--- a/pushpull/src/main/resources/REMOVE.log
+++ /dev/null
@@ -1,18 +0,0 @@
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-
-You can remove this file. It was only included to ensure that the log directory for this
-distribution was created on assembly.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/resources/default.properties
----------------------------------------------------------------------
diff --git a/pushpull/src/main/resources/default.properties b/pushpull/src/main/resources/default.properties
deleted file mode 100644
index a50664d..0000000
--- a/pushpull/src/main/resources/default.properties
+++ /dev/null
@@ -1,21 +0,0 @@
-# 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.
-
-#-------------------------------------------------------#
-#-----------------Protocol Defaults---------------------#
-#-------------------------------------------------------#
-
-#configuration to make java.net.URL accept unsupported protocols
-java.protocol.handler.pkgs=org.apache.oodt.cas.pushpull.url.handlers
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/resources/documentation/Push-Pull-User-Manual_2008-02-12.doc
----------------------------------------------------------------------
diff --git a/pushpull/src/main/resources/documentation/Push-Pull-User-Manual_2008-02-12.doc b/pushpull/src/main/resources/documentation/Push-Pull-User-Manual_2008-02-12.doc
deleted file mode 100755
index 5fb5e28..0000000
Binary files a/pushpull/src/main/resources/documentation/Push-Pull-User-Manual_2008-02-12.doc and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/resources/examples/ClassNoaaEmailParserFiles/IasiEmail
----------------------------------------------------------------------
diff --git a/pushpull/src/main/resources/examples/ClassNoaaEmailParserFiles/IasiEmail b/pushpull/src/main/resources/examples/ClassNoaaEmailParserFiles/IasiEmail
deleted file mode 100644
index 7141348..0000000
--- a/pushpull/src/main/resources/examples/ClassNoaaEmailParserFiles/IasiEmail
+++ /dev/null
@@ -1,129 +0,0 @@
-
-
- NOAA COMPREHENSIVE LARGE ARRAY-DATA STEWARDSHIP SYSTEM
-
- A SERVICE OF:
- NOAA NATIONAL DATA CENTERS
-
-
-The CLASS has processed your order number A1040663. The total size of
-this order is 1246002618 bytes.
-
-
-Items are available for you in the anonymous FTP area.
-You may obtain them as follows:
-
- ftp ftp.class.noaa.gov - Logon to CLASS system
- anonymous - login userid
- user@internet - enter your internet address as a password
- binary - changes transfer mode to binary
- cd A1040663 - changes to correct directory
- get
-IASI_xxx_1C_M02_20070803000257Z_20070803000553Z_N_O_20070803013826Z__20070803014
-346
- - copies data; size is 60242714 bytes
- get
-IASI_xxx_1C_M02_20070802235953Z_20070803000257Z_N_O_20070803013555Z__20070803014
-041
- - copies data; size is 62970482 bytes
- get
-IASI_xxx_1C_M02_20070803000553Z_20070803000857Z_N_O_20070803014058Z__20070803014
-616
- - copies data; size is 62970482 bytes
- get
-IASI_xxx_1C_M02_20070803000857Z_20070803000953Z_N_O_20070803014332Z__20070803014
-646
- - copies data; size is 19326194 bytes
- get
-IASI_xxx_1C_M02_20070803001218Z_20070803001457Z_N_O_20070803014438Z__20070803014
-957
- - copies data; size is 54787178 bytes
- get
-IASI_xxx_1C_M02_20070803001458Z_20070803001753Z_N_O_20070803014619Z__20070803015
-222
- - copies data; size is 60242714 bytes
- get
-IASI_xxx_1C_M02_20070803001754Z_20070803002057Z_N_O_20070803014825Z__20070803015
-507
- - copies data; size is 62970482 bytes
- get
-IASI_xxx_1C_M02_20070803002058Z_20070803002353Z_N_O_20070803015110Z__20070803015
-742
- - copies data; size is 60242714 bytes
- get
-IASI_xxx_1C_M02_20070803002354Z_20070803002657Z_N_O_20070803015337Z__20070803020
-042
- - copies data; size is 62970482 bytes
- get
-IASI_xxx_1C_M02_20070803002658Z_20070803002953Z_N_O_20070803015605Z__20070803020
-202
- - copies data; size is 60242714 bytes
- get
-IASI_xxx_1C_M02_20070803002954Z_20070803003257Z_N_O_20070803021709Z__20070803022
-207
- - copies data; size is 62970482 bytes
- get
-IASI_xxx_1C_M02_20070803004458Z_20070803004753Z_N_O_20070803022947Z__20070803023
-437
- - copies data; size is 60242714 bytes
- get
-IASI_xxx_1C_M02_20070803003554Z_20070803003857Z_N_O_20070803022252Z__20070803022
-802
- - copies data; size is 62970482 bytes
- get
-IASI_xxx_1C_M02_20070803003858Z_20070803004153Z_N_O_20070803022515Z__20070803023
-102
- - copies data; size is 60242714 bytes
- get
-IASI_xxx_1C_M02_20070803004154Z_20070803004457Z_N_O_20070803022746Z__20070803023
-352
- - copies data; size is 62970482 bytes
- get
-IASI_xxx_1C_M02_20070803003258Z_20070803003553Z_N_O_20070803021943Z__20070803022
-507
- - copies data; size is 60242714 bytes
- get
-IASI_xxx_1C_M02_20070803005058Z_20070803005353Z_N_O_20070803023436Z__20070803024
-017
- - copies data; size is 60242714 bytes
- get
-IASI_xxx_1C_M02_20070803005354Z_20070803005657Z_N_O_20070803023700Z__20070803024
-132
- - copies data; size is 62970482 bytes
- get
-IASI_xxx_1C_M02_20070803005658Z_20070803005953Z_N_O_20070803023936Z__20070803024
-357
- - copies data; size is 60242714 bytes
- get
-IASI_xxx_1C_M02_20070803005954Z_20070803010257Z_N_O_20070803024159Z__20070803024
-657
- - copies data; size is 62970482 bytes
- get
-IASI_xxx_1C_M02_20070803004754Z_20070803005057Z_N_O_20070803023212Z__20070803023
-737
- - copies data; size is 62970482 bytes
- bye (or quit) - to end ftp session.
-
-Alternatively, you can also pick up your data set via
-ftp://ftp.class.noaa.gov/A1040663/
- or
-http://www.class.noaa.gov/download/A1040663
-
-NOTE: You must pick up your data within 120 hours of this notice.
-
-
-
-
-Thank you.
-
-
-<< DO NOT reply to this e-mail as it is automatically generated. >>
-<< Please direct questions to the Help Desk: >>
-
-
- NOAA/CLASS User Assistance
- National Climatic Data Center
- 151 Patton Avenue
- Asheville, NC 28801-5001
-
- Internet: info@class.noaa.gov
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/resources/examples/DirStructXmlParserFiles/AIRABRAD.xml
----------------------------------------------------------------------
diff --git a/pushpull/src/main/resources/examples/DirStructXmlParserFiles/AIRABRAD.xml b/pushpull/src/main/resources/examples/DirStructXmlParserFiles/AIRABRAD.xml
deleted file mode 100644
index d7b0491..0000000
--- a/pushpull/src/main/resources/examples/DirStructXmlParserFiles/AIRABRAD.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<root>
- <dirstruct starting_path="/ftp/data/s4pa/Aqua_AIRS_Level1/AIRABRAD.005/2006">
- <nofiles/>
- <dir name="\d{3}">
- <nodirs/>
- <file name="AIRS\.2006\.\d{2}\.\d{2}\.\d{3}.L1B.AMSU_Rad\.v5\.0\.0\.0\.G\d{11}\.hdf(\.xml){0,1}"/>
- </dir>
- </dirstruct>
-</root>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/resources/examples/DirStructXmlParserFiles/AIRS3ST8.xml
----------------------------------------------------------------------
diff --git a/pushpull/src/main/resources/examples/DirStructXmlParserFiles/AIRS3ST8.xml b/pushpull/src/main/resources/examples/DirStructXmlParserFiles/AIRS3ST8.xml
deleted file mode 100644
index bae8cea..0000000
--- a/pushpull/src/main/resources/examples/DirStructXmlParserFiles/AIRS3ST8.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<root>
- <dirstruct starting_path="/data/s4pa/Aqua_AIRS_Level3/AIRS3ST8.005/2007">
- <nodirs/>
- <file name="AIRS\.2007.\d{2}.\d{2}.L3.RetStd_IR008\.v5\.0\.14\.0\.G\d{11}\.hdf(\.xml){0,1}"/>
- </dirstruct>
-</root>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/resources/examples/DirStructXmlParserFiles/AIRS3STD.xml
----------------------------------------------------------------------
diff --git a/pushpull/src/main/resources/examples/DirStructXmlParserFiles/AIRS3STD.xml b/pushpull/src/main/resources/examples/DirStructXmlParserFiles/AIRS3STD.xml
deleted file mode 100644
index 8b45a34..0000000
--- a/pushpull/src/main/resources/examples/DirStructXmlParserFiles/AIRS3STD.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<root>
- <dirstruct starting_path="/data/s4pa/Aqua_AIRS_Level3/AIRS3STD.005/2007">
- <nodirs/>
- <file name="AIRS\.2007.\d{2}.\d{2}.L3.RetStd_IR001\.v5\.0\.14\.0\.G\d{11}\.hdf(\.xml){0,1}"/>
- </dirstruct>
-</root>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/resources/examples/DirStructXmlParserFiles/CLASS_Email.xml
----------------------------------------------------------------------
diff --git a/pushpull/src/main/resources/examples/DirStructXmlParserFiles/CLASS_Email.xml b/pushpull/src/main/resources/examples/DirStructXmlParserFiles/CLASS_Email.xml
deleted file mode 100644
index 0c55af3..0000000
--- a/pushpull/src/main/resources/examples/DirStructXmlParserFiles/CLASS_Email.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<root>
- <dirstruct starting_path="INBOX">
- <nodirs/>
- </dirstruct>
-</root>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/resources/examples/DirStructXmlParserFiles/CLASS_Text_Email.xml
----------------------------------------------------------------------
diff --git a/pushpull/src/main/resources/examples/DirStructXmlParserFiles/CLASS_Text_Email.xml b/pushpull/src/main/resources/examples/DirStructXmlParserFiles/CLASS_Text_Email.xml
deleted file mode 100644
index c4399c5..0000000
--- a/pushpull/src/main/resources/examples/DirStructXmlParserFiles/CLASS_Text_Email.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<root>
- <dirstruct starting_path="/home/class/TextMail">
- <dir name="\d{4}-\d{2}-\d{2}_\d{2}">
- <dir name="class">
- <nodirs/>
- </dir>
- </dir>
- </dirstruct>
-</root>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/resources/examples/DirStructXmlParserFiles/CloudSAT.xml
----------------------------------------------------------------------
diff --git a/pushpull/src/main/resources/examples/DirStructXmlParserFiles/CloudSAT.xml b/pushpull/src/main/resources/examples/DirStructXmlParserFiles/CloudSAT.xml
deleted file mode 100644
index c3477ae..0000000
--- a/pushpull/src/main/resources/examples/DirStructXmlParserFiles/CloudSAT.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<root>
- <dirstruct starting_path="2B-CWC-RO.R04/2007/304"/>
-</root>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/resources/examples/DirStructXmlParserFiles/GFS.xml
----------------------------------------------------------------------
diff --git a/pushpull/src/main/resources/examples/DirStructXmlParserFiles/GFS.xml b/pushpull/src/main/resources/examples/DirStructXmlParserFiles/GFS.xml
deleted file mode 100644
index 6ceea12..0000000
--- a/pushpull/src/main/resources/examples/DirStructXmlParserFiles/GFS.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<root>
- <dirstruct starting_path="/pub/data/nccf/com/gfs/prod">
- <nofiles/>
- <dir name="gfs\.\d{8}((12)|(00))">
- <nodirs/>
- <file name="gfs\.t((00)|(12))z\.pgrb2f((03)|(06)|(09)|(12))"/>
- </dir>
- </dirstruct>
-</root>
-
-
-
-
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/resources/examples/DirStructXmlParserFiles/IASI.xml
----------------------------------------------------------------------
diff --git a/pushpull/src/main/resources/examples/DirStructXmlParserFiles/IASI.xml b/pushpull/src/main/resources/examples/DirStructXmlParserFiles/IASI.xml
deleted file mode 100644
index d63e871..0000000
--- a/pushpull/src/main/resources/examples/DirStructXmlParserFiles/IASI.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<root>
- <dirstruct starting_path="/misc/raid2/IASI/L1C/2007">
- <nofiles/>
- </dirstruct>
-</root>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/resources/examples/DirStructXmlParserFiles/IASI_2.xml
----------------------------------------------------------------------
diff --git a/pushpull/src/main/resources/examples/DirStructXmlParserFiles/IASI_2.xml b/pushpull/src/main/resources/examples/DirStructXmlParserFiles/IASI_2.xml
deleted file mode 100644
index 30bdbd8..0000000
--- a/pushpull/src/main/resources/examples/DirStructXmlParserFiles/IASI_2.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<root>
- <dirstruct root_based="true" starting_path="/A6719183">
- <nodirs/>
- </dirstruct>
-</root>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/resources/examples/DirStructXmlParserFiles/IBIBLIO.xml
----------------------------------------------------------------------
diff --git a/pushpull/src/main/resources/examples/DirStructXmlParserFiles/IBIBLIO.xml b/pushpull/src/main/resources/examples/DirStructXmlParserFiles/IBIBLIO.xml
deleted file mode 100644
index 009e297..0000000
--- a/pushpull/src/main/resources/examples/DirStructXmlParserFiles/IBIBLIO.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<root>
- <dirstruct starting_path="/mirrors/apache/">
- <nofiles/>
- <dir name="ant">
- <nodirs/>
- </dir>
- </dirstruct>
-</root>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/resources/examples/DirStructXmlParserFiles/MODIS.xml
----------------------------------------------------------------------
diff --git a/pushpull/src/main/resources/examples/DirStructXmlParserFiles/MODIS.xml b/pushpull/src/main/resources/examples/DirStructXmlParserFiles/MODIS.xml
deleted file mode 100644
index 12cf2d9..0000000
--- a/pushpull/src/main/resources/examples/DirStructXmlParserFiles/MODIS.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<root>
- <dirstruct starting_path="/MOTA/MCD43B1.005/2007.02.02">
- <nodirs/>
- <file name="MCD43B1\.A2007033\.h\d{2}v\d{2}\.005\.\d{13}\.hdf(\.xml){0,1}"/>
- </dirstruct>
-</root>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/resources/examples/DirStructXmlParserFiles/RTG_SST.xml
----------------------------------------------------------------------
diff --git a/pushpull/src/main/resources/examples/DirStructXmlParserFiles/RTG_SST.xml b/pushpull/src/main/resources/examples/DirStructXmlParserFiles/RTG_SST.xml
deleted file mode 100644
index 0dfbc5f..0000000
--- a/pushpull/src/main/resources/examples/DirStructXmlParserFiles/RTG_SST.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<root>
- <dirstruct starting_path="/pub/history/sst">
- <nodirs/>
- <file name="rtg_sst_grb_0\.5\.\d{8}"/>
- </dirstruct>
-</root>
-
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/resources/examples/ExternalSourcesFiles/ExternalSources.xml
----------------------------------------------------------------------
diff --git a/pushpull/src/main/resources/examples/ExternalSourcesFiles/ExternalSources.xml b/pushpull/src/main/resources/examples/ExternalSourcesFiles/ExternalSources.xml
deleted file mode 100644
index 242b883..0000000
--- a/pushpull/src/main/resources/examples/ExternalSourcesFiles/ExternalSources.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<sources>
- <source host="polar.ncep.noaa.gov">
- <login type="ftp" alias="PolarNcepNoaaFtp">
- <username>anonymous</username>
- <password>user@host.com</password>
- </login>
- </source>
- <source host="ftp1.cloudsat.cira.colostate.edu">
- <login type="ftp" alias="CloudSATFtp">
- <username></username>
- <password></password>
- <cdTestDir>2B-CWC-RO.R04/2007/304</cdTestDir>
- <maxConn>5</maxConn>
- </login>
- </source>
- <source host="ftp.class.noaa.gov">
- <login type="ftp" alias="ClassFtp">
- <username>anonymous</username>
- <password>user@host.com</password>
- </login>
- </source>
- <source host="localhost">
- <login type="file" alias="localhost">
- <username>none</username>
- <password>none</password>
- </login>
- </source>
- <source host="ftpprd.ncep.noaa.gov">
- <login type="ftp" alias="GfsFtp">
- <username>anonymous</username>
- <password>user@host.com</password>
- </login>
- </source>
- <source host="e4ftl01u.ecs.nasa.gov">
- <login type="ftp" alias="ModisFtp">
- <username>anonymous</username>
- <password>user@host.com</password>
- </login>
- </source>
- <source host="airscal2u.ecs.nasa.gov">
- <login type="ftp" alias="GdaacFtp">
- <username>anonymous</username>
- <password>user@host.com</password>
- </login>
- </source>
- <source host="acdisc.gsfc.nasa.gov">
- <login type="ftp" alias="AcdiscGsfcFtp">
- <username>anonymous</username>
- <password>user@host.com</password>
- </login>
- </source>
- <source host="www.signal42.com">
- <login type="http" alias="Signal42ApacheMirrorHttp">
- <username>none</username>
- <password>none</password>
- </login>
- </source>
-</sources>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/resources/examples/FileListParserFiles/DownloadList.txt
----------------------------------------------------------------------
diff --git a/pushpull/src/main/resources/examples/FileListParserFiles/DownloadList.txt b/pushpull/src/main/resources/examples/FileListParserFiles/DownloadList.txt
deleted file mode 100644
index 9280931..0000000
--- a/pushpull/src/main/resources/examples/FileListParserFiles/DownloadList.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-/misc/raid2/IASI/L1C/2007/06/30
-IASI_xxx_1C_M02_20070629235953Z_20070630000256Z_N_O_20070630013723Z__20070630014330
-IASI_xxx_1C_M02_20070630000257Z_20070630000552Z_N_O_20070630013952Z__20070630014640
-IASI_xxx_1C_M02_20070630000553Z_20070630000856Z_N_O_20070630014220Z__20070630014740
-IASI_xxx_1C_M02_20070630000857Z_20070630001152Z_N_O_20070630014452Z__20070630014944
-IASI_xxx_1C_M02_20070630001153Z_20070630001456Z_N_O_20070630014718Z__20070630015234
-IASI_xxx_1C_M02_20070630001753Z_20070630002056Z_N_O_20070630015228Z__20070630015909
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/resources/examples/ProcmailForwarding/[dot]forward
----------------------------------------------------------------------
diff --git a/pushpull/src/main/resources/examples/ProcmailForwarding/[dot]forward b/pushpull/src/main/resources/examples/ProcmailForwarding/[dot]forward
deleted file mode 100644
index 4f0d5bc..0000000
--- a/pushpull/src/main/resources/examples/ProcmailForwarding/[dot]forward
+++ /dev/null
@@ -1 +0,0 @@
-"|IFS=' '&&p=/usr/local/bin/procmail&&test -f $p&&exec $p -f-||exit 75#class"
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/resources/examples/ProcmailForwarding/[dot]procmail/general.rc
----------------------------------------------------------------------
diff --git a/pushpull/src/main/resources/examples/ProcmailForwarding/[dot]procmail/general.rc b/pushpull/src/main/resources/examples/ProcmailForwarding/[dot]procmail/general.rc
deleted file mode 100644
index 901cfd7..0000000
--- a/pushpull/src/main/resources/examples/ProcmailForwarding/[dot]procmail/general.rc
+++ /dev/null
@@ -1,25 +0,0 @@
-MONTHFOLDER= `date +%Y-%m-%d_%H `
-DUMMY= `test -d $MONTHFOLDER || mkdir -m g=rwx $MONTHFOLDER `
-
-CLASS_FOLDER= ${MONTHFOLDER}/class
-UNKNOWN_FOLDER= ${MONTHFOLDER}/unknown
-JPL_FOLDER= ${MONTHFOLDER}/jpl
-DUMMY= `test -d $CLASS_FOLDER || mkdir -m g=rwx $CLASS_FOLDER `
-DUMMY= `test -d $UNKNOWN_FOLDER || mkdir -m g=rwx $UNKNOWN_FOLDER `
-DUMMY= `test -d $JPL_FOLDER || mkdir -m g=rwx $JPL_FOLDER `
-
-:0 fw
-*
-| formail -k -X From: -X Subject:
-
-:0 :
-* ^From.*class\.noaa\.gov
-${CLASS_FOLDER}
-
-:0 :
-* ^From.*jpl\.nasa\.gov
-${JPL_FOLDER}
-
-:0 :
-*
-${UNKNOWN_FOLDER}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/resources/examples/ProcmailForwarding/[dot]procmailrc
----------------------------------------------------------------------
diff --git a/pushpull/src/main/resources/examples/ProcmailForwarding/[dot]procmailrc b/pushpull/src/main/resources/examples/ProcmailForwarding/[dot]procmailrc
deleted file mode 100644
index 65524a1..0000000
--- a/pushpull/src/main/resources/examples/ProcmailForwarding/[dot]procmailrc
+++ /dev/null
@@ -1,7 +0,0 @@
-VERBOSE=off
-UMASK=007
-MAILDIR=$HOME/TextMail
-PMDIR=$HOME/.procmail
-DEFAULT=$MAILDIR
-LOGFILE=$PMDIR/log
-INCLUDERC=$PMDIR/general.rc
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/resources/examples/RemoteSpecsFiles/RemoteSpecs.xml
----------------------------------------------------------------------
diff --git a/pushpull/src/main/resources/examples/RemoteSpecsFiles/RemoteSpecs.xml b/pushpull/src/main/resources/examples/RemoteSpecsFiles/RemoteSpecs.xml
deleted file mode 100644
index bf4ed22..0000000
--- a/pushpull/src/main/resources/examples/RemoteSpecsFiles/RemoteSpecs.xml
+++ /dev/null
@@ -1,181 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<remoteSpecs>
-
- <aliasSpecs>
- <aliasSpec file="[CAS_PP_RESOURCES]/examples/ExternalSourcesFiles/ExternalSources.xml"/>
- </aliasSpecs>
-
- <daemons>
-
- <daemon alias="DewFtp" active="no">
- <runInfo firstRunDateTime="2007-12-01T00:00:00Z" period="3m" runOnReboot="yes"/>
- <propInfo dir="[CAS_PP_RESOURCES]/examples/DirStructXmlParserFiles">
- <propFiles regExp="IASI\.xml" parser="org.apache.oodt.cas.pushpull.filerestrictions.parsers.DirStructXmlParser"/>
- </propInfo>
- <dataInfo stagingArea="DewFtp" deleteFromServer="no"/>
- </daemon>
-
- <daemon alias="DewFtp" active="no">
- <runInfo firstRunDateTime="2007-12-01T00:00:00Z" period="3m" runOnReboot="yes"/>
- <propInfo dir="[CAS_PP_TEMP_PROPS]/WeatherSftp">
- <downloadInfo alias="WeatherSftp" remoteDir="junkTest"/>
- <propFiles regExp="IASI\.xml" parser="org.apache.oodt.cas.pushpull.filerestrictions.parsers.DirStructXmlParser"/>
- </propInfo>
- <dataInfo stagingArea="DewFtp" deleteFromServer="no"/>
- </daemon>
-
- <daemon alias="CalPolySftp" active="no">
- <runInfo firstRunDateTime="2007-12-01T00:00:00Z" period="3m" runOnReboot="yes"/>
- <propInfo dir="[CAS_PP_RESOURCES]/examples/DirStructXmlParserFiles">
- <propFiles regExp="CalPoly\.xml" parser="org.apache.oodt.cas.pushpull.filerestrictions.parsers.DirStructXmlParser"/>
- </propInfo>
- <dataInfo stagingArea="CalPolySftp" deleteFromServer="no"/>
- </daemon>
-
- <daemon alias="WeatherSftp" active="no">
- <runInfo firstRunDateTime="2007-12-01T00:00:00Z" period="3m" runOnReboot="yes"/>
- <propInfo dir="[CAS_PP_RESOURCES]/examples/DirStructXmlParserFiles">
- <propFiles regExp="IASI\.xml" parser="org.apache.oodt.cas.pushpull.filerestrictions.parsers.DirStructXmlParser"/>
- </propInfo>
- <dataInfo stagingArea="WeatherSftp" deleteFromServer="no"/>
- </daemon>
-
- <daemon alias="WeatherSftp" active="no">
- <runInfo firstRunDateTime="2007-12-01T00:00:00Z" period="3m" runOnReboot="yes"/>
- <propInfo dir="[CAS_PP_TEMP_PROPS]/WeatherSftp">
- <downloadInfo alias="WeatherSftp" remoteDir="junkTest"/>
- <propFiles regExp="IASI\.xml" parser="org.apache.oodt.cas.pushpull.filerestrictions.parsers.DirStructXmlParser"/>
- </propInfo>
- <dataInfo stagingArea="WeatherSftp" deleteFromServer="no" queryElement="RetrievedFromLoc"/>
- </daemon>
-
- <daemon alias="WeatherSftp" active="no">
- <runInfo firstRunDateTime="2007-12-24T00:10:00Z" period="3m" runOnReboot="yes"/>
- <propInfo dir="[CAS_PP_RESOURCES]/examples/FileListParserFiles">
- <propFiles regExp="DownloadList\.txt" parser="org.apache.oodt.cas.pushpull.filerestrictions.parsers.FileListParser"/>
- </propInfo>
- <dataInfo stagingArea="WeatherSftp" deleteFromServer="no" queryElement="RetrievedFromLoc"/>
- </daemon>
-
- <daemon alias="ClassFtp" active="no">
- <runInfo firstRunDateTime="2007-12-01T00:00:00Z" period="3m" runOnReboot="yes"/>
- <propInfo dir="[CAS_PP_RESOURCES]/examples/DirStructXmlParserFiles">
- <propFiles regExp="IASI_2.xml" parser="org.apache.oodt.cas.pushpull.filerestrictions.parsers.DirStructXmlParser"/>
- </propInfo>
- <dataInfo stagingArea="ClassFtp" deleteFromServer="no" queryElement="Filename"/>
- </daemon>
-
- <daemon alias="ClassFtp" active="no">
- <runInfo firstRunDateTime="2007-12-01T00:00:00Z" period="3m" runOnReboot="yes"/>
- <propInfo dir="[CAS_PP_RESOURCES]/examples/ClassNoaaEmailParserFiles">
- <propFiles regExp="[^\.].*" parser="org.apache.oodt.cas.pushpull.filerestrictions.parsers.ClassNoaaEmailParser"/>
- </propInfo>
- <dataInfo stagingArea="ClassFtp" deleteFromServer="no" queryElement="Filename"/>
- </daemon>
-
- <daemon alias="ClassFtp" active="no">
- <runInfo firstRunDateTime="2007-12-14T00:00:00Z" period="3m" epsilon="20s" runOnReboot="yes"/>
- <propInfo dir="[CAS_PP_TEMP_PROPS]/ClassFtp/Emails">
- <downloadInfo alias="PeateImaps" deleteFromServer="yes" renamingConv="CLASS_[HOST]_[DATE.UTC]_[FILENAME].email">
- <propFile path="[CAS_PP_RESOURCES]/examples/DirStructXmlParserFiles/CLASS_Email.xml"
- parser="org.apache.oodt.cas.pushpull.filerestrictions.parsers.DirStructXmlParser"/>
- </downloadInfo>
- <propFiles regExp=".*\.email" parser="org.apache.oodt.cas.pushpull.filerestrictions.parsers.ClassNoaaEmailParser"/>
- <afterUse moveToOnSuccess="[CAS_PP_TEMP_PROPS]/ClassFtp/ProcessedEmails"
- moveToOnFail="[CAS_PP_TEMP_PROPS]/ClassFtp/FailedEmails"/>
- </propInfo>
- <dataInfo stagingArea="ClassFtp" deleteFromServer="no" allowAliasOverride="yes"
- queryElement="Filename" renamingConv="[GREP_RM('^L\d{1,}?\.','[FILENAME]')]"/>
- </daemon>
-
- <daemon alias="ClassFtp" active="yes">
- <runInfo firstRunDateTime="2007-12-14T00:00:00Z" period="3m" epsilon="20s" runOnReboot="yes"/>
- <propInfo dir="[CAS_PP_TEMP_PROPS]/ClassFtp/Emails">
- <downloadInfo alias="localhost" deleteFromServer="yes" renamingConv="CLASS_[HOST]_[DATE.UTC]_[FILENAME].email">
- <propFile path="[CAS_PP_RESOURCES]/examples/DirStructXmlParserFiles/CLASS_Text_Email.xml"
- parser="org.apache.oodt.cas.pushpull.filerestrictions.parsers.DirStructXmlParser"/>
- </downloadInfo>
- <propFiles regExp=".*\.email" parser="org.apache.oodt.cas.pushpull.filerestrictions.parsers.ClassNoaaEmailParser"/>
- <afterUse moveToOnSuccess="[CAS_PP_TEMP_PROPS]/ClassFtp/ProcessedEmails"
- moveToOnFail="[CAS_PP_TEMP_PROPS]/ClassFtp/FailedEmails"/>
- </propInfo>
- <dataInfo stagingArea="ClassFtp" deleteFromServer="no" allowAliasOverride="yes"
- queryElement="Filename"/>
- </daemon>
-
- <daemon alias="GfsFtp" active="no">
- <runInfo firstRunDateTime="2007-11-27T00:00:00Z" period="3m" epsilon="20s" runOnReboot="yes"/>
- <propInfo dir="[CAS_PP_RESOURCES]/examples/DirStructXmlParserFiles">
- <propFiles regExp="GFS\.xml" parser="org.apache.oodt.cas.pushpull.filerestrictions.parsers.DirStructXmlParser"/>
- </propInfo>
- <dataInfo stagingArea="GfsFtp" renamingConv="[PARENT_FILENAME]_[FILENAME]" queryElement="RetrievedFromLoc"/>
- </daemon>
-
- <daemon alias="PolarNcepNoaaFtp" active="no">
- <runInfo firstRunDateTime="2007-11-27T00:00:00Z" period="3m" epsilon="20s" runOnReboot="yes"/>
- <propInfo dir="[CAS_PP_RESOURCES]/examples/DirStructXmlParserFiles">
- <propFiles regExp="RTG_SST\.xml" parser="org.apache.oodt.cas.pushpull.filerestrictions.parsers.DirStructXmlParser"/>
- </propInfo>
- <dataInfo stagingArea="RtgSstFtp" queryElement="Filename"/>
- </daemon>
-
- <daemon alias="ModisFtp" active="no">
- <runInfo firstRunDateTime="2007-12-01T00:00:00Z" period="3m" runOnReboot="yes"/>
- <propInfo dir="[CAS_PP_RESOURCES]/examples/DirStructXmlParserFiles">
- <propFiles regExp="MODIS\.xml" parser="org.apache.oodt.cas.pushpull.filerestrictions.parsers.DirStructXmlParser"/>
- </propInfo>
- <dataInfo stagingArea="ModisFtp" deleteFromServer="no" queryElement="RetrievedFromLoc"/>
- </daemon>
-
- <daemon alias="GdaacFtp" active="no">
- <runInfo firstRunDateTime="2007-12-01T00:00:00Z" period="3m" runOnReboot="yes"/>
- <propInfo dir="[CAS_PP_RESOURCES]/examples/DirStructXmlParserFiles">
- <propFiles regExp="AIRABRAD\.xml" parser="org.apache.oodt.cas.pushpull.filerestrictions.parsers.DirStructXmlParser"/>
- </propInfo>
- <dataInfo stagingArea="GdaccFtp" deleteFromServer="no" queryElement="RetrievedFromLoc"/>
- </daemon>
-
- <daemon alias="AcdiscGsfcFtp" active="no">
- <runInfo firstRunDateTime="2007-12-01T00:00:00Z" period="3m" runOnReboot="yes"/>
- <propInfo dir="[CAS_PP_RESOURCES]/examples/DirStructXmlParserFiles">
- <propFiles regExp="AIRS3STD\.xml" parser="org.apache.oodt.cas.pushpull.filerestrictions.parsers.DirStructXmlParser"/>
- <propFiles regExp="AIRS3ST8\.xml" parser="org.apache.oodt.cas.pushpull.filerestrictions.parsers.DirStructXmlParser"/>
- </propInfo>
- <dataInfo stagingArea="AcdiscGsfcFtp" deleteFromServer="no" queryElement="RetrievedFromLoc"/>
- </daemon>
-
- <daemon alias="Signal42ApacheMirrorHttp" active="no">
- <runInfo firstRunDateTime="2007-12-01T00:00:00Z" period="3m" runOnReboot="yes"/>
- <propInfo dir="[CAS_PP_RESOURCES]/examples/DirStructXmlParserFiles">
- <propFiles regExp="IBIBLIO\.xml" parser="org.apache.oodt.cas.pushpull.filerestrictions.parsers.DirStructXmlParser"/>
- </propInfo>
- <dataInfo stagingArea="Signal42ApacheMirrorHttp" deleteFromServer="no" queryElement="RetrievedFromLoc"/>
- </daemon>
-
- <daemon alias="RimeSftp" active="no">
- <runInfo firstRunDateTime="2008-02-19T00:00:00Z" period="3m" runOnReboot="yes"/>
- <propInfo dir="[CAS_PP_RESOURCES]/examples/DirStructXmlParserFiles">
- <propFiles regExp="RimeDIRSTRUCT.xml" parser="org.apache.oodt.cas.pushpull.filerestrictions.parsers.DirStructXmlParser"/>
- </propInfo>
- <dataInfo stagingArea="RimeSftp" renamingConv="[PATH_NO_FILENAME]/[FILENAME]" deleteFromServer="no" queryElement="RetrievedFromLoc"/>
- </daemon>
-
- </daemons>
-
-</remoteSpecs>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/resources/jssecacerts
----------------------------------------------------------------------
diff --git a/pushpull/src/main/resources/jssecacerts b/pushpull/src/main/resources/jssecacerts
deleted file mode 100644
index 7c8f621..0000000
Binary files a/pushpull/src/main/resources/jssecacerts and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/resources/logging.properties
----------------------------------------------------------------------
diff --git a/pushpull/src/main/resources/logging.properties b/pushpull/src/main/resources/logging.properties
deleted file mode 100644
index 6af123f..0000000
--- a/pushpull/src/main/resources/logging.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# 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.
-
-
-# Specify the handlers to create in the root logger
-# (all loggers are children of the root logger)
-# The following creates two handlers
-handlers = java.util.logging.ConsoleHandler, java.util.logging.FileHandler
-
-# Set the default logging level for the root logger
-.level = ALL
-
-# Set the default logging level for new ConsoleHandler instances
-java.util.logging.ConsoleHandler.level = ALL
-java.util.logging.FileHandler.level = ALL
-
-# Set the default formatter for new ConsoleHandler instances
-java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
-
-# default file output is in user's home directory.
-java.util.logging.FileHandler.pattern = ../logs/cas-pushpull%g.log
-java.util.logging.FileHandler.limit = 50000
-java.util.logging.FileHandler.count = 5
-java.util.logging.FileHandler.append = true
-java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
-
-java.lang.management.level = OFF
-java.rmi.registry.level = OFF
-javax.management.level = OFF
-javax.management.level = OFF
-sun.rmi.level = OFF
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/resources/policy/ParserToRetrievalMethodMap.xml
----------------------------------------------------------------------
diff --git a/pushpull/src/main/resources/policy/ParserToRetrievalMethodMap.xml b/pushpull/src/main/resources/policy/ParserToRetrievalMethodMap.xml
deleted file mode 100644
index 537624c..0000000
--- a/pushpull/src/main/resources/policy/ParserToRetrievalMethodMap.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<rtvlMethods>
-
- <rtvlMethod class="org.apache.oodt.cas.pushpull.retrievalmethod.RemoteCrawler">
- <parser class="org.apache.oodt.cas.pushpull.filerestrictions.parsers.DirStructXmlParser"/>
- </rtvlMethod>
-
- <rtvlMethod class="org.apache.oodt.cas.pushpull.retrievalmethod.ListRetriever">
- <parser class="org.apache.oodt.cas.pushpull.filerestrictions.parsers.FileListParser"/>
- <parser class="org.apache.oodt.cas.pushpull.filerestrictions.parsers.ClassNoaaEmailParser"/>
- <parser class="org.apache.oodt.cas.pushpull.filerestrictions.parsers.GenericEmailParser"/>
- </rtvlMethod>
-
-</rtvlMethods>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/resources/policy/ProtocolFactoryInfo.xml
----------------------------------------------------------------------
diff --git a/pushpull/src/main/resources/policy/ProtocolFactoryInfo.xml b/pushpull/src/main/resources/policy/ProtocolFactoryInfo.xml
deleted file mode 100644
index d3c8c4e..0000000
--- a/pushpull/src/main/resources/policy/ProtocolFactoryInfo.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<protocols>
-
- <protocol type="ftp">
- <protocolFactory class="org.apache.oodt.cas.protocol.ftp.CogJGlobusFtpProtocolFactory"/>
- <protocolFactory class="org.apache.oodt.cas.protocol.ftp.CommonsNetFtpProtocolFactory"/>
- </protocol>
-
- <protocol type="http">
- <protocolFactory class="org.apache.oodt.cas.protocol.http.HttpProtocolFactory"/>
- </protocol>
-
- <protocol type="sftp">
- <protocolFactory class="org.apache.oodt.cas.protocol.sftp.JschSftpProtocolFactory"/>
- </protocol>
-
- <protocol type="imaps">
- <protocolFactory class="org.apache.oodt.cas.protocol.imaps.ImapsProtocolFactory"/>
- </protocol>
-
- <!--
- Note: hasn't been implemented yet, see OODT-537
-
- <protocol type="file">
- <protocolFactory class="org.apache.oodt.cas.protocol.local.LocalProtocolFactory"/>
- </protocol>
- -->
-
-</protocols>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/resources/policy/mimetypes.xml
----------------------------------------------------------------------
diff --git a/pushpull/src/main/resources/policy/mimetypes.xml b/pushpull/src/main/resources/policy/mimetypes.xml
deleted file mode 100644
index 36a5b98..0000000
--- a/pushpull/src/main/resources/policy/mimetypes.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<mime-info>
-
- <mime-type type="product/pgp_signature">
- <_comment><![CDATA[ProductNameGenerator=[GREP_RM('\.sig$','[FILENAME]')]]]></_comment>
- <glob pattern="*.sig"/>
- </mime-type>
-
- <mime-type type="metadata/cas_pushpull">
- <glob pattern="*.info.tmp"/>
- </mime-type>
-
- <mime-type type="metadata/cas_metadata">
- <glob pattern="*.cas"/>
- <glob pattern="*.met"/>
- </mime-type>
-
- <mime-type type="product/iasi_xxx_1c">
- <sub-class-of type="metop_a/noaa"/>
- <_comment>ProductType=MOA_IASI_L1C</_comment>
- <glob pattern="(?:L\d{1,}\.){0,1}IASI_xxx_1C_\w{3}_\w{15}_\w{15}_\w_\w_\w{15}__\w{14}" isregex="true"/>
- </mime-type>
-
- <mime-type type="product/mhsx">
- <sub-class-of type="metop_a/noaa"/>
- <_comment>ProductType=MOA_MHS_L1B</_comment>
- <glob pattern="(?:L\d{1,}\.){0,1}NSS\.MHSX\.\w{2}\.D\d{5}\.S\d{4}\.E\d{4}\.B\d{7}\.\w{2}" isregex="true"/>
- </mime-type>
-
- <mime-type type="product/amsu_a">
- <sub-class-of type="metop_a/noaa"/>
- <_comment>ProductType=MOA_AMSUA_L1B</_comment>
- <glob pattern="(?:L\d{1,}\.){0,1}NSS\.AMAX\.\w{2}\.D\d{5}\.S\d{4}\.E\d{4}\.B\d{7}\.\w{2}" isregex="true"/>
- </mime-type>
-
- <mime-type type="product/rtg_sst">
- <sub-class-of type="ncep/model"/>
- <_comment><![CDATA[ProductType=RTG_SST && UniqueElement=RetrievedFromLoc]]></_comment>
- <glob pattern="rtg_sst_grb_0\.5\.\d{8}" isregex="true"/>
- <glob pattern="sst\.\d{8}_rtgssthr_grb_0\.5\.grib2" isregex="true"/>
- </mime-type>
-
-</mime-info>
-
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/resources/policy/mimetypes.xsd
----------------------------------------------------------------------
diff --git a/pushpull/src/main/resources/policy/mimetypes.xsd b/pushpull/src/main/resources/policy/mimetypes.xsd
deleted file mode 100644
index 4b795e2..0000000
--- a/pushpull/src/main/resources/policy/mimetypes.xsd
+++ /dev/null
@@ -1,71 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
- xmlns="http://oodt.apache.org/schema/pushpull/mimetypes.xsd"
- targetNamespace="http://oodt.apache.org/schema/pushpull/mimetypes.xsd"
- elementFormDefault="qualified" vc:minVersion="1.1"
- xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning">
- <xs:annotation>
- <xs:documentation>
- This schema defines how mimetypes.xml file entries should be
- structured within the context of the OODT pushpull component.
- </xs:documentation>
- </xs:annotation>
- <xs:element name="mime-info">
- <xs:annotation>
- <xs:documentation>
- mime-info is the root element containing one or more 'mime-type'.
- </xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element maxOccurs="unbounded" name="mime-type">
- <xs:annotation>
- <xs:documentation>
- There can be an unbounded number of 'mime-type' elements each containing
- zero or more 'sub-class-of' and 'glob' children but only one 'comment'
- child.
- </xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:all>
- <xs:element maxOccurs="unbounded" name="sub-class-of">
- <xs:complexType>
- <xs:attribute name="type" type="xs:string"/>
- </xs:complexType>
- </xs:element>
- <xs:element name="_comment"/>
- <xs:element maxOccurs="unbounded" name="glob">
- <xs:annotation>
- <xs:documentation>
-
- </xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:attribute name="pattern" type="xs:string"/>
- <xs:attribute name="isRegex" type="xs:boolean"/>
- </xs:complexType>
- </xs:element>
- </xs:all>
- <xs:attribute name="type" type="xs:string"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
-</xs:schema>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/resources/push_pull_framework.properties
----------------------------------------------------------------------
diff --git a/pushpull/src/main/resources/push_pull_framework.properties b/pushpull/src/main/resources/push_pull_framework.properties
deleted file mode 100644
index d1726ba..0000000
--- a/pushpull/src/main/resources/push_pull_framework.properties
+++ /dev/null
@@ -1,106 +0,0 @@
-# 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.
-# $Id: Configuration properties for the CAS Push-Pull-Framework$
-
-#---------------------------------------------------------------#
-#-------------------- Default Configurations -------------------#
-#---------------------------------------------------------------#
-
-#external configuration files
-org.apache.oodt.cas.pushpull.config.external.properties.files=[CAS_PP_HOME]/etc/default.properties
-
-
-#---------------------------------------------------------------#
-#-------------------- Default Ingester Properties --------------#
-#---------------------------------------------------------------#
-
-#ingester classpath
-org.apache.oodt.cas.filemgr.ingester=org.apache.oodt.cas.filemgr.ingest.StdIngester
-
-#ingester transferer
-org.apache.oodt.cas.filemgr.datatransfer.factory=org.apache.oodt.cas.filemgr.datatransfer.LocalDataTransferFactory
-
-# ingester filemgr url
-org.apache.oodt.cas.filemgr.url=[FILEMGR_LOC]
-
-#---------------------------------------------------------------#
-#-------------------- Cached Ingester Properties --------------#
-#---------------------------------------------------------------#
-org.apache.oodt.cas.filemgr.ingest.cache.factory=
-
-org.apache.oodt.cas.filemgr.ingest.cache.rangeQueryElementName=
-
-org.apache.oodt.cas.filemgr.ingest.cache.range.start=
-
-org.apache.oodt.cas.filemgr.ingest.cache.range.end=
-
-org.apache.oodt.cas.filemgr.ingest.cache.uniqueElementName=
-
-org.apache.oodt.cas.filemgr.ingest.cache.productType=
-
-
-#-------------------------------------------------------------#
-#---------------- Protocol Configurations --------------------#
-#-------------------------------------------------------------#
-
-#set the paging size (use -1 to turn paging off)
-org.apache.oodt.cas.pushpull.protocol.page_size=8
-
-#protocolfactory specification for protocol types
-org.apache.oodt.cas.pushpull.config.protocolfactory.info.files=[CAS_PP_HOME]/policy/ProtocolFactoryInfo.xml
-
-
-#-------------------------------------------------------------#
-#------------ FileRetrievalSystem Configurations -------------#
-#-------------------------------------------------------------#
-
-#parser to retrievalmethod map
-org.apache.oodt.cas.pushpull.config.parser.info.files=[CAS_PP_HOME]/policy/ParserToRetrievalMethodMap.xml
-
-#unique metadata element info
-org.apache.oodt.cas.pushpull.config.type.detection.file=[CAS_PP_HOME]/policy/mimetypes.xml
-
-#directory below which all data file will be downloaded to
-org.apache.oodt.cas.pushpull.data.files.base.staging.area=[CAS_PP_STAGING_AREA]
-
-#list of metadata values to print to metadata file
-org.apache.oodt.cas.pushpull.metadata.list.to.print=ProductName,RetrievedFromLoc,DataProvider,FileSize,RenamingString,ProductType,DownloadToDir,DeleteAfterDownload,SuperType
-
-#extension for temporary metadata file
-org.apache.oodt.cas.pushpull.write.met.file=true
-org.apache.oodt.cas.pushpull.met.file.extension=info.tmp
-
-#tracker varries the number of threads used to download files to find the optimized
-# number of threads in order to get the best download time
-org.apache.oodt.cas.pushpull.crawler.use.tracker=false
-
-#the recommended number of threads (will be the static number of
-# threads used if the tracker is turned off)
-org.apache.oodt.cas.pushpull.file.retrieval.system.recommended.thread.count=30
-
-#the FileRetrievalSystem will stop accepting files for download once this number
-# of failed downloads is reached
-org.apache.oodt.cas.pushpull.file.retrieval.system.max.number.allowed.failed.downloads=10
-
-#if true, any file not defined in the file type detection file will not be downloaded
-org.apache.oodt.cas.pushpull.allow.only.defined.types=true
-
-org.apache.oodt.cas.pushpull.filerestrictions.parsers.class.noaa.email.parser.contains.exprs=CLASS\ has\ processed,anonymous
-
-org.apache.oodt.cas.pushpull.generic.email.parser.file.pattern=Wav File: ([^\\s]+)
-org.apache.oodt.cas.pushpull.generic.email.parser.check.for.pattern=Pattern to valid email has expected text
-org.apache.oodt.cas.pushpull.generic.email.parser.path.to.root=/some/root/path
-org.apache.oodt.cas.pushpull.generic.email.parser.metadata.keys=MasterInContactId
-org.apache.oodt.cas.pushpull.generic.email.parser.metadata.MasterInContactId=Master ContactID (\d+?)\n
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/site/resources/images/cas-pushpull.jpg
----------------------------------------------------------------------
diff --git a/pushpull/src/site/resources/images/cas-pushpull.jpg b/pushpull/src/site/resources/images/cas-pushpull.jpg
deleted file mode 100644
index 26e4345..0000000
Binary files a/pushpull/src/site/resources/images/cas-pushpull.jpg and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/site/resources/images/cas-pushpull.psd
----------------------------------------------------------------------
diff --git a/pushpull/src/site/resources/images/cas-pushpull.psd b/pushpull/src/site/resources/images/cas-pushpull.psd
deleted file mode 100644
index 8aedbb3..0000000
Binary files a/pushpull/src/site/resources/images/cas-pushpull.psd and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/site/resources/images/pp_extension_points.png
----------------------------------------------------------------------
diff --git a/pushpull/src/site/resources/images/pp_extension_points.png b/pushpull/src/site/resources/images/pp_extension_points.png
deleted file mode 100644
index b956b84..0000000
Binary files a/pushpull/src/site/resources/images/pp_extension_points.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/site/resources/images/pp_object_model.png
----------------------------------------------------------------------
diff --git a/pushpull/src/site/resources/images/pp_object_model.png b/pushpull/src/site/resources/images/pp_object_model.png
deleted file mode 100644
index fd25cd0..0000000
Binary files a/pushpull/src/site/resources/images/pp_object_model.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/site/site.xml
----------------------------------------------------------------------
diff --git a/pushpull/src/site/site.xml b/pushpull/src/site/site.xml
deleted file mode 100644
index 4e5af1f..0000000
--- a/pushpull/src/site/site.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more contributor
-license agreements. See the NOTICE.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 name="cas-pushpull">
-
- <body>
- <links>
- <item name="OODT" href="../oodt-site/"/>
- </links>
-
- <menu ref="reports" inherit="bottom"/>
- <menu name="Software Documentation">
- <item name="Developer Guide" href="development/developer.html"/>
- <item name="Basic User Guide" href="user/basic.html"/>
- <item name="Advanced User Guide" href="user/advanced.html"/>
- </menu>
- </body>
-</project>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/site/xdoc/development/developer.xml
----------------------------------------------------------------------
diff --git a/pushpull/src/site/xdoc/development/developer.xml b/pushpull/src/site/xdoc/development/developer.xml
deleted file mode 100644
index 49f522e..0000000
--- a/pushpull/src/site/xdoc/development/developer.xml
+++ /dev/null
@@ -1,286 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more contributor
-license agreements. See the NOTICE.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.
--->
-<document>
- <properties>
- <title>CAS Push Pull Framework Developer Guide</title>
- <author email="Brian.Foster@jpl.nasa.gov">Brian Foster</author>
- <author email="Chris.Mattmann@jpl.nasa.gov">Chris Mattmann</author>
- </properties>
-
- <body>
-
- <section name="Introduction">
- <p>
- This is the developer guide for the Apache OODT Catalog and Archive Service (CAS)
- Push Pull framework, or Push Pull for short. Primarily, this guide
- will explain the Push Pull architecture and interfaces, including its
- tailorable extension points. For information on installation, configuration,
- and examples, please see our <a href="../user/basic.html">User Guides.</a>
-
- <p>The remainder of this guide is separated into the following sections:</p>
- <ul>
- <li><a href="#section1">Project Description</a></li>
- <li><a href="#section2">Architecture</a></li>
- <li><a href="#section3">Extension Points</a></li>
- <li><a href="#section4">Current Extension Point Implementations</a></li>
- </ul>
-
- </p>
- </section>
-
- <a name="section1"/>
- <section name="Project Description">
- <p>The Push Pull framework is responsible for downloading remote content (pull),
- or accepting the delivery of remote content (push) to a local system staging area
- for use by the <a href="../../crawler">CAS Crawler Framework</a> to ingest into
- the <a href="../../filemgr">CAS File Manager</a>. The Push Pull framework is extensible
- and provides a fully tailorable Java-based API for the acquisition of remote content.</p>
- </section>
-
- <a name="section2"/>
- <section name="Architecture">
-
- <p>In this section, we will describe the architecture of the Push Pull framework,
- including its constituent components, object model, and key capabilities.</p>
-
- <subsection name="Components">
-
- <p>The major components of the Push Pull Framework are the Daemon Launcher, the Daemon,
- the Protocol Layer, and the File Retrieval System, to name a few. The relationship between
- all of these components are shown in the diagram below:
- </p>
-
- <p><img src="../images/pp_extension_points.png" alt="Push Pull Framework Architecture"/></p>
-
- <p>The Push Pull Framework provides a Daemon Launcher, responsible for creating new
- Daemon instances. Each Daemon has an associated Daemon Configuration, and has the
- ability to use a File Retrieval Setup extension point. This class is responsible for
- leveraging both a Protocol and a File Retrieval System to obtain ProtocolFiles, based on
- a File Restrictions Parser, that yields eventually a VirtualFileStructure (VFS) model. The
- VFS defines what files to accept and pull down from a remote site.
- </p>
-
- </subsection>
- <subsection name="Object Model">
- <p>The critical objects managed by the Push Pull Framework include:</p>
-
- <ul>
- <li><strong>Protocol</strong> - A pluggable means of obtaining content over
- some file acquisition method, e.g., FTP, SCP, HTTP, etc.</li>
-
- <li><strong>Protocol File</strong> - Metadata information about a remote file,
- including its ProtocolPath.</li>
-
- <li><strong>Protocol Path</strong> - A pointer to a remote Product file's (or files')
- location, which can be used to derive metadata and determine where to place the file
- in the local staging area built by the Push Pull Framework.</li>
-
- <li><strong>Remote Site</strong> - Descriptive information about a remote site, including
- the username/password combination, as well as a origin directory to start interrogating.</li>
- </ul>
-
- <p>Each Protocol delivers one or more Protocol Files. Each ProtocoFile is associated with a
- single RemoteSite, and each ProtocolFile is associated with a single ProtocolPath. These
- relationships are shown in the below figure.</p>
-
- <img src="../images/pp_object_model.png" alt="Push Pull Framework Object Model"/>
- </subsection>
-
- <subsection name="Key Capabilities">
- <p>The Push Pull Framework has been designed with a new of key capabilities in mind.
- These capabilities include:</p>
-
- <p><strong>Flexibility</strong> - ability to plug in different Metadata Extractors,
- Data Protocols, Content Types, etc.</p>
-
- <p><strong>Support Push/Pull</strong> - Support of both "Push" and "Pull"
- style data transfers.</p>
-
- <p><strong>Extensibility</strong> - ability to add new, previously undiscovered Data Protocols,
- and "plug" them into the framework.</p>
-
- <p><strong>Java-based</strong> - Use of Java programming language and development kit for Multi-Platform
- deployment (using the Java Virtual Machine).</p>
-
- <p><strong>Fast Data-transfer</strong> - Support of Parallel File Transfers and Data Downloads.</p>
-
- <p><strong>Email-based Push</strong> - Support for Email-based Push Data Acceptance using IMAP, SMTP protocols.</p>
-
- <p><strong>Modeling of remote data sites</strong> - Ability to configure “Virtual” remote directories (based on Metadata
- such as Date/Time) to download files from.</p>
-
- <p><strong>Integration with other CAS components</strong> - Ability to "plug-in" to the CAS File Management
- and CAS Crawl Framework components for Data Ingestion.</p>
- </subsection>
- </section>
-
- <a name="section3"/>
- <section name="Extension Points">
- <p>We have constructed the Push Pull Framework making use of the <i>factory
- method pattern</i> to provide multiple extension points for the Push Pull Framework. An
- extension point is an interface within the Push Pull Framework that can have many
- implementations. This is particularly useful when it comes to software
- component configuration because it allows different implementations of
- an existing interface to be selected at deployment time.</p>
-
- <div class="info">The factory method pattern is a creational pattern common to
- object oriented design. Each Push Pull Framework extension point involves the
- implementation of two interfaces: an <i>extension factory</i> and an
- <i>extension</i> implementation. At run-time, the Push Pull Framework loads a
- properties file specifies a factory class to use during extension point
- instantiation. For example, the Push Pull Framework may communicate with a
- remote FTP site to obtain content, or it may use an IMAPS protocol plugin to
- accept email-push notifications of available files.
- </div>
-
- <p>Using extension points, it is fairly simple to support many different types
- of what are typically referred to as "plug-in architectures". Each of the core
- extension points for the Push Pull Framework is described below:</p>
-
- <table>
- <tr>
- <td>Protocol</td>
- <td>The Protocol extension point is the heart of the Push Pull framework,
- responsible for modeling remote sites, and for obtaining their content via
- different Retrieval Methods, using different File Restrictions Parsers.
- </td>
- </tr>
- <tr>
- <td>Retrieval Method</td>
- <td>The Retrieval Method extension point is responsible for orchestrating
- download (pull) and acceptance (push) of remote content.
- </td>
- </tr>
- <tr>
- <td>File Restrictions Parser</td>
- <td>The File Restrictions Parser extension point is responsible for defining
- how to accept or decline files encountered by a Retrieval Method, in essence
- modeling remote file and directory structures.
- </td>
- </tr>
- <tr>
- <td>System</td>
- <td>The extension point that provides the external interface to the
- Push Pull Framework services. This includes the Daemon Launcher interface,
- as well as the associated Daemon interface, that
- is managed by with the Daemon Launcher.
- </td>
- </tr>
-
- </table>
- </section>
-
- <a name="section4"/>
- <section name="Current Extension Point Implementations">
-
- <p>There are at least two implementations of all of the aforementioned
- extension points for the Push Pull Framework. Each extension point implementation
- is detailed in this section.</p>
-
- <subsection name="Protocol">
- <ul>
- <li><strong>Cog JGlobus FTP.</strong> An implementation of
- the Protocol extension point for FTP using
- <a href="http://dev.globus.org/wiki/CoG_jglobus">CoG jglobus</a>.
- </li>
-
- <li><strong>Commons Net FTP.</strong> An implementation of the
- of the Protocol extension point for FTP using
- <a href="http://commons.apache.org/net/">Commons Net</a> FTP client.
- </li>
-
- <li><strong>HTTP.</strong> An implementation of
- the Protocol extension point using Java's URL class, as well as
- <a href="http://tika.apche.org/">Apache Tika</a>'s HTMLParser.</li>
-
- <li><strong>IMAPS.</strong> An implementation of the
- Protocol extension point using IMAPS javax.mail classes from
- <a href="http://geronimo.apache.org">Apache Geronimo</a> and
- HTML parsing from <a href="http://tika.apache.org/">Apache Tika</a>.</li>
-
- <li><strong>Local.</strong> An implementation of
- the Protocol extension point using Java NIO for local
- data acquisition.</li>
-
- <li><strong>SFTP.</strong> An implementation of the
- Protocol extension point using <a href="http://www.jcraft.org">JCraft</a>'s
- <a href="http://www.jcraft.org/jsch">JSch</a> library.</li>
- </ul>
- </subsection>
-
- <subsection name="Retrieval Method">
- <ul>
- <li><strong>Remote Crawler.</strong> An implementation of
- the Retrieval Method interface that uses an XML based set of
- policy files to determine which remote directories and files
- to crawl and obtain.</li>
-
- <li><strong>List Retriever.</strong> An implementation of the
- Retrieval Method interface that accepts a list of URLs that point
- to content to obtain.</li>
- </ul>
- </subsection>
-
- <subsection name="File Restrictions Parser">
- <ul>
- <li><strong>DirStructXml Parser.</strong> An implementation of
- the File Restrictions Parser interface that interprets an XML file
- specifying the remote directories and files to obtain.</li>
-
- <li><strong>FileList Parser.</strong> An implementation of the
- File Restrictions Parser interface that specifies an ASCII newline separated
- list of URLs pointing to remote directories and files to obtain.</li>
-
- <li><strong>Class NOAA Email Parser.</strong> An implementation of the
- File Restrictions Parser interface that reads email files from NOAA's CLASS
- archive which specify lists of directory and file URLs to obtain.</li>
- </ul>
- </subsection>
-
-
- <subsection name="Daemon Launcher (Daemon client and Daemon server)">
- <ul>
- <li><strong>Java RMI based server.</strong> An
- implementation of the external server interface for the Push Pull Framework that
- uses RMI as the transportation medium to launch Push Pull Daemons.</li>
-
- <li><strong>Push Pull Daemon.</strong> An
- implementation of the client interface for the Java RMI-based
- server that uses RMI as the transportation medium to manage and control the
- Push Pull services.</li>
- </ul>
- </subsection>
-
- </section>
-
- <section name="Conclusion">
- <p>The aim of this document is to provide information relevant to developers
- about the CAS Push Pull Framework. Specifically, this document has described the
- Push Pull Framework's architecture, including its constituent components, object model and
- key capabilities. Additionally, the this document provides an overview of the
- current implementations of the Push Pull Framework's extension points.</p>
-
- <p>In the <a href="../user/basic.html">Basic User Guide</a> and
- <a href="../user/advanced.html">Advanced User Guide</a>, we will cover topics
- like installation, configuration, and example uses as well as advanced topics
- like scaling and other tips and tricks.</p>
-
- </section>
-
- </body>
-</document>
[45/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/lib/pear/Core/Application.class.php
----------------------------------------------------------------------
diff --git a/balance/lib/pear/Core/Application.class.php b/balance/lib/pear/Core/Application.class.php
deleted file mode 100644
index 9a1f087..0000000
--- a/balance/lib/pear/Core/Application.class.php
+++ /dev/null
@@ -1,427 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- *
- * OODT Balance
- * Web Application Base Framework
- *
- * Main class for OODT Balance web applications. Contains utility
- * methods and definitions that provide standard functionality across
- * the site.
- *
- * @author ahart
- *
- */
-class Org_Apache_Oodt_Balance_Core_Application {
-
- public $request;
-
- public $subrequest;
-
- public $authenticationProviderInstance = null;
-
- public $authorizationProviderInstance = null;
-
- public $response;
-
- public $settings;
-
- public $modulesLoaded;
-
- public function __construct($settings) {
-
- // Save the application settings
- $this->settings = $settings;
-
- // Update the PHP include path to include the locations specified in
- // the application configuration .ini file
- if (isset($this->settings['classes_dir']) && is_array($this->settings['classes_dir'])) {
- $customClassPath = implode(';',$this->settings['classes_dirs']);
- set_include_path(get_include_path() . ';' . $customClassPath);
- }
-
- // Initialize a session
- session_start();
-
- // Define the application base url
- define ("SITE_ROOT", ($settings['site_root'] == '/')
- ? ''
- : $settings['site_root']);
-
- }
-
-
- public function getResponse() {
-
- $this->setAuthenticationProviderInstance();
- $this->setAuthorizationProviderInstance();
-
- // Interpret the request uri of the current request
- $uri = App::Get()->settings['site_root'] != '/'
- ? substr($_SERVER['REQUEST_URI'],strlen(App::Get()->settings['site_root']))
- : $_SERVER['REQUEST_URI'];
- $this->request = new Org_Apache_Oodt_Balance_Core_ApplicationRequest(
- $this->settings,$uri);
-
- // Initialize a response object for the request
- $this->response = new Org_Apache_Oodt_Balance_Core_ApplicationResponse(
- $this->settings,$this->request);
-
- // Process the response
- $this->response->process();
-
- // Return the processed response object
- return $this->response;
- }
-
- public function cleanup() {
-
- }
-
- /**
- * Determine whether the current request maps to resources associated
- * with an application module.
- *
- * If a view, script, or static asset is part of an application module,
- * the path to the file will differ than those for regular application
- * resources. This function provides a way to determine whether a given
- * request should be considered part of a module or of the general
- * application.
- *
- * @param $requestURI - The request uri to test
- * @return boolean - true indicates the request uri belongs to a module
- */
- public function isModule($requestURI) {
- // Determine whether a module is being requested
- $filteredURI = $requestURI;
- $filteredURI = ltrim($filteredURI,'/');
- $parts = explode('/',$filteredURI);
-
- if (is_dir(HOME . "/modules")) {
- $handle = opendir(HOME . "/modules");
- while (false !== ($dir = readdir($handle))) {
- if ( $dir == $parts[0] && $module = $this->loadModule($dir) ) {
- return $module;
- }
- }
- }
- return false;
- }
-
- public function getAuthenticationProvider() {
- return $this->authenticationProviderInstance;
- }
-
- public function setAuthenticationProviderInstance() {
-
- // Check if the user wants authentication for application
- if ( $this->settings['authentication_class_path'] != null &&
- $this->settings['authentication_class'] != null ) {
-
- require_once $this->settings['authentication_class_path'];
- $authProvider = $this->settings['authentication_class'];
- $this->authenticationProviderInstance = new $authProvider();
- }
- }
-
- public function getAuthorizationProvider() {
- return $this->authorizationProviderInstance;
- }
-
- public function setAuthorizationProviderInstance() {
-
- // Check if the user wants authorization for application
- if ( $this->settings['authorization_class_path'] != null &&
- $this->settings['authorization_class'] != null ) {
-
- require_once $this->settings['authorization_class_path'];
- $authProvider = $this->settings['authorization_class'];
- $this->authorizationProviderInstance = new $authProvider();
- }
- }
-
- public function loadModule($modName = null) {
- // If the module name is null, a module is requesting that
- // its own context be loaded
- if ($modName === null) {
- return $this->getModuleContext();
- }
-
- // If the module has been previously loaded, return its context
- if (isset($this->modulesLoaded[$modName])) {
- return $this->modulesLoaded[$modName];
- }
-
- // check if module path exists before loading module context
- $modulePath = HOME . "/modules/{$modName}";
- if ( is_dir($modulePath) ) {
-
- // create stdClass
- $modClass = new stdClass();
- $modClass->modulePath = $modulePath;
- $modClass->moduleRoot = SITE_ROOT . "/{$modName}";
- $modClass->moduleStatic = SITE_ROOT . "/modules/{$modName}/static";
-
- $this->modulesLoaded[$modName] = $modClass;
-
- // Read in the module config file and append to application config
- if (file_exists($modulePath . '/config.ini')) {
- // Get the raw contents of the config file
- $ini = file_get_contents($modulePath . '/config.ini');
- // Perform environment replacement
- $ini = str_replace('[MODULE_PATH]', $modClass->modulePath, $ini);
- $ini = str_replace('[MODULE_ROOT]', $modClass->moduleRoot, $ini);
- $ini = str_replace('[MODULE_STATIC]',$modClass->moduleStatic, $ini);
-
- $ini = str_replace('[HOME]', HOME, $ini);
- $ini = str_replace('[SITE_ROOT]', SITE_ROOT, $ini);
-
- // Parse the env-replaced content
- $moduleSettings = parse_ini_string($ini);
- // Append (union) with global settings. += ensures that
- // application settings always override module settings.
- $this->settings += $moduleSettings;
- }
-
- // Return the configuration object
- return $modClass;
- } else {
- return false;
- }
- }
-
- public function getModuleContext($which = null) {
-
- // If a module is requesting its own context...
- if ( $which === null ) {
- $req = ($this->subrequest != null)
- ? $this->subrequest
- : $this->request;
- $uri = ltrim($req->uri,'/');
- $moduleName = substr($uri,0,strpos($uri,'/'));
-
- return (!empty($moduleName))
- ? $this->loadModule($moduleName)
- : false;
- }
-
- // otherwise, return the result of an attempt to load the module
- return $this->loadModule($which);
- }
-
- public static function SetMessage($content,$level = CAS_MSG_INFO) {
-
- switch ($level) {
- case CAS_MSG_WARN:
- $_SESSION['_messages'][] = '<div class="cas_msg warn">' . $content . '</div>';
- break;
- case CAS_MSG_ERROR:
- $_SESSION['_messages'][] = '<div class="cas_msg error">' . $content . '</div>';
- break;
- default:
- $_SESSION['_messages'][] = '<div class="cas_msg info">' . $content . '</div>';
- break;
- }
- }
-
- public static function GetMessages() {
- $response = isset($_SESSION['_messages'])
- ? implode('', $_SESSION['_messages'])
- : false;
- unset($_SESSION['_messages']);
- return $response;
- }
-
- public function fatal($message) {
- ApplicationResponse::sendFatal($message);
- exit();
- }
-
- public static function EndUserSession() {
- // Unset all of the session variables.
- $_SESSION = array();
-
- // Finally, destroy the session.
- session_destroy();
- }
-
- public static function Redirect($newLocation) {
- header("Location: {$newLocation}");
- exit();
- }
-
- /**
- * Returns an instance of the requested DataProvider class, ensuring
- * that all necessary prerequisites are correctly loaded. To load a
- * custom DataProvider. The framework looks for a matching data
- * provider according to the following heirarchy, stopping when
- * it first finds a matching class: If the request involves a module,
- * that module's /classes/dataProviders directory is checked,
- * otherwise/then the application's classes/dataProviders directory
- * is checked, and finally (if no match found yet) the webapp-base
- * /classes/dataProviders directory is checked.
- * Data providers must be named <ProviderName>.class.php, and must
- * implement the IApplicationDataProvider interface.
- *
- * @param $class string The name of the DataProvider class
- * @param $options array optional array of constructor options.
- * These are flowed down to the DataProvider's
- * constructor function.
- * @return the data provider (must implement IApplicationDataProvider)
- *
- * Example: to get an instance of a data provider:
- * $p = $app->GetDataProvider('<ProviderName>');
- *
- * Example 2: to get an instance and pass options to the constructor
- * $p = $app->GetDataProvider('<ProviderName>',array('opt1'=>'val1'));
- *
- * Note that this will not attempt to connect to your data provider.
- * All implementations of IApplicationDataProvider offer a ::connect()
- * function, which should be invoked on the returned class to initiate
- * a connection.
- *
- */
- public function getDataProvider($class,$options = array()) {
- require_once( "Org/Apache/Oodt/Balance/Interfaces/IApplicationDataProvider.php");
- $dataProviderPath = "/classes/dataProviders/{$class}.class.php";
-
- // Check for the requested data provider in one of 3 locations. It could be:
- // 1) Part of a module
- if ($this->request->isModule &&
- is_file($this->request->moduleBase . $dataProviderPath)) {
- require_once($this->request->moduleBase . $dataProviderPath);
-
- return new $class($options);
- }
-
- // 2) Part of the application's widget collection
- if (is_file(HOME . $dataProviderPath)) {
- require_once(HOME . $dataProviderPath);
- return new $class($options);
- }
-
- // 3) Part of the webapp-base widget collection
- if (is_file(LIB . $dataProviderPath)) {
- require_once(LIB . $dataProviderPath);
- return new $class($options);
- }
- return false;
- }
-
- public function getErrorProvider(
- $class = 'Org_Apache_Oodt_Balance_Providers_Error_DefaultErrorProvider',
- $options = array()) {
-
- return new $class;
- }
-
-
- /**
- * Create an instance of the requested widget class.
- * @deprecated
- * @param unknown_type $class
- * @param unknown_type $options
- */
- public function createWidget($class,$options = array()) {
-
- require_once( "Org/Apache/Oodt/Balance/Interfaces/IApplicationWidget.php");
-
- $classPath = "/scripts/widgets/{$class}.php";
-
- // Check for the requested widget in one of 2 locations. It could be:
- // 1) Part of a module
- if ($this->request->isModule &&
- is_file($this->request->moduleBase . $classPath)) {
- require_once($this->request->moduleBase . $classPath);
- return new $class($options);
- }
-
- // 2) Part of the application's widget collection
- if (is_file(HOME . $classPath)) {
- require_once(HOME . $classPath);
- return new $class($options);
- }
-
- // No widget matching $class found...
- return false;
- }
-
- /**
- * Take any application view and 'widgetize' it. This allows developers to nest
- * application views, allowing for greater modularity and reuse.
- *
- * As an example: given an application with URIs /foo/bar and foo/baz (corresponding
- * to HOME/views/foo/bar.php and HOME/views/foo/baz.php), the content of /foo/baz can
- * be 'widgetized' (nested) within /foo/bar simply by calling this function from somewhere
- * within the host view (/foo/bar):
- *
- * <div>
- * <?php App::Get()->widgetizeView('/foo/baz');
- * </div>
- *
- * will produce:
- *
- * <div>
- * <div class="bal_widget">...contents of HOME/views/foo/baz.php...</div>
- * </div>
- *
- * The `cssClasses` parameter allows for specifying any css class definitions that should
- * be applied to the widget container. For example:
- *
- * App::Get()->widgetizeView('/foo/baz','someClass someOtherClass');
- *
- * will produce:
- *
- * <div>
- * <div class="bal_widget someClass someOtherClass">...contents...</div>
- * </div>
- *
- * @param string $contentPath The URI to the view to widgetize
- * @param string $cssClasses Any css classes to append to the widget's `classes` attribute
- * @param mixed $options An array of options (for the future... none defined yet)
- */
- public function widgetizeView($contentPath,$cssClasses = '',$options = array()) {
-
- // Create a request object for the content to be widgetized
- $request = $this->subrequest = new Org_Apache_Oodt_Balance_Core_ApplicationRequest(
- $this->settings,$contentPath);
-
- // Store the application request object prior to processing this nested request
- $parentRequest = $this->request;
-
- // Store the nested request in the application so that it can be accessed as
- // expected via App::Get()->request (for accurate segment processing, for example)
- $this->request = $request;
-
- // Generate a response for the nested request
- $response = new Org_Apache_Oodt_Balance_Core_ApplicationResponse(
- $this->settings,$request);
- $response->process(array('skipHeader' => true,'skipFooter' => true,'skipHooks' => true));
-
- //TODO: Process any options (still need to define the options available)
-
- // send the wigitized content
- echo '<div class="bal_widget ' . $cssClasses . '">'
- . $response->getViewContent()
- . '</div>';
-
- // Restore the application request
- $this->request = $parentRequest;
- $this->subrequest = null;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/lib/pear/Core/ApplicationDataResponse.class.php
----------------------------------------------------------------------
diff --git a/balance/lib/pear/Core/ApplicationDataResponse.class.php b/balance/lib/pear/Core/ApplicationDataResponse.class.php
deleted file mode 100644
index f68d12b..0000000
--- a/balance/lib/pear/Core/ApplicationDataResponse.class.php
+++ /dev/null
@@ -1,81 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- *
- * OODT Balance
- * Web Application Base Framework
- *
- * ApplicationDataResponse provides a standard response object for use by application
- * data providers.
- *
- * The ApplicationDataResponse works off of the idea that the KEY=>VALUE paradigm
- * is more or less universal and suits (or is at least compatible with) a broad array
- * of data sources. By guaranteeing that all data providers will return objects of this type
- * in response to data requests, it is possible to simplify the process of integrating
- * and assimilating data from multiple heterogeneous sources
- *
- * @author ahart
- *
- */
-class Org_Apache_Oodt_Balance_Core_ApplicationDataResponse {
-
- public $requestString;
- public $data;
- public $errorOccurred;
- public $errorMessage;
-
- public function __construct($seed = array()) {
- $this->data = $seed;
- $this->errorOccurred = false;
- }
-
- public function size() {
- return count($this->data);
- }
-
- public function count() {
- return count($this->data);
- }
-
- public function add($key,$value) {
- $this->data[$key] = $value;
- }
-
- public function bulkAdd($data) {
- $this->data = array_merge($this->data,$data);
- }
-
- public function get($key) {
- return (isset($this->data['key']))
- ? $this->data['key']
- : false;
- }
-
- public function setRequestString($request) {
- $this->requestString = $request;
- }
-
- public function error() {
- return ($this->errorOccurred);
- }
-
- public function setError($message) {
- $this->errorOccurred = true;
- $this->errorMessage = true;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/lib/pear/Core/ApplicationRequest.class.php
----------------------------------------------------------------------
diff --git a/balance/lib/pear/Core/ApplicationRequest.class.php b/balance/lib/pear/Core/ApplicationRequest.class.php
deleted file mode 100644
index a46d62b..0000000
--- a/balance/lib/pear/Core/ApplicationRequest.class.php
+++ /dev/null
@@ -1,171 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- *
- * OODT Balance
- * Web Application Base Framework
- *
- * ApplicationRequest: Provides methods for interpreting and processing
- * a resource request.
- *
- * @author ahart
- *
- */
-class Org_Apache_Oodt_Balance_Core_ApplicationRequest {
-
- public $isScript;
-
- public $config;
-
- public $uri;
-
- public $segments;
-
- public $data;
-
- public $viewPath;
-
- public $scriptPath;
-
- public $isModule;
-
- public $modulePath; // Filesystem path for module
-
- public $moduleRoot; // URL base for module
-
- public $moduleStatic; // URL base for static module assests (images,css,js,etc)
-
- public function __construct($config,$requestURI) {
-
- // Determine if this request is a script or a view
- $this->isScript = $this->isScript($requestURI);
-
- // Store the config as provided
- $this->config = $config;
-
- // Store the uri as provided
- $this->uri = htmlentities($requestURI);
-
- // Initialize the segments and view path
- $this->segments = array();
- $this->viewPath = false;
-
- // Store data associated with the request
- $this->data = $_GET;
- $this->data = array_merge($this->data,$_POST);
-
- if ($this->isScript) {
- $this->processAsScript();
- } else {
- $this->processAsView();
- }
- }
-
- protected function processAsView() {
- // Determine the view to use
- list($thePage) = explode('index.php', parse_url($this->uri, PHP_URL_PATH)); // we only care about URL path info
- $thePage = ltrim($thePage,'/');
-
- if ($thePage == '') { $thePage = 'index'; }
- $parts = explode('/',$thePage);
-
- // Determine whether a module is being requested
- $module = App::Get()->isModule($thePage);
-
- if ($module) {
- $this->isModule = true;
- $this->modulePath = $module->modulePath;
- $this->moduleRoot = $module->moduleRoot;
- $this->moduleStatic = $module->moduleStatic;
- array_shift($parts);
- }
-
- // Starting with the full request string, test for the existance of
- // a corresponding view. If none is found in the HOME
- // directory, chop off the last segment and try again. Add the chopped
- // segment to the "segments" array since it is likely a parameter.
- $partCount = count($parts);
-
- // check for view at least once
- do {
- $testPath = implode('/',$parts);
- $homeTest = (($this->isModule) ? "{$this->modulePath}/views" : $this->config['views_dir']) . '/' . $testPath . '.php';
- $homeIdxTest = (($this->isModule) ? "{$this->modulePath}/views" : $this->config['views_dir']) . '/' . $testPath . '/index.php';
-
-
- if (is_file($homeTest)) {
- $this->viewPath = $homeTest;
- break;
- }
- if (is_file($homeIdxTest)) {
- $this->viewPath = $homeIdxTest;
- break;
- }
-
- // If here, neither is a valid view, so chop the last segment
- $this->segments[] = $parts[$partCount - 1];
- array_pop($parts);
- $partCount--;
- } while ($partCount > 0);
-
- // If no view has been found by this point, display a 404 message
- if (!$this->viewPath) {
- $this->viewPath = dirname(dirname(__FILE__)) . "/views/error/404.php";
- }
-
- // Reverse the segments array so that params appear in the proper order
- $this->segments = array_reverse($this->segments);
- }
-
- protected function processAsScript() {
-
- // Determine the desired script
- list($theScript) = explode("_init.php",$this->uri);
- if ($GLOBALS['app']->settings['site_root'] != '/') {
- $theScript = str_replace($GLOBALS['app']->settings['site_root'],'',$theScript);
- }
- $theScript = str_replace(".do",".php",$theScript);
- $theScript = strpos($theScript,'?')
- ? substr($theScript,0,strpos($theScript,'?'))
- : $theScript;
- $theScript = ltrim($theScript,'/');
- $module = $GLOBALS['app']->isModule($theScript);
- if ($module) {
- $this->isModule = true;
- $this->modulePath = $module->modulePath;
- $this->moduleRoot = $module->moduleRoot;
- $this->moduleStatic = $module->moduleStatic;
- $theScript = substr($theScript,strpos($theScript,'/')+1);
- $path = $module->modulePath . "/scripts/{$theScript}";
- } else {
- $path = HOME . "/scripts/{$theScript}";
- }
-
- $this->scriptPath = $path;
- }
-
-
- protected function isScript($requestURI) {
- // Is this a script? (does the script filename end in .do?)
- $test = $requestURI;
- if (strpos($test,'?')) {
- $test = substr($test,0,strpos($test,'?'));
- }
- return (substr($test,-3,3) == '.do');
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/lib/pear/Core/ApplicationResponse.class.php
----------------------------------------------------------------------
diff --git a/balance/lib/pear/Core/ApplicationResponse.class.php b/balance/lib/pear/Core/ApplicationResponse.class.php
deleted file mode 100644
index e2e9b8d..0000000
--- a/balance/lib/pear/Core/ApplicationResponse.class.php
+++ /dev/null
@@ -1,311 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- *
- * OODT Balance
- * Web Application Base Framework
- *
- * ApplicationResponse: Provides functions for dynamically constructing
- * and delivering a response to a resource request.
- *
- * @author ahart
- *
- */
-class Org_Apache_Oodt_Balance_Core_ApplicationResponse {
-
- protected $config;
- protected $request;
-
- protected $headers;
-
- protected $header;
- protected $view;
- protected $footer;
-
- protected $stylesheets = array();
- protected $javascripts = array();
-
- protected $data;
-
- const DYN_JS_TAG = '<!-- JAVASCRIPTS -->';
- const DYN_CSS_TAG = '<!-- STYLESHEETS -->';
-
- /**
- * Constructor
- *
- * @param array $config
- * @param Org_Apache_Oodt_Balance_Core_ApplicationRequest $request
- */
- public function __construct($config,
- Org_Apache_Oodt_Balance_Core_ApplicationRequest $request) {
-
- $this->config = $config;
-
- $this->request = $request;
-
- $this->headers = array();
-
- $this->header = HOME . "/{$config['header_file_path']}";
- $this->footer = HOME . "/{$config['footer_file_path']}";
- }
-
- /**
- * Generates a response by processing the requested view,
- * including any header and footer views (if needed) as specified
- * by the application config file.
- *
- * Available options:
- * skipHeader: boolean (default = false) If present, omits header processing
- * skipFooter: boolean (default = false) If present, omits footer processing
- * skipHooks: boolean (default = false) If present, omits hook processing
- *
- * @param array $options
- */
- public function process($options = array()) {
-
- // Merge defaults with provided options
- $defaults = array(
- 'skipHeader' => false,
- 'skipFooter' => false,
- 'skipHooks' => false,
- );
- $options += $defaults;
-
- if (!$options['skipHooks']) {
- // Include the appropriate hooks.php file
- include ((App::Get()->request->isModule
- ? App::Get()->request->modulePath
- : HOME ) . '/hooks.php');
-
- // Run 'before_all' hook for all requests
- if (function_exists('hook_before_all')) {
- hook_before_all();
- }
- }
-
- // Preprocessing for a view
- if (!$this->request->isScript) {
- ob_start(); // Start buffering the output
-
- // Check that the requested view exists
- if (file_exists($this->request->viewPath)) {
-
- // Run the beforeView hook
- if (!$options['skipHooks'] && function_exists('hook_before_view')) {
- hook_before_view();
- }
- // Process the view
- include($this->request->viewPath);
- } else {
- include(HOME . "/views/errors/404.php"); // 404 error page
- }
-
- $this->view = ob_get_contents();
- ob_clean();
-
- // Determine the header view (if any) to include
- if (!$options['skipHeader'] && $this->header && is_file($this->header)) {
- // Run the beforeHeader hook
- if (!$options['skipHooks'] && function_exists('hook_before_header')) {
- hook_before_header();
- }
-
- // Process the header
- if (!empty($this->header)) {include($this->header);}
-
- $this->header = ob_get_contents();
- ob_clean();
- }
-
- // Determine the footer view (if any) to include
- if (!$options['skipFooter'] && $this->footer && is_file($this->footer)) {
- // Run the beforeFooter hook
- if (!$options['skipHooks'] && function_exists('hook_before_footer')) {
- hook_before_footer();
- }
-
- // Process the footer
- if (!empty($this->footer)) {include($this->footer);}
-
- $this->footer = ob_get_contents();
- ob_clean();
- }
-
- ob_end_clean(); // Stop buffering the output
- } else {
- require_once( $this->request->scriptPath );
- exit();
- }
- }
-
- /**
- * Actually sends the response (using 'echo') out to the
- * client's browser.
- */
- public function send() {
-
- if ($this->request->isScript) {
- if (is_file($this->request->scriptPath)) {
- require_once($this->request->scriptPath);
- } else {
- header("Location: " . SITE_ROOT . "/errors/404");
- }
- } else {
- // Process any dynamically added content
- $this->processDynamicContent();
-
- // Run the beforeSend hook
- if (function_exists('hook_before_send')) {
- hook_before_send();
- }
- foreach ($this->headers as $header) {
- header($header);
- }
- if ($this->header) {
- echo $this->header;
- }
- echo $this->view;
- if ($this->footer) {
- echo $this->footer;
- }
- // Run the afterSend hook
- if (function_exists('hook_after_send')) {
- hook_after_send();
- }
- }
- }
-
- public static function sendFatal($message) {
- // Store the message in the session
- $_SESSION['fail_message'] = $message;
-
- // Clear any old output and restart buffering the output
- ob_clean();
- ob_start();
-
- // Build the 404 error page
- include(LIB . "/views/errors/fail.php");
-
- // Get the contents as a string and flush the buffer
- $content = ob_get_contents();
-
- // Stop buffering output
- ob_end_clean();
-
- // Send the response
- echo $content;
-
- exit();
- }
-
- /**
- * Replace special tags with their dynamically assigned content. Currently, the only
- * special tags are for defining an area for CSS and JavaScript imports.
- *
- */
- protected function processDynamicContent() {
-
- // Dynamically insert CSS
- $this->header = str_replace(self::DYN_CSS_TAG,implode("\r\n",$this->stylesheets),$this->header);
- $this->view = str_replace(self::DYN_CSS_TAG,implode("\r\n",$this->stylesheets),$this->view);
- $this->footer = str_replace(self::DYN_CSS_TAG,implode("\r\n",$this->stylesheets),$this->footer);
-
- // Dynamically insert JS
- $this->header = str_replace(self::DYN_JS_TAG,implode("\r\n",$this->javascripts),$this->header);
- $this->view = str_replace(self::DYN_JS_TAG,implode("\r\n",$this->javascripts),$this->view);
- $this->footer = str_replace(self::DYN_JS_TAG,implode("\r\n",$this->javascripts),$this->footer);
-
- }
-
- public function useHeaderFile($path) {
- $this->header = $path;
- }
-
- public function useFooterFile($path) {
- $this->footer = $path;
- }
-
- public function sendHeader($headerContent) {
- $this->headers[] = $headerContent;
- }
-
- public function getHeaderContent() {
- return $this->header;
- }
- public function getViewContent() {
- return $this->view;
- }
- public function getFooterContent() {
- return $this->footer;
- }
-
- public function data($key = null, $value = null) {
-
- // Return the data store associated with this request
- if ($key == null && $value == null) {
- return $this->data;
- }
-
- // Return the stored value for the provided key
- if ($value == null) {
- return isset($this->data[$key])
- ? $this->data[$key]
- : null;
- }
-
- // Set the stored value for the key to the provided value
- $this->data[$key] = $value;
- }
-
- public function addStylesheet($href,$condition='') {
- // Build the string for the css import
- $str = "<link rel=\"stylesheet\" type=\"text/css\" href=\"{$href}\"/>";
- if (!empty($condition)) {
- $str = "<!--[if {$condition}]>{$str}<![endif]-->";
- }
- $this->stylesheets[] = $str;
- }
-
- /**
- * Add javascript resources to the response
- *
- * This function provides a clean way to programmatically include arbitrary
- * Javascript resources in the response. Depending upon the value
- * provided for 'isRaw', the contents of 'src' will either be interpreted
- * as the 'src' attribute or the body content of the generated <script> block.
- *
- * @param string src - Either the url to the resource to include (if
- * 'isRaw' = false) or a string representing the
- * raw Javascript to include (if 'isRaw' = true)
- * @param boolean isRaw - Controls how 'src' is interpreted. If set to false
- * (default), 'src' will be interpreted as a URL to the
- * Javascript resource to include. If set to true, 'src'
- * will be interpreted as a string of raw Javascript.
- */
- public function addJavascript($src, $isRaw = false) {
- if ($isRaw === true) {
- // Build a script container for the raw javascript
- $str = "<script type=\"text/javascript\">{$src}</script>";
- $this->javascripts[] = $str;
- } else {
- // Build the string for the javascript file import
- $str = "<script type=\"text/javascript\" src=\"{$src}\"></script>";
- $this->javascripts[] = $str;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/lib/pear/Interfaces/IApplicationAuthenticationProvider.php
----------------------------------------------------------------------
diff --git a/balance/lib/pear/Interfaces/IApplicationAuthenticationProvider.php b/balance/lib/pear/Interfaces/IApplicationAuthenticationProvider.php
deleted file mode 100644
index 23e3975..0000000
--- a/balance/lib/pear/Interfaces/IApplicationAuthenticationProvider.php
+++ /dev/null
@@ -1,162 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- *
- * OODT Balance
- * Web Application Base Framework
- *
- * IApplicationAuthenticationProvider defines an interface that should be
- * implemented by all authentication providers to simplify the process of
- * accessing and retrieving information about the underlying system.
- *
- * The interface defines five mandatory functions:
- * - __construct: Provide any necessary configuration information but do
- * not actually establish a connection to the underlying system.
- * - connect: This function does the work of actually connecting to the
- * underlying system. Options can be provided either here or in
- * the constructor arguments (or both), but the connection to the
- * underlying system should not be initiated until this function
- * is invoked.
- * - disconnect: Disconnect from the underlying system, performing any
- * necessary clean up operations in the process.
- * - checkLogin: Check if a valid user has logged in.
- * - login: Determine the ability to gain access to the underlying system
- * as a legitimate user. The requirements are a valid username
- * (or user ID) and password.
- * - logout: Ending the user's session to the underlying system.
- *
- *
- * Framework implementations of common authentication providers can be found in:
- * {LIB}/classes/authenticationProviders and should be named FooAuthenticationProvider.class.php.
- * Framework authentication providers can be invoked by doing:
- * $app->GetAuthenticationProvider('FooAuthenticationProvider');
- *
- * Custom authentication providers should be placed in:
- * {HOME}/classes/authenticationProviders and should be named FooAuthenticationProvider.class.php.
- * Custom authentication providers can be invoked by doing:
- * $app->GetAuthenticationProvider('foo',true); // true --> custom
- *
- * @author s.khudikyan
- *
- */
-interface Org_Apache_Oodt_Balance_Interfaces_IApplicationAuthenticationProvider {
-
- /**
- * Constructor - Instantiate the provider but do not yet connect
- * to the underlying system.
- *
- */
- public function __construct();
-
- /**
- * Initiate a connection to the underlying system.
- *
- * @return boolean True or false depending on the result
- */
- public function connect();
-
- /**
- * Disconnect from the underlying system and perform any cleanup
- * operations necessary.
- *
- * @return boolean True or false depending on the result
- */
- public function disconnect();
-
- /**
- * Check if a valid user has logged in.
- *
- * @return boolean True or false depending on the result
- */
- public function isLoggedIn();
-
- /**
- * Determine whether privileges will be granted to a particular user
- * using credentials provided.
- *
- * @param $username mixed The username is usually a string.
- * @param $password mixed The password is usually a string.
- * @return mixed True or false depending on the success of login
- */
- public function login( $username, $password );
-
- /**
- * Ending the user's session to the underlying system.
- *
- */
- public function logout();
-
- /**
- * Get current user's username.
- *
- */
- public function getCurrentUsername();
-
- /**
- * Change current user's password.
- *
- * @param $newPassword string
- * @return boolean True or false depending on the success of password change
- */
- public function changePassword( $newPassword );
-
- /**
- * Checks if user is logged in. If true, validates rules from config file and uses
- * {@link changePassword} to change password.
- *
- * @param $newPass string The new password
- * @param $encryptionMethod string The encryption method used
- */
- public function validateChangePassword( $newPass, $encryptionMethod = "SHA" );
-
- /**
- * Retrieves the set of attributes from the user's entry
- *
- * @param $username string The user for which attributes will be returned
- * @param $attributes array Attributes to retrieve
- * @return array An empty array or requested attributes
- */
- public function retrieveUserAttributes( $username, $attributes );
-
- /**
- * Creates a new account with the user information provided
- *
- * @param $userInfo array Can include different values depending on provider
- * i.e. username, firstname, lastname, email
- */
- public function addUser( $userInfo );
-
- /**
- * Uses {@link retrieveUserAttributes} to retrieve information about the provided
- * user. If count of array returned is > 0 then the username is not available.
- *
- * @param $username string The username for which a user is checking the
- * availability of
- */
- public function usernameAvailability( $username );
-
- /**
- * Updates user information with the values of provided attributes
- *
- * @param $newInfo array (key, value) based array, where keys are the user's
- * entry attribute ids and the values will replace
- * the values of those attributes
- */
- public function updateProfile( $newInfo );
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/lib/pear/Interfaces/IApplicationAuthorizationProvider.php
----------------------------------------------------------------------
diff --git a/balance/lib/pear/Interfaces/IApplicationAuthorizationProvider.php b/balance/lib/pear/Interfaces/IApplicationAuthorizationProvider.php
deleted file mode 100644
index b5bdf48..0000000
--- a/balance/lib/pear/Interfaces/IApplicationAuthorizationProvider.php
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- *
- * OODT Balance
- * Web Application Base Framework
- *
- * LDAPAuthorizationProvider defines an interface that will determine what level
- * of access a particular user should have to secured resources.
- *
- * The interface defines five mandatory functions:
- * - __construct: Provide any necessary configuration information
- *
- *
- * Framework implementations of common authorization providers can be found in:
- * Balance/Providers/Authorization
- * Framework authorization providers can be invoked by doing:
- * App:Get()->getAuthorizationProvider();
- *
- * @author s.khudikyan
- *
- */
-
-interface Org_Apache_Oodt_Balance_Interfaces_IApplicationAuthorizationProvider {
-
- /**
- * Constructor - Instantiate the provider
- *
- */
- public function __construct();
-
- /**
- * Initiate a connection to the underlying system.
- *
- * @return boolean True or false depending on the result
- */
- public function connect();
-
- /**
- * Retrieves the set of groups for specified user
- *
- * @param $username string The user for which groups will be returned
- * @return array An empty array or groups the user belongs to
- */
- public function retrieveGroupsForUser( $username );
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/lib/pear/Interfaces/IApplicationDataProvider.php
----------------------------------------------------------------------
diff --git a/balance/lib/pear/Interfaces/IApplicationDataProvider.php b/balance/lib/pear/Interfaces/IApplicationDataProvider.php
deleted file mode 100644
index b78d7a7..0000000
--- a/balance/lib/pear/Interfaces/IApplicationDataProvider.php
+++ /dev/null
@@ -1,125 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- *
- * OODT Balance
- * Web Application Base Framework
- *
- * IApplicationDataProvider defines an interface that should be implemented
- * by all data providers to simplify the process of integrating and accessing
- * multiple heterogeneous data sources. A data source could be a relational
- * SQL-like database, a CAS File Manager, an LDAP server, anything that can
- * be queried for data.
- *
- * The interface defines five mandatory functions:
- * - __construct: Provide any necessary configuration information but do
- * not actually establish a connection to the underlying data
- * source.
- * - connect: This function does the work of actually connecting to the
- * underlying data source. Options can be provided either here
- * or in the constructor arguments (or both), but the connection
- * to the underlying data source should not be initiated until
- * this function is invoked.
- * - disconnect: Disconnect from the underlying data source, performing any
- * necessary clean up operations in the process.
- * - request: Satisfy a request for data. The format that this request takes
- * will likely differ across implementations. An array of further
- * options may be provided as an optional second argument. As a
- * concrete example, an SQL-like data source may support string
- * requests like "SELECT * FROM foo WHERE bar='baz'". The
- * response from this call must be an ApplicationDataResponse object
- * containing the (possibly multidimensional) array of response info.
- * - command: Send a command to the underlying data source. As with request,
- * the format that this command takes will likely differ across
- * implementations. As a concrete example, an SQL-like data source
- * may support string commands like "UPDATE foo set bar='baz'".
- * Command should not be expected to return a value, other than
- * possibly true/false to indicate the success of the call.
- *
- *
- * Framework implementations of common data providers can be found in:
- * {LIB}/classes/dataProviders and should be named FooDataProvider.class.php.
- * Framework data providers can be invoked by doing:
- * $app->GetDataProvider('FooDataProvider');
- *
- * Custom data providers should be placed in:
- * {HOME}/classes/dataProviders and should be named FooDataProvider.class.php.
- * Custom data providers can be invoked by doing:
- * $app->GetDataProvider('foo',true); // true --> custom
- *
- * @author ahart
- *
- */
-interface Org_Apache_Oodt_Balance_Interfaces_IApplicationDataProvider {
-
- /**
- * Constructor - Instantiate the provider but do not yet connect
- * to the underlying data source.
- *
- * @param $options array An optional set of configuration values
- */
- public function __construct($options = array());
-
- /**
- * Initiate a connection to the underlying data source
- *
- * @param $options array An optional set of configuration values
- * @return boolean True or false depending on the result
- */
- public function connect($options = array());
-
- /**
- * Disconnect from the underlying data source and perform any
- * cleanup operations necessary.
- *
- * @param $options array An optional set of configuration values
- * @return unknown_type True or false depending on the result
- */
- public function disconnect($options = array());
-
- /**
- * Request data from the underlying data source.
- *
- * @param $request mixed The request itself, usually a string. The nature
- * of the request is necessarily implementation
- * specific and will vary across providers. For a
- * SQL-like relational provider, this will likely be
- * a "SELECT ..." string.
- * @param $options array An array of options to configure the request.
- * These will be implementation-specific and
- * therefore will likely differ across providers.
- * @return ApplicationDataResponse The resulting data retrieved
- */
- public function request($request,$options = array());
-
- /**
- * Send a command to the underlying data source.
- *
- * @param $command mixed The command itself, usually a string. The nature
- * of the command is necessarily implementation
- * specific and will vary across providers. For a
- * SQL-like relational provider, this will likely be
- * a "UPDATE ...", or "CREATE ..." string.
- * @param $options array An array of options to configure the command.
- * These will be implementation-specific and
- * therefore will likely differ across providers.
- * @return boolean True or false depending on the success of the command
- */
- public function command($command,$options = array());
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/lib/pear/Interfaces/IApplicationErrorProvider.php
----------------------------------------------------------------------
diff --git a/balance/lib/pear/Interfaces/IApplicationErrorProvider.php b/balance/lib/pear/Interfaces/IApplicationErrorProvider.php
deleted file mode 100644
index 63262a1..0000000
--- a/balance/lib/pear/Interfaces/IApplicationErrorProvider.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- *
- * OODT Balance
- * Web Application Base Framework
- *
- * IApplicationErrorProvider defines an interface that should be implemented
- * by all error providers to simplify the process of formatting and displaying
- * application errors.
- *
- *
- * @author ahart
- */
-interface Org_Apache_Oodt_Balance_Interfaces_IApplicationErrorProvider {
-
- /**
- * Causes an error response to be sent to the sender
- *
- * @param integer $httpResponseCode The HTTP response code to send
- * @param string $message A contextual message to include or log
- */
- public function error($httpResponseCode,$message = '',$options=array());
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/lib/pear/Interfaces/IApplicationWidget.php
----------------------------------------------------------------------
diff --git a/balance/lib/pear/Interfaces/IApplicationWidget.php b/balance/lib/pear/Interfaces/IApplicationWidget.php
deleted file mode 100644
index b1e4831..0000000
--- a/balance/lib/pear/Interfaces/IApplicationWidget.php
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- *
- * OODT Balance
- * Web Application Base Framework
- *
- * Interface for developing widgets (reusable bits of view code) that can
- * be placed on different application pages.
- *
- * This interface defines two mandatory functions:
- * - construct : Intialize the widget and provide any necessary
- * configuration information
- * - render : Build the HTML output that constitutes the widget. This
- * function does not accept arguments (any config should
- * be provided either in the controller or via other "set"
- * functions. This function should return a string composed
- * of the final HTML output of the widget.
- *
- * Framework widgets can be found inside the {LIB}/scripts/widgets directory.
- *
- * Framework Widgets can be invoked from view code as follows:
- * // Create an instance of the widget (will transparently call __construct)
- * $myFooWidget = $app->createWidget('FooWidget',array(..config..))
- *
- * Custom widgets should be placed inside the {HOME}/scripts/widgets directory and
- * can be named FooWidget.php. All widgets must implement this interface.
- *
- * Custom Widgets can be invoked from view code as follows:
- * // Create an instance of the widget (will transparently call __construct)
- * $myFooWidget = $app->createWidget('FooWidget',array(..config..),true) // true --> custom
- *
- * <!-- (all widgets, framework or custom): display widget contents -->
- * <span><?php echo $myFooWidget->render()?></span>
- *
- * @author ahart
- *
- */
-interface Org_Apache_Oodt_Balance_Interfaces_IApplicationWidget {
-
- public function __construct($options = array());
-
- /**
- * Build the HTML output that constitutes the widget.
- *
- * @param boolean $bEcho (default = true) If true, the function should
- * echo the contents directly. If false, the contents should be
- * returned as a string.
- */
- public function render($bEcho = true);
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/lib/pear/Providers/Authentication/LDAPAuthenticationProvider.class.php
----------------------------------------------------------------------
diff --git a/balance/lib/pear/Providers/Authentication/LDAPAuthenticationProvider.class.php b/balance/lib/pear/Providers/Authentication/LDAPAuthenticationProvider.class.php
deleted file mode 100644
index 9e4c6f9..0000000
--- a/balance/lib/pear/Providers/Authentication/LDAPAuthenticationProvider.class.php
+++ /dev/null
@@ -1,170 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- *
- * OODT Balance
- * Web Application Base Framework
- *
- * Implementation of iApplicationAuthenticationProvider, which extends SingleSignOn.
- *
- * Note: This class has a dependency on the OODT CAS-SSO package.
- * The necessary files can be found at http://pear.apache.org/oodt/
- * along with installation instructions.
- *
- * @author s.khudikyan
- * @author ahart
- *
- */
-require("Org/Apache/Oodt/Security/SingleSignOn.php");
-
-class Org_Apache_Oodt_Balance_Providers_Authentication_LDAPAuthenticationProvider
- extends Org_Apache_Oodt_Security_SingleSignOn
- implements Org_Apache_Oodt_Balance_Interfaces_IApplicationAuthenticationProvider {
-
- /**
- * If authentication config file exists, require(file_name) file
- */
- public function __construct() {
-
- // set LDAP constants
- define("CAS_SECURITY",true);
- define("SSO_LDAP_HOST", App::Get()->settings['ldap_host']);
- define("SSO_LDAP_PORT", App::Get()->settings['ldap_port']);
- define("SSO_BASE_DN", App::Get()->settings['ldap_base_dn']);
- define("SSO_GROUPS_DN", App::Get()->settings['ldap_group_dn']);
- define("SSO_COOKIE_KEY", App::Get()->settings['cookie_key']);
-
- }
-
- public function connect() {
- return parent::connect(func_get_arg(0),func_get_arg(1));
- }
-
- public function disconnect() {
-
- }
-
- public function isLoggedIn() {
- return parent::isLoggedIn();
- }
-
- public function login( $username, $password ) {
- return parent::login( $username, $password );
- }
-
- public function logout() {
- parent::logout();
- }
-
- public function getCurrentUsername() {
- return parent::getCurrentUsername();
- }
-
- public function changePassword( $newPassword ) {
- if ( App::Get()->settings['authentication_encryption_method'] ) {
- return parent::changePassword( $newPassword, App::Get()->settings['authentication_encryption_method'] );
- }
- return parent::changePassword( $newPassword );
- }
-
- public function validateChangePassword( $newPass, $encryptionMethod = "SHA" ) {
- $isValid = true;
- $messages = array();
- // validate rules from config file
- $rules = App::Get()->settings['security_password_rules'];
-
- if ( isset($rules) ) {
- foreach( $rules as $rule ){
-
- // Separate the rule from the error message
- list($regularExpression,$errorMessage) = explode('|',$rule,2);
-
- // Test the rule
- $rulePassed = preg_match($regularExpression, $newPass);
-
- // If the rule failed, append the error message
- if (!$rulePassed) {
- $messages[] = $errorMessage;
- $isValid = false;
- }
- }
- }
-
- if ($isValid && $this->connect(SSO_LDAP_HOST,SSO_LDAP_PORT)) {
- $result = $this->changePassword($newPass,$encryptionMethod);
- return true;
- } else
- return $messages;
- }
-
- public function retrieveUserAttributes( $username, $attributes ) {
- $rawArray = parent::retrieveUserAttributes( $username, $attributes );
- $userAttributes = array();
-
- if ( count($rawArray) > 1 ) {
- $rawArray = $rawArray[0];
- // Get only necessary attributes to return
- foreach ( $rawArray as $key=>$keyValue ) {
- foreach ( $attributes as $value ) {
- if ( $key === $value ) {
- $userAttributes[$key] = $keyValue[0];
- }
- }
- }
- }
- return $userAttributes;
- }
-
- public function addUser($userInfo) {
- $ldapconn = $this->connect(SSO_LDAP_HOST,SSO_LDAP_PORT);
- if ($ldapconn) {
- $user = "uid={$userInfo[ "uid" ]}," . SSO_BASE_DN;
- return ldap_add($ldapconn,$user,$userInfo);
- }
- // connection failed
- return false;
- }
-
- public function usernameAvailability( $username ) {
- $justthese = array( App::Get()->settings['username_attr'] );
- $profile = $this->retrieveUserAttributes($username, $justthese);
- if (count($profile) > 0) {
- return false;
- } else {
- // available
- return true;
- }
- }
-
- public function updateProfile($newInfo) {
-
- if ($this->isLoggedIn()) {
- $user = "uid={$this->getCurrentUsername()}," . SSO_BASE_DN ;
- $ldapconn = $this->connect(SSO_LDAP_HOST,SSO_LDAP_PORT);
-
- if (ldap_mod_replace($ldapconn,$user,$newInfo)) {
- return true;
- } else {
- return false;
- }
- } else {
- return false;
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/lib/pear/Providers/Authorization/LDAPAuthorizationProvider.class.php
----------------------------------------------------------------------
diff --git a/balance/lib/pear/Providers/Authorization/LDAPAuthorizationProvider.class.php b/balance/lib/pear/Providers/Authorization/LDAPAuthorizationProvider.class.php
deleted file mode 100644
index 764dfc8..0000000
--- a/balance/lib/pear/Providers/Authorization/LDAPAuthorizationProvider.class.php
+++ /dev/null
@@ -1,109 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- *
- * OODT Balance
- * Web Application Base Framework
- *
- * IApplicationAuthenticationProvider defines an interface that should be
- * implemented by all authentication providers to simplify the process of
- * accessing and retrieving information about the underlying system.
- *
- * The interface defines five mandatory functions:
- * - __construct: Provide any necessary configuration information but do
- * not actually establish a connection to the underlying system.
- * - connect: This function does the work of actually connecting to the
- * underlying system. Options can be provided either here or in
- * the constructor arguments (or both), but the connection to the
- * underlying system should not be initiated until this function
- * is invoked.
- * - disconnect: Disconnect from the underlying system, performing any
- * necessary clean up operations in the process.
- * - checkLogin: Check if a valid user has logged in.
- * - login: Determine the ability to gain access to the underlying system
- * as a legitimate user. The requirements are a valid username
- * (or user ID) and password.
- * - logout: Ending the user's session to the underlying system.
- *
- *
- * Framework implementations of common authentication providers can be found in:
- * {LIB}/classes/authenticationProviders and should be named FooAuthenticationProvider.class.php.
- * Framework authentication providers can be invoked by doing:
- * $app->GetAuthenticationProvider('FooAuthenticationProvider');
- *
- * Custom authentication providers should be placed in:
- * {HOME}/classes/authenticationProviders and should be named FooAuthenticationProvider.class.php.
- * Custom authentication providers can be invoked by doing:
- * $app->GetAuthenticationProvider('foo',true); // true --> custom
- *
- * @author s.khudikyan
- *
- */
-
-class Org_Apache_Oodt_Balance_Providers_Authorization_LDAPAuthorizationProvider
- implements Org_Apache_Oodt_Balance_Interfaces_IApplicationAuthorizationProvider {
-
- /**
- * If authorization config file exists, require(file_name) file
- */
- public function __construct() {
- // Set LDAP constants
- define("AUTH_BASE_DN", App::Get()->settings['authorization_ldap_base_dn']);
- define("AUTH_GROUPS_DN", App::Get()->settings['authorization_ldap_group_dn']);
- define("AUTH_LDAP_HOST", App::Get()->settings['authorization_ldap_host']);
- define("AUTH_LDAP_PORT", App::Get()->settings['authorization_ldap_port']);
- }
-
- public function retrieveGroupsForUser($username,$searchDirectory = AUTH_GROUPS_DN) {
-
- // attempt to connect to ldap server
- $ldapconn = $this->connect(AUTH_LDAP_HOST,AUTH_LDAP_PORT);
- $groups = array();
- if ($ldapconn) {
- $filter = "(&(objectClass=groupOfUniqueNames)"
- ."(uniqueMember=uid={$username}," . AUTH_BASE_DN . "))";
- $result = ldap_search($ldapconn,$searchDirectory,$filter,array('cn'));
-
- if ($result) {
- $entries = ldap_get_entries($ldapconn,$result);
- foreach ($entries as $rawGroup) {
- if (isset($rawGroup['cn'][0])
- && $rawGroup['cn'][0] != '') {
- $groups[] = $rawGroup['cn'][0];
- }
- }
- }
- }
- return $groups;
- }
-
- public function connect() {
- if ($conn = ldap_connect(func_get_arg(0),func_get_arg(1))) {
- // Connection established
- $this->connectionStatus = 1;
- ldap_set_option($conn, LDAP_OPT_PROTOCOL_VERSION, 3);
- ldap_set_option($conn, LDAP_OPT_DEBUG_LEVEL, 7);
- ldap_set_option($conn, LDAP_OPT_REFERRALS, 0);
- $this->conn = $conn;
- return $conn;
- } else {
- // Connection failed
- return false;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/lib/pear/Providers/Data/MDB2DataProvider.class.php
----------------------------------------------------------------------
diff --git a/balance/lib/pear/Providers/Data/MDB2DataProvider.class.php b/balance/lib/pear/Providers/Data/MDB2DataProvider.class.php
deleted file mode 100644
index 839c02d..0000000
--- a/balance/lib/pear/Providers/Data/MDB2DataProvider.class.php
+++ /dev/null
@@ -1,137 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- *
- * OODT Balance
- * Web Application Base Framework
- *
- * Implementation of IApplicationDataProvider for PEAR MDB2.
- *
- * @author s.khudikyan
- * @author ahart
- *
- */
-require_once( 'MDB2.php' );
-
-class Org_Apache_Oodt_Balance_Providers_Data_MDB2DataProvider
- implements Org_Apache_Oodt_Balance_Interfaces_IApplicationDataProvider {
-
- public $link;
-
- public function __construct($options = array()) {
-
- }
-
- public function connect($options = array()) {
- $dsn = 'mysql://'.$options['username'].':'.$options['password'].'@'.$options['server'].'/'.$options['database'];
- $this->link = MDB2::singleton( $dsn );
-
- if ( PEAR::isError($this->link) ) {
-
- die("There was an error connecting to the database: " . $this->link->getMessage());
- }
- }
-
- public function disconnect($options = array()) {
- if ($this->link) {
- $this->link->disconnect();
- }
- }
-
- public function request($request,$options = array() ) {
- $data = new Org_Apache_Oodt_Balance_Core_ApplicationDataResponse();
-
- if ($this->link) {
-
- // Handle associative array
- if (isset($options['format']) &&
- strtolower($options['format']) == 'assoc') {
-
- // Execute the request and build a response object
- $result = $this->link->queryAll($request,null,MDB2_FETCHMODE_ASSOC);
- }
-
- // Handle numeric array
- else {
-
- // Execute the request and build a response object
- $result = $this->link->queryAll($request,null,MDB2_FETCHMODE_ORDERED);
- }
-
- if ( PEAR::isError($result) ) {
-
- $data->setError($result->getMessage());
- return $data;
- } else {
-
- // Store the request used to generate the data
- $data->bulkAdd($result);
-
- // Free the request
- $this->link->free();
-
- // Return the requested data
- return $data;
- }
- } else {
- $data->setError("Unable to establish connection to data source");
- return $data;
- }
- }
-
- public function command($command,$options = array()) {
- $data = new Org_Apache_Oodt_Balance_Core_ApplicationDataResponse();
-
- if ($this->link) {
-
- $result = $this->link->exec($command);
-
- if ( PEAR::isError($result) ) {
-
- $data->setError($result->getMessage());
- return $data;
- }
- } else {
- $data->setError("Unable to establish connection to data source");
- return $data;
- }
- }
-
- public function lastInsertedId($options = array()){
- $data = new Org_Apache_Oodt_Balance_Core_ApplicationDataResponse();
-
- if ($this->link) {
-
- $result = $this->link->lastInsertId();
-
- if ( PEAR::isError($result) ) {
-
- $data->setError($result->getMessage());
- return $data;
- } else {
-
- return $result;
-
- }
- } else {
- $data->setError("Unable to establish connection to data source");
- return $data;
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/lib/pear/Providers/Data/MySqlDataProvider.class.php
----------------------------------------------------------------------
diff --git a/balance/lib/pear/Providers/Data/MySqlDataProvider.class.php b/balance/lib/pear/Providers/Data/MySqlDataProvider.class.php
deleted file mode 100644
index fac93c4..0000000
--- a/balance/lib/pear/Providers/Data/MySqlDataProvider.class.php
+++ /dev/null
@@ -1,128 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- *
- * OODT Balance
- * Web Application Base Framework
- *
- * Implementation of IApplicationDataProvider for a MySql database.
- *
- * @author ahart
- *
- */
-class Org_Apache_Oodt_Balance_Providers_Data_MySqlDataProvider
- implements Org_Apache_Oodt_Balance_Interfaces_IApplicationDataProvider {
-
- public $link;
-
- public function __construct($options = array()) {
-
- }
-
- public function connect($options = array()) {
- $this->link = mysql_connect($options['server'],
- $options['username'],
- $options['password']) or
- die("Could not connect: " . mysql_error());
- mysql_select_db($options['database'],$this->link) or
- die("Could not select database: " . mysql_error());
- }
-
- public function disconnect($options = array()) {
- if ($this->link) {
- mysql_close($this->link);
- }
- }
-
- public function request($request,$options = array()) {
- if ($this->link) {
-
- // Execute the request and build a response object
- $raw = mysql_query($request,$this->link);
- $data = new Org_Apache_Oodt_Balance_Core_ApplicationDataResponse();
-
- if ('' != ($errMessage = mysql_error($this->link))) {
- $data->setError($errMessage);
- return $data;
- } else {
-
- // Handle associative array
- if (isset($options['format']) &&
- strtolower($options['format']) == 'assoc') {
- $idx = 0;
- while (false !== $row = mysql_fetch_assoc($raw)) {
- if (isset($options['indexKey'])) {
- $data->add($raw[$options['indexKey']],$row);
- } else {
- $data->add($idx++,$row);
- }
- }
- }
-
- // Handle numeric array
- else {
- $idx = 0;
- while (false !== $row = mysql_fetch_row($raw)) {
- if (isset($options['indexKey'])) {
- $data->add($raw[$options['indexKey']],$row);
- } else {
- $data->add($idx++,$row);
- }
- }
- }
-
- // Store the request used to generate the data
- $data->setRequestString($request);
-
- // Free the request
- mysql_free_result($raw);
-
- // Return the requested data
- return $data;
- }
- } else {
- $data = new Org_Apache_Oodt_Balance_Core_ApplicationDataResponse();
- $data->setError("Unable to establish connection to data source");
- return $data;
- }
- }
-
- public function command($command,$options = array()) {
- if ($this->link) {
-
- mysql_query($command);
-
- } else {
- $data = Org_Apache_Oodt_Balance_Core_ApplicationDataResponse();
- $data->setError("Unable to establish connection to data source");
- return $data;
- }
- }
-
- public function lastInsertedId($options = array()){
- if ($this->link) {
-
- return mysql_insert_id();
-
- } else {
- $data = Org_Apache_Oodt_Balance_Core_ApplicationDataResponse();
- $data->setError("Unable to establish connection to data source");
- return $data;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/lib/pear/Providers/Data/PDODataProvider.class.php
----------------------------------------------------------------------
diff --git a/balance/lib/pear/Providers/Data/PDODataProvider.class.php b/balance/lib/pear/Providers/Data/PDODataProvider.class.php
deleted file mode 100644
index d32530c..0000000
--- a/balance/lib/pear/Providers/Data/PDODataProvider.class.php
+++ /dev/null
@@ -1,142 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- *
- * OODT Balance
- * Web Application Base Framework
- *
- * Implementation of IApplicationDataProvider for PHP PDO.
- *
- * @author s.khudikyan
- * @author ahart
- *
- */
-class Org_Apache_Oodt_Balance_Providers_Data_PDODataProvider
- implements Org_Apache_Oodt_Balance_Interfaces_IApplicationDataProvider {
-
- public $link;
-
- public function __construct($options = array()) {
-
- }
-
- public function connect($options = array()) {
- try {
- $dsn = 'mysql:host='.$options['server'].';dbname='.$options['database'];
- $this->link = new PDO( $dsn, $options['username'], $options['password'] );
- } catch (PDOException $e) {
- die("There was an error connecting to the database: " . $e->getMessage());
- }
- }
-
- public function disconnect($options = array()) {
- if ($this->link) {
- /*** close the database connection ***/
- $this->link = null;
- }
- }
-
- public function request($request,$options = array() ) {
- $data = new Org_Apache_Oodt_Balance_Core_ApplicationDataResponse();
-
- if ($this->link) {
-
- // Handle associative array
- if (isset($options['format']) &&
- strtolower($options['format']) == 'assoc') {
-
- try {
- // fetch into an PDOStatement object
- $stmt = $this->link->queryAll($request);
- $result = $stmt->fetch(PDO::FETCH_ASSOC);
- } catch (PDOException $e) {
-
- $data->setError( $e->getMessage() );
- return $data;
- }
- }
-
- // Handle numeric array
- else {
- try {
- // fetch into an PDOStatement object
- $stmt = $this->link->queryAll($request);
- $result = $stmt->fetch(PDO::FETCH_NUM);
- } catch (PDOException $e) {
-
- $data->setError( $e->getMessage() );
- return $data;
- }
- }
-
- // Store the request used to generate the data
- $data->bulkAdd($result);
-
- // Free the request
- $this->link->free();
-
- // Return the requested data
- return $data;
-
- } else {
- $data->setError("Unable to establish connection to data source");
- return $data;
- }
- }
-
- public function command($command,$options = array()) {
- $data = new Org_Apache_Oodt_Balance_Core_ApplicationDataResponse();
-
- if ($this->link) {
-
- try {
-
- $result = $this->link->exec( $command );
- } catch (PDOException $e) {
-
- $data->setError( $e->getMessage() );
- return $data;
- }
-
- } else {
- $data->setError( "Unable to establish connection to data source" );
- return $data;
- }
- }
-
- public function lastInsertedId($options = array()){
- $data = new Org_Apache_Oodt_Balance_Core_ApplicationDataResponse();
-
- if ($this->link) {
-
- try {
- $lastId = $this->link->lastInsertId();
- } catch (PDOException $e) {
-
- $data->setError( $e->getMessage() );
- return $data;
- }
- return $lastId;
-
- } else {
- $data->setError("Unable to establish connection to data source");
- return $data;
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/lib/pear/Providers/Error/DefaultErrorProvider.class.php
----------------------------------------------------------------------
diff --git a/balance/lib/pear/Providers/Error/DefaultErrorProvider.class.php b/balance/lib/pear/Providers/Error/DefaultErrorProvider.class.php
deleted file mode 100644
index 6c929f2..0000000
--- a/balance/lib/pear/Providers/Error/DefaultErrorProvider.class.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- *
- * OODT Balance
- * Web Application Base Framework
- *
- * A very simple default implementation of the IApplicationErrorProvider
- * interface that simply looks for a view in HOME/views/common/###.php where
- * ### matches the provided http code.
- *
- * @author ahart
- */
-class Org_Apache_Oodt_Balance_Providers_Error_DefaultErrorProvider
- implements Org_Apache_Oodt_Balance_Interfaces_IApplicationErrorProvider {
-
-
- public function error($httpResponseCode,$message = '',$options = array()) {
- require(HOME . '/views/error/' . $httpResponseCode . '.php');
- exit();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/lib/pear/README
----------------------------------------------------------------------
diff --git a/balance/lib/pear/README b/balance/lib/pear/README
deleted file mode 100644
index 5254dd1..0000000
--- a/balance/lib/pear/README
+++ /dev/null
@@ -1,34 +0,0 @@
-OODT Balance - Framework Library
-
-OVERVIEW
-====================
-
-This is the OODT Balance Framework library. It provides a common codebase
-upon which to build PHP web applications utilizing the OODT framework.
-
-More information about the project is available at http://oodt.apache.org/
-
-INSTALLATION
-====================
-
-The library is provided as a PHP Extension and Application Repository (PEAR)
-package. More information on how to install the PEAR package manager on your
-system can be found at: http://pear.php.net/manual/en/installation.php
-
-Assuming you have the PEAR package manager installed correctly:
-
-1) "cd" into the src/pear directory (you should see a package.xml file)
-2) Build the pear package:
- $ pear package
-3) Install the resulting tarball:
- $ (sudo) pear install --force Org_Apache_Oodt_Balance_...tgz
-
-
-USAGE
-=====================
-
-This library forms a codebase upon which applications can be developed. It is a
-prerequisite for Balance application development, but can do nothing on its own.
-For information on creating and developing applications that target this library,
-visit http://oodt.apache.org/
-
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/lib/pear/package.xml
----------------------------------------------------------------------
diff --git a/balance/lib/pear/package.xml b/balance/lib/pear/package.xml
deleted file mode 100644
index dc5c5a3..0000000
--- a/balance/lib/pear/package.xml
+++ /dev/null
@@ -1,136 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
--->
-<!--
- @package Org_Apache_Oodt_Balance
- @author Andrew F. Hart
- @version $Id$
--->
-<package version="2.0" xmlns="http://pear.php.net/dtd/package-2.0"
- xmlns:tasks="http://pear.php.net/dtd/tasks-1.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0.xsd
- http://pear.php.net/dtd/package-2.0
- http://pear.php.net/dtd/package-2.0.xsd">
- <name>Apache_OODT_Balance</name>
- <channel>pear.apache.org/oodt</channel>
- <summary>OODT Balance Webapp Base Package</summary>
- <description>
- This package provides the OODT Balance webapp-base package required
- by all Balance-based web applications.
- </description>
- <lead>
- <name>Andrew Hart</name>
- <user>ahart</user>
- <email>ahart@apache.org</email>
- <active>yes</active>
- </lead>
- <date>2013-06-29</date>
- <version>
- <release>0.6.0</release>
- <api>0.6.0</api>
- </version>
- <stability>
- <release>stable</release>
- <api>stable</api>
- </stability>
- <license uri="http://www.apache.org/licenses/LICENSE-2.0">ASL 2.0 License</license>
- <notes>
- This package provides the OODT Balance webapp-base package required
- by all Balance-based web applications.
- </notes>
- <contents>
- <dir name="/" baseinstalldir="Org/Apache/Oodt/Balance">
- <dir name="Boot">
- <file name="bootstrap.php" role="php"/>
- </dir>
- <dir name="Core">
- <file name="Application.class.php" role="php"/>
- <file name="ApplicationDataResponse.class.php" role="php"/>
- <file name="ApplicationRequest.class.php" role="php"/>
- <file name="ApplicationResponse.class.php" role="php"/>
- </dir>
- <dir name="Interfaces">
- <file name="IApplicationAuthenticationProvider.php" role="php"/>
- <file name="IApplicationAuthorizationProvider.php" role="php"/>
- <file name="IApplicationDataProvider.php" role="php"/>
- <file name="IApplicationErrorProvider.php" role="php"/>
- <file name="IApplicationWidget.php" role="php"/>
- </dir>
- <dir name="Providers">
- <dir name="Authentication">
- <file name="LDAPAuthenticationProvider.class.php" role="php"/>
- </dir>
- <dir name="Authorization">
- <file name="LDAPAuthorizationProvider.class.php" role="php"/>
- </dir>
- <dir name="Data">
- <file name="MySqlDataProvider.class.php" role="php"/>
- </dir>
- <dir name="Error">
- <file name="DefaultErrorProvider.class.php" role="php"/>
- </dir>
- </dir>
- </dir><!-- / -->
- </contents>
- <dependencies>
- <required>
- <php>
- <min>5.1.6</min>
- </php>
- <pearinstaller>
- <min>1.6.1</min>
- </pearinstaller>
- </required>
- </dependencies>
- <phprelease />
- <changelog>
- <release>
- <version>
- <release>0.2.0</release>
- <api>0.2.0</api>
- </version>
- <stability>
- <release>stable</release>
- <api>stable</api>
- </stability>
- <date>2011-02-03</date>
- <license uri="http://oodt.jpl.nasa.gov">OODT License</license>
- <notes>
- Improvements to the core library to support more flexible use
- of modules and greater reusability.
- </notes>
- </release>
- <release>
- <version>
- <release>0.1.0</release>
- <api>0.1.0</api>
- </version>
- <stability>
- <release>stable</release>
- <api>stable</api>
- </stability>
- <date>2010-11-01</date>
- <license uri="http://oodt.jpl.nasa.gov">OODT License</license>
- <notes>
- This release marks the first release of the OODT Balance webapp-base package.
- </notes>
- </release>
- </changelog>
-</package>
[29/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelClientFactory.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelClientFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelClientFactory.java
deleted file mode 100644
index fb01ac0..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelClientFactory.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.server.channel.xmlrpc;
-
-//JDK imports
-import java.net.URL;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.server.channel.CommunicationChannelClient;
-import org.apache.oodt.cas.catalog.server.channel.CommunicationChannelClientFactory;
-
-//Spring imports
-import org.springframework.beans.factory.annotation.Required;
-
-//OODT imports
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A Factory for creating XmlRpcCommunicationChannelServer
- * <p>
- */
-public class XmlRpcCommunicationChannelClientFactory implements
- CommunicationChannelClientFactory {
-
- private static Logger LOG = Logger.getLogger(XmlRpcCommunicationChannelClientFactory.class.getName());
-
- protected String serverUrl;
- protected int connectionTimeout;
- protected int requestTimeout;
- protected int chunkSize;
-
- public XmlRpcCommunicationChannelClientFactory() {}
-
- public CommunicationChannelClient createCommunicationChannelClient() {
- try {
- return new XmlRpcCommunicationChannelClient(new URL(this.serverUrl), this.connectionTimeout, this.requestTimeout, this.chunkSize);
- }catch (Exception e) {
- LOG.log(Level.SEVERE, "Failed to create XmlRpcCommunicationChannelClient : " + e.getMessage(), e);
- return null;
- }
- }
-
- @Required
- public void setServerUrl(String serverUrl) {
- this.serverUrl = serverUrl;
- }
-
- public String getServerUrl() {
- return this.serverUrl;
- }
-
- /**
- * @param connectionTimeout timeout for client in minutes
- */
- @Required
- public void setConnectionTimeout(int connectionTimeout) {
- this.connectionTimeout = connectionTimeout;
- }
-
- /**
- *
- * @param requestTimeout timout for client in minutes
- */
- @Required
- public void setRequestTimeout(int requestTimeout) {
- this.requestTimeout = requestTimeout;
- }
-
- @Required
- public void setChunkSize(int chunkSize) {
- this.chunkSize = chunkSize;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServer.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServer.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServer.java
deleted file mode 100644
index 5540d44..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServer.java
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.server.channel.xmlrpc;
-
-//JDK imports
-
-import org.apache.oodt.cas.catalog.exception.CatalogServiceException;
-import org.apache.oodt.cas.catalog.page.CatalogReceipt;
-import org.apache.oodt.cas.catalog.page.Page;
-import org.apache.oodt.cas.catalog.page.PageInfo;
-import org.apache.oodt.cas.catalog.page.QueryPager;
-import org.apache.oodt.cas.catalog.query.QueryExpression;
-import org.apache.oodt.cas.catalog.server.channel.AbstractCommunicationChannelServer;
-import org.apache.oodt.cas.catalog.struct.Dictionary;
-import org.apache.oodt.cas.catalog.struct.Index;
-import org.apache.oodt.cas.catalog.struct.TransactionId;
-import org.apache.oodt.cas.catalog.system.Catalog;
-import org.apache.oodt.cas.metadata.Metadata;
-import org.apache.xmlrpc.WebServer;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.List;
-import java.util.Set;
-
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A Communication Channel Server over XML-RPC
- * <p>
- */
-public class XmlRpcCommunicationChannelServer extends
- AbstractCommunicationChannelServer {
-
- private WebServer webServer;
-
- public XmlRpcCommunicationChannelServer() {
- super();
- }
-
- public void startup() {
- this.webServer = new WebServer(this.port);
- this.webServer.addHandler(this.getClass().getSimpleName(), this);
- this.webServer.start();
- }
-
- public boolean xmlrpc_shutdown() throws CatalogServiceException {
- this.shutdown();
- this.webServer.shutdown();
- this.webServer = null;
- return true;
- }
-
- public boolean xmlrpc_addCatalog(String catalogObject) throws CatalogServiceException {
- this.addCatalog(this.serializer.deserializeObject(Catalog.class, catalogObject));
- return true;
- }
-
- public boolean xmlrpc_replaceCatalog(String catalogObject) throws CatalogServiceException {
- this.replaceCatalog(this.serializer.deserializeObject(Catalog.class, catalogObject));
- return true;
- }
-
- public boolean xmlrpc_addCatalog(String catalogId, String indexObject) throws CatalogServiceException {
- this.addCatalog(catalogId, this.serializer.deserializeObject(Index.class, indexObject));
- return true;
- }
-
- public boolean xmlrpc_addCatalog(String catalogId, String indexObject, String dictionariesObject) throws CatalogServiceException {
- this.addCatalog(catalogId, this.serializer.deserializeObject(Index.class, indexObject), this.serializer.deserializeObject(List.class, dictionariesObject));
- return true;
- }
-
- public boolean xmlrpc_addCatalog(String catalogId, String indexObject, String dictionariesObject, String restrictQueryPermissionObject, String restrictIngestPermissionObject) throws CatalogServiceException {
- this.addCatalog(catalogId, this.serializer.deserializeObject(Index.class, indexObject), this.serializer.deserializeObject(List.class, dictionariesObject), this.serializer.deserializeObject(Boolean.class, restrictQueryPermissionObject), this.serializer.deserializeObject(Boolean.class, restrictIngestPermissionObject));
- return true;
- }
-
- public boolean xmlrpc_addDictionary(String catalogId, String dictionaryObject) throws CatalogServiceException {
- this.addDictionary(catalogId, this.serializer.deserializeObject(Dictionary.class, dictionaryObject));
- return true;
- }
-
- public boolean xmlrpc_replaceDictionaries(String catalogId, String dictionariesObject) throws CatalogServiceException {
- this.replaceDictionaries(catalogId, this.serializer.deserializeObject(List.class, dictionariesObject));
- return true;
- }
-
- public boolean xmlrpc_replaceIndex(String catalogId, String indexObject) throws CatalogServiceException {
- this.replaceIndex(catalogId, this.serializer.deserializeObject(Index.class, indexObject));
- return true;
- }
-
- public boolean xmlrpc_modifyIngestPermission(String catalogId, String restrictIngestPermissionObject) throws CatalogServiceException {
- this.modifyIngestPermission(catalogId, this.serializer.deserializeObject(Boolean.class, restrictIngestPermissionObject));
- return true;
- }
-
- public boolean xmlrpc_modifyQueryPermission(String catalogId, String restrictQueryPermissionObject) throws CatalogServiceException {
- this.modifyIngestPermission(catalogId, this.serializer.deserializeObject(Boolean.class, restrictQueryPermissionObject));
- return true;
- }
-
- public boolean xmlrpc_delete(String metadataObject) throws CatalogServiceException {
- this.delete(this.serializer.deserializeObject(Metadata.class, metadataObject));
- return true;
- }
-
- public String xmlrpc_getPluginUrls() throws CatalogServiceException {
- return this.serializer.serializeObject(this.getPluginUrls());
- }
-
- public boolean xmlrpc_addPluginUrls(String pluginUrlsObject) throws CatalogServiceException {
- this.addPluginUrls(this.serializer.deserializeObject(List.class, pluginUrlsObject));
- return true;
- }
-
- public String xmlrpc_getPluginStorageDir() throws CatalogServiceException {
- return this.serializer.serializeObject(this.getPluginStorageDir());
- }
-
- public boolean xmlrpc_transferFile(String filePath, byte[] fileData, int offset, int numBytes)
- throws IOException {
- FileOutputStream fOut = null;
- try {
- File outFile = new File(filePath);
- if (outFile.exists()) {
- fOut = new FileOutputStream(outFile, true);
- } else {
- fOut = new FileOutputStream(outFile, false);
- }
-
- fOut.write(fileData, (int) offset, (int) numBytes);
- } finally {
- try {
- fOut.close();
- }catch(Exception ignored) {}
- }
- return true;
- }
-
- public String xmlrpc_getAllPages(String queryPagerObject) throws CatalogServiceException {
- return this.serializer.serializeObject(this.getAllPages(this.serializer.deserializeObject(QueryPager.class, queryPagerObject)));
- }
-
- public String xmlrpc_getCalalogProperties() throws CatalogServiceException {
- return this.serializer.serializeObject(this.getCalalogProperties());
- }
-
- public String xmlrpc_getCalalogProperties(String catalogUrn)
- throws CatalogServiceException {
- return this.serializer.serializeObject(this.getCalalogProperties(catalogUrn));
- }
-
- public String xmlrpc_getCatalogServiceTransactionId(
- String catalogTransactionIdObject, String catalogUrn)
- throws CatalogServiceException {
- return this.serializer.serializeObject(this.getCatalogServiceTransactionId(this.serializer.deserializeObject(TransactionId.class, catalogTransactionIdObject), catalogUrn));
- }
-
- public String xmlrpc_getCatalogServiceTransactionId2(
- String catalogReceiptObject,
- String generateNewObject) throws CatalogServiceException {
- return this.serializer.serializeObject(this.getCatalogServiceTransactionId(this.serializer.deserializeObject(CatalogReceipt.class, catalogReceiptObject), this.serializer.deserializeObject(Boolean.class, generateNewObject)));
- }
-
- public String xmlrpc_getCatalogServiceTransactionIds(
- String catalogTransactionIdsObject, String catalogUrn)
- throws CatalogServiceException {
- return this.serializer.serializeObject(this.getCatalogServiceTransactionIds(this.serializer.deserializeObject(List.class, catalogTransactionIdsObject), catalogUrn));
- }
-
- public String xmlrpc_getCurrentCatalogIds() throws CatalogServiceException {
- return this.serializer.serializeObject(this.getCurrentCatalogIds());
- }
-
- public String xmlrpc_getMetadataFromTransactionIdStrings(
- String catalogServiceTransactionIdStringsObject)
- throws CatalogServiceException {
- return this.serializer.serializeObject(this.getMetadataFromTransactionIdStrings(this.serializer.deserializeObject(List.class, catalogServiceTransactionIdStringsObject)));
- }
-
- public String xmlrpc_getMetadataFromTransactionIds(
- String catalogServiceTransactionIdsObject)
- throws CatalogServiceException {
- return this.serializer.serializeObject(this.getMetadataFromTransactionIds(this.serializer.deserializeObject(List.class, catalogServiceTransactionIdsObject)));
- }
-
- public String xmlrpc_getNextPage(String queryPagerObject)
- throws CatalogServiceException {
- return this.serializer.serializeObject(this.getNextPage(this.serializer.deserializeObject(QueryPager.class, queryPagerObject)));
- }
-
- public String xmlrpc_getProperty(String key) throws CatalogServiceException {
- return this.serializer.serializeObject(this.getProperty(key));
- }
-
-
- public String xmlrpc_ingest(String metadataObject)
- throws CatalogServiceException {
- return this.serializer.serializeObject(this.ingest(this.serializer.deserializeObject(Metadata.class, metadataObject)));
- }
-
- public String xmlrpc_isRestrictIngestPermissions() throws CatalogServiceException {
- return this.serializer.serializeObject(this.isRestrictIngestPermissions());
- }
-
- public String xmlrpc_isRestrictQueryPermissions() throws CatalogServiceException {
- return this.serializer.serializeObject(this.isRestrictQueryPermissions());
- }
-
- public String xmlrpc_query(String queryExpressionObject) throws CatalogServiceException {
- return this.serializer.serializeObject(this.query(this.serializer.deserializeObject(QueryExpression.class, queryExpressionObject)));
- }
-
- public String xmlrpc_query(String queryExpressionObject, String catalogIdsObject) throws CatalogServiceException {
- return this.serializer.serializeObject(this.query(this.serializer.deserializeObject(QueryExpression.class, queryExpressionObject), this.serializer.deserializeObject(Set.class, catalogIdsObject)));
- }
-
- public String xmlrpc_getNextPage2(String pageObject) throws CatalogServiceException {
- return this.serializer.serializeObject(this.getNextPage(this.serializer.deserializeObject(Page.class, pageObject)));
- }
-
- public String xmlrpc_getPage(String pageInfoObject, String queryExpressionObject) throws CatalogServiceException {
- return this.serializer.serializeObject(this.getPage(this.serializer.deserializeObject(PageInfo.class, pageInfoObject), this.serializer.deserializeObject(QueryExpression.class, queryExpressionObject)));
- }
-
- public String xmlrpc_getPage(String pageInfoObject, String queryExpressionObject, String catalogIdsObject) throws CatalogServiceException {
- return this.serializer.serializeObject(this.getPage(this.serializer.deserializeObject(PageInfo.class, pageInfoObject), this.serializer.deserializeObject(QueryExpression.class, queryExpressionObject), this.serializer.deserializeObject(Set.class, catalogIdsObject)));
- }
-
- public String xmlrpc_getMetadata(String pageObject) throws CatalogServiceException {
- return this.serializer.serializeObject(this.getMetadata(this.serializer.deserializeObject(Page.class, pageObject)));
- }
-
-
- public boolean xmlrpc_removeCatalog(String catalogUrn) throws CatalogServiceException {
- this.removeCatalog(catalogUrn);
- return true;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServerFactory.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServerFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServerFactory.java
deleted file mode 100644
index 565d4d3..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServerFactory.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.server.channel.xmlrpc;
-
-//JDK imports
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.server.channel.CommunicationChannelServer;
-import org.apache.oodt.cas.catalog.server.channel.CommunicationChannelServerFactory;
-import org.apache.oodt.cas.catalog.system.CatalogServiceFactory;
-
-//Spring imports
-import org.springframework.beans.factory.annotation.Required;
-
-//OODT imports
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A Factory for creating XmlRpcCommunicationChannelServer
- * <p>
- */
-public class XmlRpcCommunicationChannelServerFactory implements
- CommunicationChannelServerFactory {
-
- private static Logger LOG = Logger.getLogger(XmlRpcCommunicationChannelServerFactory.class.getName());
-
- protected int port;
- protected CatalogServiceFactory catalogServiceFactory;
-
- public XmlRpcCommunicationChannelServerFactory() {}
-
- public CommunicationChannelServer createCommunicationChannelServer() {
- try {
- XmlRpcCommunicationChannelServer server = new XmlRpcCommunicationChannelServer();
- server.setCatalogService(this.catalogServiceFactory.createCatalogService());
- server.setPort(this.port);
- return server;
- }catch (Exception e) {
- LOG.log(Level.SEVERE, "Failed to create XML-RPC server : " + e.getMessage(), e);
- return null;
- }
- }
-
- @Required
- public void setPort(int port) {
- this.port = port;
- }
-
- public int getPort() {
- return this.port;
- }
-
- @Required
- public void setCatalogServiceFactory(CatalogServiceFactory catalogServiceFactory) {
- this.catalogServiceFactory = catalogServiceFactory;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/server/cli/action/CatalogServiceServerCliAction.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/cli/action/CatalogServiceServerCliAction.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/cli/action/CatalogServiceServerCliAction.java
deleted file mode 100644
index e8cbb3e..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/cli/action/CatalogServiceServerCliAction.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.server.cli.action;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.mapping.IngestMapperFactory;
-import org.apache.oodt.cas.catalog.repository.CatalogRepositoryFactory;
-import org.apache.oodt.cas.cli.action.CmdLineAction;
-
-/**
- * Base Catalog Service Server {@link CmdLineAction}.
- *
- * @author bfoster (Brian Foster)
- */
-public abstract class CatalogServiceServerCliAction extends CmdLineAction {
-
- public int getPort() {
- return Integer.getInteger("org.apache.oodt.cas.catalog.port");
- }
-
- public String getTransactionId() {
- return System.getProperty("org.apache.oodt.cas.catalog.transactionid");
- }
-
- public CatalogRepositoryFactory getRepository()
- throws InstantiationException, IllegalAccessException,
- ClassNotFoundException {
- return (CatalogRepositoryFactory) Class.forName(
- System.getProperty("org.apache.oodt.cas.catalog.repository"))
- .newInstance();
- }
-
- public IngestMapperFactory getIngestMapper() throws InstantiationException,
- IllegalAccessException, ClassNotFoundException {
- return (IngestMapperFactory) Class.forName(
- System.getProperty("org.apache.oodt.cas.catalog.ingestmapper"))
- .newInstance();
- }
-
- public boolean getRestrictQueryPermissions() {
- return Boolean
- .getBoolean("org.apache.oodt.cas.catalog.restrict.query.permissions");
- }
-
- public boolean getRestrictIngestPermissions() {
- return Boolean
- .getBoolean("org.apache.oodt.cas.catalog.restrict.ingest.permissions");
- }
-
- public boolean getOneCatalogFailsAllFail() {
- return Boolean
- .getBoolean("org.apache.oodt.cas.catalog.oneCatalogFailsAllFail");
- }
-
- public boolean getSimplifyQueries() {
- return Boolean.getBoolean("org.apache.oodt.cas.catalog.simplifyQueries");
- }
-
- public boolean getDisableIntersectingCrossCatalogQueries() {
- return Boolean
- .getBoolean("org.apache.oodt.cas.catalog.disableIntersectingCrossCatalogQueries");
- }
-
- public int getCrossCatalogResultSortingThreshold() {
- return Integer
- .getInteger("org.apache.oodt.cas.catalog.crossCatalogResultSortingThreshold");
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/server/cli/action/LaunchXmlRpcServerCliAction.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/cli/action/LaunchXmlRpcServerCliAction.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/cli/action/LaunchXmlRpcServerCliAction.java
deleted file mode 100644
index 1ef4747..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/cli/action/LaunchXmlRpcServerCliAction.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.server.cli.action;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.server.channel.xmlrpc.XmlRpcCommunicationChannelServerFactory;
-import org.apache.oodt.cas.catalog.system.impl.CatalogServiceLocalFactory;
-import org.apache.oodt.cas.cli.exception.CmdLineActionException;
-
-/**
- *
- * @author bfoster (Brian Foster)
- */
-public class LaunchXmlRpcServerCliAction extends CatalogServiceServerCliAction {
-
- @Override
- public void execute(ActionMessagePrinter printer)
- throws CmdLineActionException {
- try {
- printer.println("Starting XML-RPC server on port " + getPort());
- getXmlRpcFactory().createCommunicationChannelServer().startup();
- } catch (Exception e) {
- throw new CmdLineActionException("Failed to startup server : "
- + e.getMessage(), e);
- }
- }
-
- protected XmlRpcCommunicationChannelServerFactory getXmlRpcFactory()
- throws InstantiationException, IllegalAccessException,
- ClassNotFoundException {
- XmlRpcCommunicationChannelServerFactory factory = new XmlRpcCommunicationChannelServerFactory();
- factory.setPort(getPort());
- factory.setCatalogServiceFactory(getCatalogServiceFactory());
- return factory;
- }
-
- protected CatalogServiceLocalFactory getCatalogServiceFactory()
- throws InstantiationException, IllegalAccessException,
- ClassNotFoundException {
- CatalogServiceLocalFactory factory = new CatalogServiceLocalFactory();
- factory.setTransactionIdFactory(getTransactionId());
- factory.setCatalogRepositoryFactory(getRepository());
- factory.setIngestMapperFactory(getIngestMapper());
- factory.setRestrictQueryPermissions(getRestrictQueryPermissions());
- factory.setRestrictIngestPermissions(getRestrictIngestPermissions());
- factory.setOneCatalogFailsAllFail(getOneCatalogFailsAllFail());
- factory.setSimplifyQueries(getSimplifyQueries());
- factory.setDisableIntersectingCrossCatalogQueries(
- getDisableIntersectingCrossCatalogQueries());
- factory.setCrossCatalogResultSortingThreshold(
- getCrossCatalogResultSortingThreshold());
- return factory;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/Dictionary.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/Dictionary.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/Dictionary.java
deleted file mode 100644
index f415346..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/Dictionary.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.struct;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.exception.CatalogDictionaryException;
-import org.apache.oodt.cas.catalog.query.QueryExpression;
-import org.apache.oodt.cas.catalog.term.TermBucket;
-import org.apache.oodt.cas.metadata.Metadata;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A Dictionary for create Catalog understandable Terms from Metadata
- * <p>
- */
-public interface Dictionary {
-
- /**
- * Given a Metadata object a lookup call to a given dictionary will
- * always return the same TermBucket. However, calls to several
- * Dictionary's lookup method may return different TermBuckets for
- * a given Metadata object.
- * @param metadata The Metadata for which a TermBucket will be created
- * @return TermBucket representing the given Metadata for this Dictionary or
- * null if Metadata is not recognized by this Dictionary
- */
- TermBucket lookup(Metadata metadata);
-
- /**
- * Generates Metadata for the given TermBucket. A call to lookup(Metadata) and
- * then reverseLookup(TermBucket) may not give you back the original Metadata
- * because lookup may ignore key/values in Metadata for which it does not
- * understand.
- * @param termBucket The TermBucket for which Metadata will be created
- * @return Metadata for the given TermBucket. If the TermBucket is not understood,
- * then an empty Metadata object should be returned.
- */
- Metadata reverseLookup(TermBucket termBucket);
-
- /**
- *
- * @param queryExpression
- * @return
- * @throws CatalogDictionaryException
- */
- boolean understands(QueryExpression queryExpression);
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/DictionaryFactory.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/DictionaryFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/DictionaryFactory.java
deleted file mode 100644
index 55e7947..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/DictionaryFactory.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.struct;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- */
-public interface DictionaryFactory {
-
- Dictionary createDictionary();
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/Index.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/Index.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/Index.java
deleted file mode 100644
index 1a8723f..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/Index.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.struct;
-
-//JDK imports
-import java.util.List;
-import java.util.Properties;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.exception.CatalogIndexException;
-import org.apache.oodt.cas.catalog.page.IndexPager;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A Interface for Communicating with an Term Index. Should also implement
- * IngestService to allow Term ingest to this Index and/or implement
- * QueryService to allow Term query on this Index.
- * <p>
- */
-public interface Index {
-
- Properties getProperties();
-
- String getProperty(String key);
-
- /**
- * Returns a list of TransactionIds associated with the
- * given Index page.
- * @param indexPage The page for which TransactionIds will be returned
- * @return A page of TransactionIds, if page does not exist,
- * then returns null.
- */
- List<TransactionId<?>> getPage(IndexPager indexPage);
-
- /**
- *
- * @return
- */
- TransactionIdFactory getTransactionIdFactory();
-
- /**
- *
- * @return
- * @throws CatalogIndexException
- */
- boolean hasTransactionId(TransactionId<?> transactionid) throws CatalogIndexException;
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/IndexFactory.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/IndexFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/IndexFactory.java
deleted file mode 100644
index 5dd4098..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/IndexFactory.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.struct;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- */
-public interface IndexFactory {
-
- Index createIndex();
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/IngestService.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/IngestService.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/IngestService.java
deleted file mode 100644
index 161d004..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/IngestService.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.struct;
-
-//JDK imports
-import java.util.List;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.exception.IngestServiceException;
-import org.apache.oodt.cas.catalog.page.IngestReceipt;
-import org.apache.oodt.cas.catalog.term.TermBucket;
-
-//OODT imports
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A Interface for performing ingests to an Index
- * <p>
- */
-public interface IngestService {
-
- /**
- * Indexes the given TermBucket to a TransactionId, and returns a IngestReceipt
- * @param termBuckets The List of TermBucket to be ingested
- * @return IngestReceipt Receipt of ingest
- * @throws IngestServiceException Any error
- */
- IngestReceipt ingest(List<TermBucket> termBuckets) throws IngestServiceException;
-
- /**
- * TermBucket updates to given TransactionId. A new TransactionId can be returned in IngestReceipt
- * if so desired and it will automatically get remapped by CatalogService. Existing metadata
- * for given TransactionId should not be deleted, just the terms in the given term buckets should
- * be modified. For a complete re-ingest, one should instead delete() then ingest().
- * @param transactionId
- * @param termBuckets
- * @throws IngestServiceException
- */
- IngestReceipt update(TransactionId<?> transactionId, List<TermBucket> termBuckets) throws IngestServiceException;
-
- /**
- * Deletes all TermBuckets attached to given TransactionId -- there should be no trace of
- * given transaction after this method is called.
- * @param transactionId The ID for given transaction which should be erased
- * @throws IngestServiceException Any error
- */
- boolean delete(TransactionId<?> transactionId) throws IngestServiceException;
-
- /**
- * Deletes only the Terms in the given TermBuckets from the given TransactionId
- * @param transactionId The TransactionId for which Terms will be deleted
- * @param termBuckets The reduction set of Terms for each TermBucket
- * @throws IngestServiceException Any error
- */
- boolean reduce(TransactionId<?> transactionId, List<TermBucket> termBuckets) throws IngestServiceException;
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/QueryService.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/QueryService.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/QueryService.java
deleted file mode 100644
index 056f9d8..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/QueryService.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.struct;
-
-//JDK imports
-import java.util.List;
-import java.util.Map;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.exception.QueryServiceException;
-import org.apache.oodt.cas.catalog.page.IngestReceipt;
-import org.apache.oodt.cas.catalog.query.QueryExpression;
-import org.apache.oodt.cas.catalog.term.TermBucket;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A Interface for performing queries to a Catalog
- * <p>
- */
-public interface QueryService {
-
- /**
- * Returns all the TransactionIds that fall under the given query
- * @return Returns a List of TransactionIds that meet the query, otherwise
- * an empty List is no TransactionIds are found for the given query
- */
- List<IngestReceipt> query(QueryExpression queryExpression) throws QueryServiceException;
-
- /**
- * Returns the results of the given query such that: [startIndex, endIndex)
- * @param queryExpression The query for which results will be returned
- * @param startIndex The start index of subset of results to be returned
- * @param endIndex The end index of the subset of results to be returned
- * @return The results of the given query such that: [startIndex, endIndex)
- * @throws QueryServiceException on an error
- */
- List<IngestReceipt> query(QueryExpression queryExpression, int startIndex, int endIndex) throws QueryServiceException;
-
- /**
- * Returns the number of results found for the given query
- * @param queryExpression The query whose size in question
- * @return The number of results found for the given query
- * @throws QueryServiceException on an error
- */
- int sizeOf(QueryExpression queryExpression) throws QueryServiceException;
-
- /**
- * Returns a List of TermBuckets ingested for a given TransactionId
- * @param transactionId The TransactionId in question
- * @return A List of TermBuckets for the given TransactionId or empty list
- * if no record of the give TranactionId exists
- */
- List<TermBucket> getBuckets(TransactionId<?> transactionId) throws QueryServiceException;
-
- /**
- * Does the same as getBuckets(TransactionId), except is performed over a list
- * of TransactionIds
- * @param transactionIds A List of TransactionIds for which TermBuckets are wanted
- * @return A Map of TransactionIds to TermBuckets
- */
- Map<TransactionId<?>, List<TermBucket>> getBuckets(List<TransactionId<?>> transactionIds) throws QueryServiceException;
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/TransactionId.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/TransactionId.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/TransactionId.java
deleted file mode 100644
index 7e5d934..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/TransactionId.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.struct;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A Interface for storing TransactionIds
- * <p>
- */
-public abstract class TransactionId<NativeType> {
-
- protected NativeType nativeId;
-
- public TransactionId() {}
-
- public TransactionId(NativeType nativeId) {
- this.nativeId = nativeId;
- }
-
- public TransactionId(String stringId) {
- this.nativeId = this.fromString(stringId);
- }
-
- @Override
- public int hashCode() {
- return this.toString().hashCode();
- }
-
- public NativeType getNativeId() {
- return this.nativeId;
- }
-
- /**
- * Should override this method if NativeType.toString()
- * does not properly represent the String value of the
- * native type. The string value of the NativeType should
- * be as unique as in its native form.
- */
- public String toString() {
- return this.nativeId.toString();
- }
-
- public boolean equals(Object obj) {
- if (obj instanceof TransactionId<?>) {
- return this.toString().equals(obj.toString());
- } else if (obj instanceof String) {
- return this.toString().equals((String) obj);
- } else {
- return false;
- }
- }
-
- protected abstract NativeType fromString(String stringId);
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/TransactionIdFactory.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/TransactionIdFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/TransactionIdFactory.java
deleted file mode 100644
index eb5d42b..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/TransactionIdFactory.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.struct;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- */
-public interface TransactionIdFactory {
-
- TransactionId<?> createNewTransactionId();
-
- TransactionId<?> createTransactionId(String transactionIdString);
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/dictionary/WorkflowManagerDictionary.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/dictionary/WorkflowManagerDictionary.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/dictionary/WorkflowManagerDictionary.java
deleted file mode 100644
index 5630b6f..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/dictionary/WorkflowManagerDictionary.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.struct.impl.dictionary;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.query.*;
-import org.apache.oodt.cas.catalog.struct.Dictionary;
-import org.apache.oodt.cas.catalog.term.Term;
-import org.apache.oodt.cas.catalog.term.TermBucket;
-import org.apache.oodt.cas.metadata.Metadata;
-
-//JDK imports
-import java.util.Set;
-
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- */
-public class WorkflowManagerDictionary implements Dictionary {
-
- public TermBucket lookup(Metadata metadata) {
- if (metadata.getMetadata("ProductType") != null && metadata.getAllMetadata("ProductType").contains("Workflows")) {
- TermBucket workflowBucket = new TermBucket("Workflows");
- for (Object key : metadata.getMap().keySet()) {
- workflowBucket.addTerm(new Term((String) key, metadata.getAllMetadata((String) key)));
- }
- return workflowBucket;
- }else {
- return null;
- }
- }
-
- public Metadata reverseLookup(TermBucket termBucket) {
- Metadata metadata = new Metadata();
- if (termBucket.getName().equals("Workflows")) {
- for (Term term : termBucket.getTerms()) {
- metadata.addMetadata(term.getName(), term.getValues());
- }
- }
- return metadata;
- }
-
- public boolean understands(QueryExpression queryExpression) {
- Set<String> bucketNames = queryExpression.getBucketNames();
- if (bucketNames == null || bucketNames.contains("Workflows")) {
- return queryExpression instanceof NotQueryExpression
- || queryExpression instanceof ComparisonQueryExpression
- || queryExpression instanceof StdQueryExpression
- || queryExpression instanceof QueryLogicalGroup;
- }
- return false;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/dictionary/WorkflowManagerDictionaryFactory.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/dictionary/WorkflowManagerDictionaryFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/dictionary/WorkflowManagerDictionaryFactory.java
deleted file mode 100644
index e629667..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/dictionary/WorkflowManagerDictionaryFactory.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.struct.impl.dictionary;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.struct.DictionaryFactory;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- */
-public class WorkflowManagerDictionaryFactory implements DictionaryFactory {
-
- public WorkflowManagerDictionary createDictionary() {
- return new WorkflowManagerDictionary();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/DataSourceIndex.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/DataSourceIndex.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/DataSourceIndex.java
deleted file mode 100644
index 5d8b1bd..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/DataSourceIndex.java
+++ /dev/null
@@ -1,549 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.struct.impl.index;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.oodt.cas.catalog.exception.CatalogIndexException;
-import org.apache.oodt.cas.catalog.exception.IngestServiceException;
-import org.apache.oodt.cas.catalog.exception.QueryServiceException;
-import org.apache.oodt.cas.catalog.page.IndexPager;
-import org.apache.oodt.cas.catalog.page.IngestReceipt;
-import org.apache.oodt.cas.catalog.page.PageInfo;
-import org.apache.oodt.cas.catalog.page.ProcessedPageInfo;
-import org.apache.oodt.cas.catalog.query.ComparisonQueryExpression;
-import org.apache.oodt.cas.catalog.query.NotQueryExpression;
-import org.apache.oodt.cas.catalog.query.QueryExpression;
-import org.apache.oodt.cas.catalog.query.QueryLogicalGroup;
-import org.apache.oodt.cas.catalog.query.StdQueryExpression;
-import org.apache.oodt.cas.catalog.struct.Index;
-import org.apache.oodt.cas.catalog.struct.IngestService;
-import org.apache.oodt.cas.catalog.struct.QueryService;
-import org.apache.oodt.cas.catalog.struct.TransactionId;
-import org.apache.oodt.cas.catalog.struct.TransactionIdFactory;
-import org.apache.oodt.cas.catalog.struct.impl.transaction.UuidTransactionIdFactory;
-import org.apache.oodt.cas.catalog.term.Term;
-import org.apache.oodt.cas.catalog.term.TermBucket;
-import org.apache.oodt.commons.database.DatabaseConnectionBuilder;
-import org.apache.oodt.commons.date.DateUtils;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import java.net.URLEncoder;
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.Statement;
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Vector;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.sql.DataSource;
-
-/**
- *
- * DataSource Indexer which supports both ingest and query
- *
- * @author bfoster
- * @version $Revision$
- *
- */
-public class DataSourceIndex implements Index, IngestService, QueryService {
-
- private static final Logger LOG = Logger.getLogger(DataSourceIndex.class.getName());
-
- protected DataSource dataSource;
- protected boolean useUTF8;
-
- public DataSourceIndex(String user, String pass, String driver, String jdbcUrl, boolean useUTF8) {
- this.dataSource = DatabaseConnectionBuilder.buildDataSource(user, pass, driver, jdbcUrl);
- this.useUTF8 = useUTF8;
- }
-
- public IndexPager getPager(PageInfo pageInfo) throws CatalogIndexException {
- return new IndexPager(new ProcessedPageInfo(pageInfo.getPageSize(), pageInfo.getPageNum(), this.getNumOfTransactions()));
- }
-
- protected int getNumOfTransactions() throws CatalogIndexException {
- Connection conn = null;
- Statement stmt = null;
- ResultSet rs = null;
- try {
- conn = this.dataSource.getConnection();
- stmt = conn.createStatement();
- rs = stmt.executeQuery("SELECT COUNT(transaction_id) AS numTransIds FROM transactions");
- if (rs.next()) {
- return rs.getInt("numTransIds");
- } else {
- throw new Exception("Failed to query for number of transactions");
- }
- }catch (Exception e) {
- throw new CatalogIndexException("Failed to get number of transactions : " + e.getMessage(), e);
- }finally {
- try {
- conn.close();
- }catch(Exception ignored) {}
- try {
- stmt.close();
- }catch(Exception ignored) {}
- try {
- rs.close();
- }catch(Exception ignored) {}
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public List<TransactionId<?>> getPage(IndexPager indexPage) {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public Properties getProperties() {
- return new Properties();
- }
-
- /**
- * {@inheritDoc}
- */
- public String getProperty(String key) {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public TransactionIdFactory getTransactionIdFactory() {
- return new UuidTransactionIdFactory();
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean hasTransactionId(TransactionId<?> transactionId)
- throws CatalogIndexException {
- Connection conn = null;
- Statement stmt = null;
- ResultSet rs = null;
- try {
- conn = this.dataSource.getConnection();
- stmt = conn.createStatement();
- rs = stmt.executeQuery("SELECT DISTINCT transaction_id FROM transactions WHERE transaction_id = '" + transactionId + "'");
- return rs.next();
- }catch (Exception e) {
- throw new CatalogIndexException("Failed to check for transaction id '" + transactionId + "' : " + e.getMessage(), e);
- }finally {
- try {
- conn.close();
- }catch(Exception ignored) {}
- try {
- stmt.close();
- }catch(Exception ignored) {}
- try {
- rs.close();
- }catch(Exception ignored) {}
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean delete(TransactionId<?> transactionId)
- throws IngestServiceException {
- Connection conn = null;
- Statement stmt = null;
- try {
- conn = this.dataSource.getConnection();
- stmt = conn.createStatement();
- stmt.execute("DELETE FROM transactions WHERE transaction_id = '" + transactionId + "'");
- stmt.execute("DELETE FROM transaction_terms WHERE transaction_id = '" + transactionId + "'");
- conn.commit();
- return true;
- }catch (Exception e) {
- throw new IngestServiceException("Failed to delete transaction id '" + transactionId + "' : " + e.getMessage(), e);
- }finally {
- try {
- conn.close();
- }catch(Exception ignored) {}
- try {
- stmt.close();
- }catch(Exception ignored) {}
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public IngestReceipt ingest(List<TermBucket> termBuckets) throws IngestServiceException {
- Connection conn = null;
- Statement stmt = null;
- TransactionId<?> catalogTransactionId = null;
- try {
- catalogTransactionId = this.getTransactionIdFactory().createNewTransactionId();
- conn = this.dataSource.getConnection();
- stmt = conn.createStatement();
- Calendar calendar = DateUtils.getCurrentLocalTime();
- stmt.execute("INSERT INTO transactions VALUES ('" + catalogTransactionId + "','" + DateUtils.toString(calendar) + "')");
- for (TermBucket termBucket : termBuckets) {
- for (Term term : termBucket.getTerms()) {
- for (String value : term.getValues()) {
- try {
- stmt.execute("INSERT INTO transaction_terms VALUES ('" + catalogTransactionId + "','" + termBucket.getName() + "','" + term.getName() + "','" + (this.useUTF8 ? URLEncoder.encode(value, "UTF8") : value) + "')");
- }catch (Exception e) {
- LOG.log(Level.WARNING, "Failed to ingest term: '" + catalogTransactionId + "','" + termBucket.getName() + "','" + term.getName() + "','" + value + "'");
- }
- }
- }
- }
- conn.commit();
- return new IngestReceipt(catalogTransactionId, calendar.getTime());
- }catch (Exception e) {
- throw new IngestServiceException("Failed to ingest metadata for transaction id '" + catalogTransactionId + "' : " + e.getMessage(), e);
- }finally {
- try {
- conn.close();
- }catch(Exception ignored) {}
- try {
- stmt.close();
- }catch(Exception ignored) {}
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean reduce(TransactionId<?> transactionId,
- List<TermBucket> termBuckets) throws IngestServiceException {
- Connection conn = null;
- Statement stmt = null;
- try {
- conn = this.dataSource.getConnection();
- stmt = conn.createStatement();
- for (TermBucket termBucket : termBuckets) {
- for (Term term : termBucket.getTerms()) {
- for (String value : term.getValues()) {
- try {
- stmt.execute("DELETE FROM transaction_terms WHERE transaction_id = '" + transactionId
- + "' AND bucket_name = '" + termBucket.getName() + "' AND term_name = '" + term
- .getName() + "' AND term_value = '" + (this.useUTF8 ? URLEncoder
- .encode(value, "UTF8") : value) + "'");
- } catch (Exception e) {
- LOG.log(Level.WARNING,
- "Failed to delete term: '" + transactionId + "','" + termBucket.getName() + "','" + term
- .getName() + "','" + value + "'");
- }
- }
- }
- }
- conn.commit();
- return true;
- }catch (Exception e) {
- throw new IngestServiceException("Failed to delete transaction id '" + transactionId + "' : " + e.getMessage(), e);
- }finally {
- try {
- conn.close();
- }catch(Exception ignored) {}
- try {
- stmt.close();
- }catch(Exception ignored) {}
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public IngestReceipt update(TransactionId<?> transactionId,
- List<TermBucket> termBuckets) throws IngestServiceException {
- Connection conn = null;
- Statement stmt = null;
- try {
- conn = this.dataSource.getConnection();
- stmt = conn.createStatement();
- for (TermBucket termBucket : termBuckets) {
- for (Term term : termBucket.getTerms()) {
- for (String value : term.getValues()) {
- try {
- stmt.execute("DELETE FROM transaction_terms WHERE transaction_id = '" + transactionId
- + "' AND bucket_name = '" + termBucket.getName() + "' AND term_name = '" + term
- .getName() + "'");
- stmt.execute(
- "INSERT INTO transaction_terms VALUES ('" + transactionId + "','" + termBucket.getName() + "','"
- + term.getName() + "','" + (this.useUTF8 ? URLEncoder.encode(value, "UTF8") : value) + "')");
- } catch (Exception e) {
- LOG.log(Level.WARNING,
- "Failed to ingest term: '" + transactionId + "','" + termBucket.getName() + "','" + term
- .getName() + "','" + value + "'");
- }
- }
- }
- }
- Calendar calendar = DateUtils.getCurrentLocalTime();
- stmt.execute("UPDATE transactions SET transaction_date = '" + DateUtils.toString(calendar) + "' WHERE transaction_id = '" + transactionId + "'");
- return new IngestReceipt(transactionId, calendar.getTime());
- }catch (Exception e) {
- throw new IngestServiceException("Failed to ingest metadata for transaction id '" + transactionId + "' : " + e.getMessage(), e);
- }finally {
- try {
- conn.close();
- }catch(Exception ignored) {}
- try {
- stmt.close();
- }catch(Exception ignored) {}
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public List<TermBucket> getBuckets(TransactionId<?> transactionId)
- throws QueryServiceException {
- Connection conn = null;
- Statement stmt = null;
- ResultSet rs = null;
- try {
- ConcurrentHashMap<String, TermBucket> termBuckets = new ConcurrentHashMap<String, TermBucket>();
- conn = this.dataSource.getConnection();
- stmt = conn.createStatement();
- rs = stmt.executeQuery("SELECT bucket_name,term_name,term_value FROM transaction_terms WHERE transaction_id = '" + transactionId + "'");
- while (rs.next()) {
- String bucketName = rs.getString("bucket_name");
- String termName = rs.getString("term_name");
- String termValue = rs.getString("term_value");
- TermBucket bucket = termBuckets.get(bucketName);
- if (bucket == null) {
- bucket = new TermBucket(bucketName);
- }
- Term term = new Term(termName, Collections.singletonList((this.useUTF8 ? URLDecoder.decode(termValue, "UTF8") : termValue)));
- bucket.addTerm(term);
- termBuckets.put(bucketName, bucket);
- }
- return new Vector<TermBucket>(termBuckets.values());
- }catch (Exception e) {
- throw new QueryServiceException("Failed to get term buckets for transaction id '" + transactionId + "' : " + e.getMessage(), e);
- }finally {
- try {
- conn.close();
- }catch(Exception ignored) {}
- try {
- stmt.close();
- }catch(Exception ignored) {}
- try {
- rs.close();
- }catch(Exception ignored) {}
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public Map<TransactionId<?>, List<TermBucket>> getBuckets(
- List<TransactionId<?>> transactionIds) throws QueryServiceException {
- ConcurrentHashMap<TransactionId<?>, List<TermBucket>> map = new ConcurrentHashMap<TransactionId<?>, List<TermBucket>>();
- for (TransactionId<?> transactionId : transactionIds) {
- map.put(transactionId, this.getBuckets(transactionId));
- }
- return map;
- }
-
- /**
- * {@inheritDoc}
- */
- public List<IngestReceipt> query(QueryExpression queryExpression)
- throws QueryServiceException {
- Connection conn = null;
- Statement stmt = null;
- ResultSet rs = null;
- try {
- conn = this.dataSource.getConnection();
- stmt = conn.createStatement();
- String sqlQuery = "SELECT DISTINCT transaction_id,transaction_date FROM transactions "
- + "WHERE "
- + "transaction_id IN (" + this.getSqlQuery(queryExpression) + ")";
- LOG.log(Level.INFO, "Performing Query: " + sqlQuery);
- rs = stmt.executeQuery(sqlQuery);
-
- List<IngestReceipt> receipts = new Vector<IngestReceipt>();
- while (rs.next()) {
- receipts.add(
- new IngestReceipt(this.getTransactionIdFactory().createTransactionId(rs.getString("transaction_id")),
- DateUtils.toCalendar(rs.getString("transaction_date"), DateUtils.FormatType.LOCAL_FORMAT)
- .getTime()));
- }
- return receipts;
- }catch (Exception e) {
- throw new QueryServiceException("Failed to query Workflow Instances Database : " + e.getMessage(), e);
- }finally {
- try {
- conn.close();
- }catch(Exception ignored) {}
- try {
- stmt.close();
- }catch(Exception ignored) {}
- try {
- rs.close();
- }catch(Exception ignored) {}
- }
- }
-
- public List<IngestReceipt> query(QueryExpression queryExpression, int startIndex, int endIndex) throws QueryServiceException {
- Connection conn = null;
- Statement stmt = null;
- ResultSet rs = null;
- try {
- conn = this.dataSource.getConnection();
- stmt = conn.createStatement();
- String sqlQuery = "SELECT DISTINCT transaction_id,transaction_date FROM transactions WHERE "
- + "transaction_id IN (" + this.getSqlQuery(queryExpression) + ")";
- LOG.log(Level.INFO, "Performing Query: " + sqlQuery);
- rs = stmt.executeQuery(sqlQuery);
-
- List<IngestReceipt> receipts = new Vector<IngestReceipt>();
- int index = 0;
- while (startIndex > index && rs.next()) {
- index++;
- }
- while (rs.next() && index++ <= endIndex) {
- receipts.add(
- new IngestReceipt(this.getTransactionIdFactory().createTransactionId(rs.getString("transaction_id")),
- DateUtils.toCalendar(rs.getString("transaction_date"), DateUtils.FormatType.LOCAL_FORMAT)
- .getTime()));
- }
- return receipts;
- }catch (Exception e) {
- throw new QueryServiceException("Failed to query Workflow Instances Database : " + e.getMessage(), e);
- }finally {
- try {
- conn.close();
- }catch(Exception ignored) {}
- try {
- stmt.close();
- }catch(Exception ignored) {}
- try {
- rs.close();
- }catch(Exception ignored) {}
- }
- }
-
- public int sizeOf(QueryExpression queryExpression)
- throws QueryServiceException {
- Connection conn = null;
- Statement stmt = null;
- ResultSet rs = null;
- try {
- conn = this.dataSource.getConnection();
- stmt = conn.createStatement();
- String sqlQuery = "SELECT COUNT(transaction_id) AS numTransactions FROM transactions "
- + "WHERE "
- + "transaction_id IN (" + this.getSqlQuery(queryExpression) + ")";
- LOG.log(Level.INFO, "Performing Query: " + sqlQuery);
- rs = stmt.executeQuery(sqlQuery);
-
- int numTransactions = 0;
- while (rs.next()) {
- numTransactions = rs.getInt("numTransactions");
- }
-
- return numTransactions;
- }catch (Exception e) {
- throw new QueryServiceException("Failed to get size of query : " + e.getMessage(), e);
- }finally {
- try {
- conn.close();
- }catch(Exception ignored) {}
- try {
- stmt.close();
- }catch(Exception ignored) {}
- try {
- rs.close();
- }catch(Exception ignored) {}
- }
- }
-
-
- private String getSqlQuery(QueryExpression queryExpression) throws QueryServiceException, UnsupportedEncodingException {
- StringBuilder sqlQuery = new StringBuilder();
- StringBuilder bucketNameFilter = new StringBuilder("");
- if (queryExpression.getBucketNames() != null) {
- if (queryExpression.getBucketNames().size() == 1) {
- bucketNameFilter.append("bucket_name = '").append(queryExpression.getBucketNames().iterator().next())
- .append("' ").append("AND ");
- } else if (queryExpression.getBucketNames().size() > 1) {
- bucketNameFilter.append("(bucket_name = '")
- .append(StringUtils.join(queryExpression.getBucketNames().iterator(),
- "' OR bucket_name = '")).append("') AND ");
- }
- }
- if (queryExpression instanceof QueryLogicalGroup) {
- QueryLogicalGroup qlg = (QueryLogicalGroup) queryExpression;
- sqlQuery.append("(").append(this.getSqlQuery(qlg.getExpressions().get(0)));
- String op = qlg.getOperator() == QueryLogicalGroup.Operator.AND ? "INTERSECT" : "UNION";
- for (int i = 1; i < qlg.getExpressions().size(); i++) {
- sqlQuery.append(") ").append(op).append(" (").append(this.getSqlQuery(qlg.getExpressions().get(i)));
- }
- sqlQuery.append(")");
- }else if (queryExpression instanceof ComparisonQueryExpression){
- ComparisonQueryExpression cqe = (ComparisonQueryExpression) queryExpression;
- String operator;
- if (cqe.getOperator().equals(ComparisonQueryExpression.Operator.EQUAL_TO)) {
- operator = "=";
- } else if (cqe.getOperator().equals(ComparisonQueryExpression.Operator.GREATER_THAN)) {
- operator = ">";
- } else if (cqe.getOperator().equals(ComparisonQueryExpression.Operator.GREATER_THAN_EQUAL_TO)) {
- operator = ">=";
- } else if (cqe.getOperator().equals(ComparisonQueryExpression.Operator.LESS_THAN)) {
- operator = "<";
- } else if (cqe.getOperator().equals(ComparisonQueryExpression.Operator.LESS_THAN_EQUAL_TO)) {
- operator = "<=";
- } else {
- throw new QueryServiceException("Invalid ComparisonQueryExpression Operator '" + cqe.getOperator() + "'");
- }
-
- sqlQuery.append("SELECT DISTINCT transaction_id FROM transaction_terms WHERE ")
- .append(bucketNameFilter.toString()).append(" ").append("term_name = '")
- .append(cqe.getTerm().getName()).append("' AND (");
- for (int i = 0; i < cqe.getTerm().getValues().size(); i++) {
- String value = cqe.getTerm().getValues().get(i);
- sqlQuery.append("term_value ").append(operator).append(" '")
- .append(this.useUTF8 ? URLEncoder.encode(value, "UTF-8") : value).append("'");
- if ((i + 1) < cqe.getTerm().getValues().size()) {
- sqlQuery.append(" OR ");
- }
- }
- sqlQuery.append(")");
- }else if (queryExpression instanceof NotQueryExpression) {
- NotQueryExpression nqe = (NotQueryExpression) queryExpression;
- sqlQuery.append("SELECT DISTINCT transaction_id FROM transaction_terms WHERE ")
- .append(bucketNameFilter.toString()).append(" NOT (")
- .append(this.getSqlQuery(nqe.getQueryExpression())).append(")");
- }else if (queryExpression instanceof StdQueryExpression) {
- sqlQuery.append("SELECT DISTINCT transaction_id FROM transaction_terms ")
- .append(bucketNameFilter.toString());
- }else {
- throw new QueryServiceException("Invalid QueryExpression '" + queryExpression.getClass().getCanonicalName() + "'");
- }
- return sqlQuery.toString();
- }
-
-}
-
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/DataSourceIndexFactory.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/DataSourceIndexFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/DataSourceIndexFactory.java
deleted file mode 100644
index cf6d1ba..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/DataSourceIndexFactory.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.struct.impl.index;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.struct.Index;
-import org.apache.oodt.cas.catalog.struct.IndexFactory;
-
-/**
- *
- * Factory for creating DataSourceIndex(s).
- *
- * @author bfoster
- * @version $Revision$
- *
- */
-public class DataSourceIndexFactory implements IndexFactory {
-
- protected String jdbcUrl;
- protected String user;
- protected String pass;
- protected String driver;
- protected boolean useUTF8;
-
- public DataSourceIndexFactory() {
- this.useUTF8 = false;
- }
-
- public Index createIndex() {
- return new DataSourceIndex(this.user, this.pass, this.driver, this.jdbcUrl, this.useUTF8);
- }
-
- public void setJdbcUrl(String jdbcUrl) {
- this.jdbcUrl = jdbcUrl;
- }
-
- public void setUser(String user) {
- this.user = user;
- }
-
- public void setPass(String pass) {
- this.pass = pass;
- }
-
- public void setDriver(String driver) {
- this.driver = driver;
- }
-
- public void setUseUTF8(boolean useUTF8) {
- this.useUTF8 = useUTF8;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/InMemoryIndex.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/InMemoryIndex.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/InMemoryIndex.java
deleted file mode 100644
index 20f7b61..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/InMemoryIndex.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.struct.impl.index;
-
-//JDK imports
-import java.io.File;
-import java.io.IOException;
-import java.sql.SQLException;
-
-//OODT imports
-import org.apache.oodt.commons.database.SqlScript;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A in memory Index which is ingestable
- * <p>
- */
-public class InMemoryIndex extends DataSourceIndex {
-
- public InMemoryIndex(String user, String pass, String driver,
- String jdbcUrl, boolean useUTF8, String tablesFile) throws IOException {
- super(user, pass, driver, jdbcUrl, useUTF8);
- SqlScript coreSchemaScript = new SqlScript(new File(tablesFile).getAbsolutePath(), this.dataSource);
- coreSchemaScript.loadScript();
- coreSchemaScript.execute();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/InMemoryIndexFactory.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/InMemoryIndexFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/InMemoryIndexFactory.java
deleted file mode 100644
index 542cae6..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/InMemoryIndexFactory.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.struct.impl.index;
-
-//JDK imports
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- */
-public class InMemoryIndexFactory extends DataSourceIndexFactory {
-
- private static final Logger LOG = Logger.getLogger(InMemoryIndexFactory.class.getName());
-
- protected String tablesFile;
-
- public InMemoryIndex createIndex() {
- try {
- return new InMemoryIndex(this.user, this.pass, this.driver, this.jdbcUrl, this.useUTF8, this.tablesFile);
- }catch (Exception e) {
- LOG.log(Level.SEVERE, "Failed to create InMemoryIndex : " + e.getMessage(), e);
- return null;
- }
- }
-
- public void setTablesFile(String tablesFile) {
- this.tablesFile = tablesFile;
- }
-
-}
[05/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/site/xdoc/development/maven.xml
----------------------------------------------------------------------
diff --git a/pushpull/src/site/xdoc/development/maven.xml b/pushpull/src/site/xdoc/development/maven.xml
deleted file mode 100755
index d79f341..0000000
--- a/pushpull/src/site/xdoc/development/maven.xml
+++ /dev/null
@@ -1,176 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more contributor
-license agreements. See the NOTICE.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.
--->
-<document>
- <properties>
- <title>Using Maven</title>
- <author email="woollard@jpl.nasa.gov">David Woollard</author>
- <author email="sean.hardman@jpl.nasa.gov">Sean Hardman</author>
- </properties>
-
- <body>
- <section name="Using Maven">
- <p>OODT uses <a href="http://maven.apache.org/">Maven</a> for
- managing our build environment. Maven is an open source product from the
- <a href="http://www.apache.org/">Apache Software Foundation</a> that improves
- on <a href="http://ant.apache.org/">Ant</a> in the area of build management,
- which it turn was an improvement on Make. This document describes the use of
- Maven for Apache OODT build management.</p>
- </section>
-
- <section name="Setup">
- <p>Maven can be downloaded from the
- <a href="http://maven.apache.org/download.html">Maven Download</a>
- page. OODT is using version 2.0 and above. Maven was developed in Java so it
- will run on the popular platforms (e.g., Windows, Mac OSX, etc.). Beyond
- making sure the <i>mvn</i> executable is in your path, there is very little
- setup required.</p>
-
- <p>Maven is based on the concept of a Project Object Model (POM) which is
- contained in the <i>pom.xml</i> file found at the root of each project.
- The POM allows Maven to manage a project's build, reporting and documentation.
- For OODT, much of the default information for managing the projects is
- contained in a parent POM, which is located in the <i>oodt-core</i> project. So,
- in order to build any of the other projects (e.g., cas-curator, cas-filemgr,
- etc.) the parent POM must be downloaded from the OODT Maven repository. The
- local <i>pom.xml</i> files for each of the projects have been configured to
- retrieve the parent POM automatically.</p>
-
- <p>Once Maven has been setup, the first step to building a project with Maven
- is to checkout a project's source code into the developer's work area. See the
- <a href="../development/subversion.html">Using Subversion</a> document for how to
- check out projects from the CM repository.</p>
- </section>
-
- <section name="Project Structure">
- <p>In order for default Maven functions to operate properly, there is a
- suggested project directory structure. The structure is as follows:</p>
-
- <source>
-/
- src/ Source Code (everything)
- main/ Program Source
- assembly/ Package Descriptor
- java/ Java Source
- resources/ Scripts, Config File, etc.
- ...
- test/ Test Source
- java/
- resources/
- ...
- site/ Site Documentation
- apt/ Docs in APT Format
- index.apt
- ...
- xdoc/ Docs in XDOC Format
- index.xml
- ...
- resources/
- images/
- site.xml Menu Structure
-
- target/ Build Results (binaries, docs and packages)
- ...
-
- LICENSE.txt
- README.txt
- pom.xml Project Object Model (POM)
- </source>
- </section>
-
- <section name="Standard Commands">
- <p>There are few standard commands that developers will use on a daily basis
- and they are related to building and cleaning a project.</p>
- <subsection name="Build a Project">
- <p>Build the project's libraries and executables with the following
- command:</p>
- <source>
-mvn compile
- </source>
- <p>The above command will generate the artifacts in the <i>target/</i>
- directory.</p>
- </subsection>
- <subsection name="Install a Project">
- <p>Install the project's artifacts locally with the following command:</p>
- <source>
-mvn install
- </source>
- <p>Prior to installation, the above command will compile the source code,
- if necessary, and execute the unit tests. The result of the above command
- is to install the generated artifacts (e.g. pom, jar, etc.) in the user's
- local Maven repository ($HOME/.m2/repository/). This is useful when the
- artifact is a dependency for another project but has yet to be deployed
- to the Maven repository.</p>
- </subsection>
- <subsection name="Package a Project">
- <p>Create the project's distribution package with the following command:</p>
- <source>
-mvn package
- </source>
- <p>Prior to package creation, the above command will compile the source
- code, if necessary, and execute the unit tests. The above command will
- create the package(s) in the target/ directory.</p>
- </subsection>
- <subsection name="Build a Project's Web Site">
- <p>Build the project's web site with the following command:</p>
- <source>
-mvn site
- </source>
- <p>The above command will generate the web site in the <i>target/site/</i>
- directory. View the site by pointing your web browser at the
- <i>index.html</i> file within that directory.</p>
- </subsection>
- <subsection name="Clean a Project">
- <p>Clean out the project directory of generated artifacts with the
- following command:</p>
- <source>
-mvn clean
- </source>
- <p>The above command will remove the <i>target/</i> directory and its
- contents.</p>
- </subsection>
- <subsection name="Useful Command Arguments">
- <p>There a couple of useful arguments which can be appended to the
- commands above to limit the scope of the command.</p>
- <p>In order to skip unit test execution, add the following argument:</p>
- <source>
-mvn [command] -Dmaven.test.skip=true
- </source>
- <p>The above command is most useful with the <i>install</i>,
- <i>package</i> and <i>site</i> commands.</p>
- <p>When a project has modules defined in the POM, the command can be
- performed against the top level of the project instead of the modules by
- adding the following argument:</p>
- <source>
-mvn [command] --non-recursive
- </source>
- </subsection>
- </section>
- <section name="Acknowledgments">
- <p>Much of the material in this Maven guide was originally authored
- by Sean Hardman under the sponsorship of NASA Jet Propulsion
- Laboratory's Planetary Data System. </p>
- </section>
- <section name="References">
- <p>Here is a list of Maven resources:</p>
- <ul>
- <li><a href="http://maven.apache.org/guides/index.html">Online
- Documentation Index</a></li>
- </ul>
- </section>
- </body>
-</document>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/site/xdoc/user/advanced.xml
----------------------------------------------------------------------
diff --git a/pushpull/src/site/xdoc/user/advanced.xml b/pushpull/src/site/xdoc/user/advanced.xml
deleted file mode 100644
index ecd3ad4..0000000
--- a/pushpull/src/site/xdoc/user/advanced.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more contributor
-license agreements. See the NOTICE.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.
--->
-<document>
- <properties>
- <title>CAS Push Pull User Guide</title>
- <author email="Chris.Mattmann@jpl.nasa.gov">Chris Mattmann</author>
- <author email="woollard@jpl.nasa.gov">Dave Woollard</author>
- </properties>
-
- <body>
- <div class="warning">This document is in the process of being reorganized as
- part of our ongoing documentation effort. Please check back for updates.</div>
-
- <section name="Introduction">
-
- <p>In the CAS Push Pull Framework Advanced User Guide, we will cover a number of
- advanced topics related to using the system, including situations
- that have arisen in the authors' experiences. Basic
- concepts, such as installation and configuration, can be found in the
- <a href="../user/basic.html">Basic User Guide</a>.</p>
-
- <p>The remainder of this guide is separated into the following sections:</p>
- <ul>
- <li><a href="#section1">TBD</a></li>
- </ul>
-
- </section>
-
- <a name="section1"/>
- <section name="TBD">
- <p>Coming Soon...</p>
- </section>
-
- </body>
-</document>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/site/xdoc/user/basic.xml
----------------------------------------------------------------------
diff --git a/pushpull/src/site/xdoc/user/basic.xml b/pushpull/src/site/xdoc/user/basic.xml
deleted file mode 100644
index 2aee3e5..0000000
--- a/pushpull/src/site/xdoc/user/basic.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more contributor
-license agreements. See the NOTICE.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.
--->
-<document>
- <properties>
- <title>CAS Push Pull User Guide</title>
- <author email="Chris.Mattmann@jpl.nasa.gov">Chris Mattmann</author>
- <author email="woollard@jpl.nasa.gov">Dave Woollard</author>
- </properties>
-
- <body>
- <div class="warning">This document is in the process of being reorganized as
- part of our ongoing documentation effort. Please check back for updates.</div>
-
- <section name="Introduction">
-
- <p>This document serves as a basic user's guide for the CAS Push Pull Framework
- project. The goal of the document is to allow users to check out, build, and
- install a base version of the CAS Push Pull Framework as well as perform basic
- configuration tasks. For advanced topics, please see our
- <a href="../user/advanced.html">Advanced Guide.</a></p>
-
- <p>The remainder of this guide is separated into the following sections:</p>
- <ul>
- <li><a href="#section1">TBD</a></li>
- </ul>
-
- </section>
-
- <a name="section1"/>
- <section name="TBD">
- <p>Coming Soon...</p>
- </section>
-
- </body>
-</document>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/site/xdoc/user/index.xml
----------------------------------------------------------------------
diff --git a/pushpull/src/site/xdoc/user/index.xml b/pushpull/src/site/xdoc/user/index.xml
deleted file mode 100644
index 6b3c916..0000000
--- a/pushpull/src/site/xdoc/user/index.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more contributor
-license agreements. See the NOTICE.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.
--->
-<document>
- <properties>
- <title>CAS Push Pull Framework User Guide</title>
- <author email="Chris.Mattmann@jpl.nasa.gov">Chris Mattmann</author>
- <author email="woollard@jpl.nasa.gov">Dave Woollard</author>
- </properties>
-
- <body>
-
- <div class="warning">This document is in the process of being reorganized as
- part of our ongoing documentation effort. Please follow the links below to find
- information that has previously been hosted on this page.</div>
-
-
- <p>We are in the process of upgrading OODT documentation. In the near
- future, we hope to provide information for developers regarding each
- component, including its purpose, structure, interfaces, and
- configuration points in a <a href="../development/developer.html">Developer
- Guide.</a></p>
-
- <p>Information for users, including installation and basic configuration,
- as well as example usage are provided in a
- <a href="../user/basic.html">Basic User Guide.</a> Advanced topics, like
- look and feel, lessons-learned, and best practices are provided in an
- <a href="../user/advanced.html">Advanced User Guide.</a></p>
-
- <p>Finally, we are planning to provide a number of case studies in the
- future, in which multi-component deployments are configured to handle
- common data and computation management scenarios.</p>
-
- </body>
-</document>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/test/org/apache/oodt/cas/pushpull/filerestrictions/parsers/GenericEmailParserTest.java
----------------------------------------------------------------------
diff --git a/pushpull/src/test/org/apache/oodt/cas/pushpull/filerestrictions/parsers/GenericEmailParserTest.java b/pushpull/src/test/org/apache/oodt/cas/pushpull/filerestrictions/parsers/GenericEmailParserTest.java
deleted file mode 100644
index e098c87..0000000
--- a/pushpull/src/test/org/apache/oodt/cas/pushpull/filerestrictions/parsers/GenericEmailParserTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.pushpull.filerestrictions.parsers;
-
-// JUnit static imports
-import static org.junit.Assert.assertThat;
-
-
-// JDK imports
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.net.URISyntaxException;
-import java.util.List;
-
-
-import org.apache.oodt.cas.metadata.Metadata;
-// OODT imports
-import org.apache.oodt.cas.pushpull.exceptions.ParserException;
-import org.apache.oodt.cas.pushpull.filerestrictions.FileRestrictions;
-import org.apache.oodt.cas.pushpull.filerestrictions.VirtualFileStructure;
-
-// JUnit imports
-import org.hamcrest.Matchers;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
-/**
- * Test class for {@link GenericEmailParser}.
- *
- * @author bfoster@apache.org (Brian Foster)
- */
-@RunWith(JUnit4.class)
-public class GenericEmailParserTest {
-
- private File emailFile;
-
- @Before
- public void setUp() throws URISyntaxException {
- emailFile = new File(ClassLoader.getSystemResource("TestEmail.txt").toURI());
- }
-
- @Test
- public void testGenericEmailParser() throws ParserException, FileNotFoundException {
- GenericEmailParser parser = new GenericEmailParser(
- "Wav File: ([^\\s]+)", "Dear Lousy Customer,", null);
- VirtualFileStructure vfs = parser.parse(new FileInputStream(emailFile), new Metadata());
- List<String> filePaths = FileRestrictions.toStringList(vfs.getRootVirtualFile());
- assertThat(filePaths.size(), Matchers.is(1));
- assertThat(filePaths.get(0), Matchers.is("/some/path/to/a/wav/file.wav"));
- }
-
- @Test (expected = ParserException.class)
- public void testFailedValidEmailCheck() throws ParserException, FileNotFoundException {
- GenericEmailParser parser = new GenericEmailParser(
- "Wav File: ([^\\s]+)", "Phrase Not Found", null);
- parser.parse(new FileInputStream(emailFile), new Metadata());
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/test/resources/TestEmail.txt
----------------------------------------------------------------------
diff --git a/pushpull/src/test/resources/TestEmail.txt b/pushpull/src/test/resources/TestEmail.txt
deleted file mode 100644
index fd5a7fa..0000000
--- a/pushpull/src/test/resources/TestEmail.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-
-Dear Lousy Customer,
-
-Your file is ready to download.
-
-File size: 12345
-
-Wav File: /some/path/to/a/wav/file.wav
-
-MDB Hash File: /some/path/to/a/md5/file.md5
-
-Thanks!
-Files-R-Us
-
-PS
-You only get this notification once so download now!!!!!
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/sso/pom.xml
----------------------------------------------------------------------
diff --git a/sso/pom.xml b/sso/pom.xml
deleted file mode 100644
index cdb59a2..0000000
--- a/sso/pom.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more contributor
-license agreements. See the NOTICE.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>
- <parent>
- <groupId>org.apache.oodt</groupId>
- <artifactId>oodt-core</artifactId>
- <version>1.1-SNAPSHOT</version>
- <relativePath>../core/pom.xml</relativePath>
- </parent>
- <artifactId>oodt-sso</artifactId>
- <packaging>jar</packaging>
- <name>OODT Single Sign On Security Package</name>
- <properties />
- <!-- All dependencies should be listed in core/pom.xml and be ordered alphabetically by package and artifact.
- Once the dependency is in the core pom, it can then be used in other modules without the version tags.
- For example, within core/pom.xml:
-
- <dependency>
- <groupId>com.amazonaws</groupId>
- <artifactId>aws-java-sdk</artifactId>
- <version>1.7.4</version>
- </dependency>
-
- Elsewhere in the platform:
- <dependency>
- <groupId>com.amazonaws</groupId>
- <artifactId>aws-java-sdk</artifactId>
- </dependency>
-
- Where possible the same dependency version should be used across the whole platform but if required the version
- can be overridden in a specific pom and should have a comment explaing why the version has been overridden
- -->
- <dependencies>
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <version>1.3</version>
- </dependency>
- <dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- <version>3.0</version>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.4</version>
- </dependency>
- <dependency>
- <groupId>org.apache.oodt</groupId>
- <artifactId>cas-metadata</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- </dependencies>
- <build>
- <plugins />
- </build>
- <distributionManagement />
-</project>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/sso/src/main/java/org/apache/oodt/security/sso/AbstractWebBasedSingleSignOn.java
----------------------------------------------------------------------
diff --git a/sso/src/main/java/org/apache/oodt/security/sso/AbstractWebBasedSingleSignOn.java b/sso/src/main/java/org/apache/oodt/security/sso/AbstractWebBasedSingleSignOn.java
deleted file mode 100644
index 1ad57cb..0000000
--- a/sso/src/main/java/org/apache/oodt/security/sso/AbstractWebBasedSingleSignOn.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.security.sso;
-
-//JDK imports
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- *
- * Abstract class providing an HTTP request and response interface pair to allow
- * for persistence and management of state information related to SingleSignOn.
- *
- * @author mattmann
- * @version $Revision$
- *
- */
-public abstract class AbstractWebBasedSingleSignOn implements SingleSignOn {
-
- protected HttpServletResponse res;
-
- protected HttpServletRequest req;
-
- public AbstractWebBasedSingleSignOn() {
- this.req = null;
- this.res = null;
- }
-
- /**
- * Constructs a new {@link AbstractWebBasedSingleSignOn} with the given HTTP
- * request and response.
- *
- * @param res
- * The {@link HttpServletRequest}.
- * @param req
- * The {@link HttpServletResponse}.
- */
- public AbstractWebBasedSingleSignOn(HttpServletResponse res,
- HttpServletRequest req) {
- this.res = res;
- this.req = req;
- }
-
- /**
- * @return the res
- */
- public HttpServletResponse getRes() {
- return res;
- }
-
- /**
- * @param res
- * the res to set
- */
- public void setRes(HttpServletResponse res) {
- this.res = res;
- }
-
- /**
- * @return the req
- */
- public HttpServletRequest getReq() {
- return req;
- }
-
- /**
- * @param req
- * the req to set
- */
- public void setReq(HttpServletRequest req) {
- this.req = req;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/sso/src/main/java/org/apache/oodt/security/sso/DummyImpl.java
----------------------------------------------------------------------
diff --git a/sso/src/main/java/org/apache/oodt/security/sso/DummyImpl.java b/sso/src/main/java/org/apache/oodt/security/sso/DummyImpl.java
deleted file mode 100644
index dfc88be..0000000
--- a/sso/src/main/java/org/apache/oodt/security/sso/DummyImpl.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.security.sso;
-
-//JDK imports
-import java.util.Collections;
-import java.util.List;
-
-/**
- *
- * Dummy implementation of SSO auth -- if you're logged in, it logs you out. If
- * you're logged out, it logs you in. Both are independent of the actual
- * username/password combination you enter. On top of that, your username will
- * always be <code>guest</code>.
- *
- * @author mattmann
- * @version $Revision$
- *
- */
-public class DummyImpl extends AbstractWebBasedSingleSignOn {
-
- private static final String DEFAULT_USERNAME = "guest";
-
- private static final String DEFAULT_GROUP = "guest";
-
- private boolean connected = false;
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.oodt.cas.security.sso.SingleSignOn#getCurrentUsername()
- */
- public String getCurrentUsername() {
- return DEFAULT_USERNAME;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.oodt.cas.security.sso.SingleSignOn#getLastConnectionStatus()
- */
- public boolean getLastConnectionStatus() {
- // TODO Auto-generated method stub
- return this.connected;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.oodt.cas.security.sso.SingleSignOn#isLoggedIn()
- */
- public boolean isLoggedIn() {
- // TODO Auto-generated method stub
- return this.connected;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.oodt.cas.security.sso.SingleSignOn#login(java.lang.String,
- * java.lang.String)
- */
- public boolean login(String username, String password) {
- this.connected = true;
- return true;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.oodt.cas.security.sso.SingleSignOn#logout()
- */
- public void logout() {
- this.connected = false;
- }
-
- /* (non-Javadoc)
- * @see org.apache.oodt.cas.security.sso.SingleSignOn#retrieveGroupsForUser(java.lang.String)
- */
- public List<String> retrieveGroupsForUser(String username) {
- return Collections.singletonList(DEFAULT_GROUP);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/sso/src/main/java/org/apache/oodt/security/sso/OpenSSOImpl.java
----------------------------------------------------------------------
diff --git a/sso/src/main/java/org/apache/oodt/security/sso/OpenSSOImpl.java b/sso/src/main/java/org/apache/oodt/security/sso/OpenSSOImpl.java
deleted file mode 100755
index 0c0db54..0000000
--- a/sso/src/main/java/org/apache/oodt/security/sso/OpenSSOImpl.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.security.sso;
-
-import org.apache.commons.codec.binary.Base64;
-import org.apache.oodt.security.sso.opensso.SSOMetKeys;
-import org.apache.oodt.security.sso.opensso.SSOProxy;
-import org.apache.oodt.security.sso.opensso.SingleSignOnException;
-import org.apache.oodt.security.sso.opensso.UserDetails;
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.List;
-import java.util.Vector;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.servlet.http.Cookie;
-
-/**
- *
- * Connects to OpenSSO's authorization endpoint and authenticates a user,
- * implementing the CAS {@link AbstractWebBasedSingleSignOn} interface. This
- * class can be used in e.g., CAS curator to link into Open SSO.
- */
-public class OpenSSOImpl extends AbstractWebBasedSingleSignOn implements
- SSOMetKeys {
-
- private static final Logger LOG = Logger.getLogger(OpenSSOImpl.class
- .getName());
-
- private SSOProxy ssoProxy;
-
- /**
- * Default constructor.
- */
- public OpenSSOImpl() {
- this.ssoProxy = new SSOProxy();
- }
-
- public String getCurrentUsername() {
- String cookieVal = this.getCookieVal(USER_COOKIE_KEY);
- if (cookieVal == null) {
- // let's try and get the SSO token
- // and pull the username from there
- String ssoToken = this.getSSOToken();
- if (ssoToken != null) {
- UserDetails details;
- try {
- details = this.ssoProxy.getUserAttributes(ssoToken);
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- return UNKNOWN_USER;
- }
- return details.getAttributes().getMetadata(UID_ATTRIBUTE_NAME) != null ? details
- .getAttributes().getMetadata(UID_ATTRIBUTE_NAME) : UNKNOWN_USER;
- } else {
- return UNKNOWN_USER;
- }
- } else {
- return new String(Base64.decodeBase64(cookieVal.getBytes()));
- }
- }
-
- public boolean getLastConnectionStatus() {
- return this.isLoggedIn();
- }
-
- public boolean isLoggedIn() {
- // TODO: make sure the token is valid?
- return (this.getSSOToken() != null);
- }
-
- public boolean login(String username, String password) {
-
- String ssoToken;
- try {
- ssoToken = this.ssoProxy.authenticate(username, password);
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- return false;
- }
-
- this.addCookie(SSO_COOKIE_KEY, "\"" + ssoToken + "\"");
-
- this.addCookie(USER_COOKIE_KEY,
- "\"" + new String(Base64.encodeBase64(username.getBytes())) + "\"");
-
- return true;
- }
-
- public void logout() {
- this.ssoProxy.logout(this.getSSOToken());
- this.clearCookie(SSO_COOKIE_KEY);
- this.clearCookie(USER_COOKIE_KEY);
- }
-
- /**
- * Gets the SSO groups for the LMMP user, identified by her
- * <code>ssoAuth</code>, where her User ID is provided by
- * {@link OpenSSOImpl#getCurrentUsername()} and her Token is provided by
- * {@link OpenSSOImpl#getSSOToken()}.
- *
- * @return A {@link List} of String LMMP groups for the User.
- * @throws Exception
- * If any error (e.g., HTTP REST error) occurs.
- */
- public List<String> getGroupsForUser() throws IOException, SingleSignOnException {
- String token = this.getSSOToken();
- if (token == null) {
- return Collections.EMPTY_LIST;
- } else {
- UserDetails details = this.ssoProxy.getUserAttributes(token);
- // groups are formatted in this response to include whole
- // principals, like lmmp-infra,...principal
- // so split on "," and take the first token to get the group name
- List<String> groups = new Vector<String>();
- for (String rawGroup : details.getRoles()) {
- groups.add(rawGroup.split(",")[0]);
- }
-
- return groups;
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.oodt.security.sso.SingleSignOn#retrieveGroupsForUser(java.lang
- * .String)
- */
- @Override
- public List<String> retrieveGroupsForUser(String username) {
- // FIXME: not implemented yet
- return Collections.EMPTY_LIST;
- }
-
- protected String getSSOToken() {
- String cookieVal = this.getCookieVal(SSO_COOKIE_KEY);
- if (cookieVal != null) {
- return cookieVal;
- } else {
- return null;
- }
- }
-
- private String getCookieVal(String name) {
- Cookie[] cookies = this.req.getCookies();
- for (Cookie cookie : cookies) {
- if (cookie.getName().equals(name)) {
- return cookie.getValue().startsWith("\"")
- && cookie.getValue().endsWith("\"") ? cookie.getValue().substring(
- 1, cookie.getValue().length() - 1) : cookie.getValue();
- }
- }
-
- return null;
- }
-
- private void addCookie(String name, String val) {
- Cookie userCookie = new Cookie(name, val);
- userCookie.setPath("/");
- userCookie.setMaxAge((int) (System.currentTimeMillis() + (60 * 15)));
- this.res.addCookie(userCookie);
- }
-
- private void clearCookie(String name) {
- Cookie userCookie = new Cookie(name, "blank");
- userCookie.setPath("/");
- userCookie.setMaxAge(0);
- this.res.addCookie(userCookie);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/sso/src/main/java/org/apache/oodt/security/sso/SingleSignOn.java
----------------------------------------------------------------------
diff --git a/sso/src/main/java/org/apache/oodt/security/sso/SingleSignOn.java b/sso/src/main/java/org/apache/oodt/security/sso/SingleSignOn.java
deleted file mode 100644
index 3835bf8..0000000
--- a/sso/src/main/java/org/apache/oodt/security/sso/SingleSignOn.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.security.sso;
-
-//JDK imports
-import java.util.List;
-
-/**
- *
- * The CAS java-based single sign on API.
- *
- * @author mattmann
- * @version $Revision$
- *
- */
-public interface SingleSignOn {
-
- /**
- * Should return the current logged in Single Sign On username returned from
- * the implementation-specific authentication API.
- *
- * @return A string representation of the current SSO username.
- */
- String getCurrentUsername();
-
- /**
- * Returns <code>true</code> when the user is logged in, or false otherwise.
- *
- * @return True if the user is logged in, false otherwise.
- */
- boolean isLoggedIn();
-
- /**
- * Logs the user with the provided <code>username</code> and
- * <code>password</code> in to the SSO authentication mechanism.
- *
- * @param username
- * The username credentials.
- * @param password
- * The password credentials.
- * @return True if the login was successful, false otherwise.
- */
- boolean login(String username, String password);
-
- /**
- * Logs the current SSO user out of her session.
- */
- void logout();
-
- /**
- * Should provide information (true or false) as to whether the last
- * connection to the SSO authentication service was successful.
- *
- * @return True if the last authentication was successful, false otherwise.
- */
- boolean getLastConnectionStatus();
-
- /**
- * Obtains a user's groups from the security principal that this SSO object
- * talks to.
- *
- * @param username
- * The username to obtain the groups for.
- * @return A {@link List} of string group names obtained from the security
- * principal.
- **/
- List<String> retrieveGroupsForUser(String username);
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/sso/src/main/java/org/apache/oodt/security/sso/SingleSignOnFactory.java
----------------------------------------------------------------------
diff --git a/sso/src/main/java/org/apache/oodt/security/sso/SingleSignOnFactory.java b/sso/src/main/java/org/apache/oodt/security/sso/SingleSignOnFactory.java
deleted file mode 100644
index e3753a6..0000000
--- a/sso/src/main/java/org/apache/oodt/security/sso/SingleSignOnFactory.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.security.sso;
-
-
-//JDK imports
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- *
- * Object factory for creating {@link SingleSignOn}s from class name Strings.
- *
- * @author mattmann
- * @version $Revision$
- *
- */
-public final class SingleSignOnFactory {
-
- private static final Logger LOG = Logger.getLogger(SingleSignOnFactory.class
- .getName());
-
- @SuppressWarnings("unchecked")
- public static AbstractWebBasedSingleSignOn getWebBasedSingleSignOn(String className) {
- AbstractWebBasedSingleSignOn sso;
- Class<AbstractWebBasedSingleSignOn> clazz;
-
- try {
- clazz = (Class<AbstractWebBasedSingleSignOn>) Class.forName(className);
- sso = clazz.newInstance();
- return sso;
- } catch (ClassNotFoundException e) {
- LOG.log(Level.SEVERE, e.getMessage());
- LOG.log(Level.WARNING,
- "ClassNotFoundException when loading web based sso class "
- + className + " Message: " + e.getMessage());
- } catch (InstantiationException e) {
- LOG.log(Level.SEVERE, e.getMessage());
- LOG.log(Level.WARNING,
- "InstantiationException when loading web based sso class "
- + className + " Message: " + e.getMessage());
- } catch (IllegalAccessException e) {
- LOG.log(Level.SEVERE, e.getMessage());
- LOG.log(Level.WARNING,
- "IllegalAccessException when loading web based sso class "
- + className + " Message: " + e.getMessage());
- }
-
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/sso/src/main/java/org/apache/oodt/security/sso/opensso/IdentityDetails.java
----------------------------------------------------------------------
diff --git a/sso/src/main/java/org/apache/oodt/security/sso/opensso/IdentityDetails.java b/sso/src/main/java/org/apache/oodt/security/sso/opensso/IdentityDetails.java
deleted file mode 100755
index 97916f1..0000000
--- a/sso/src/main/java/org/apache/oodt/security/sso/opensso/IdentityDetails.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.security.sso.opensso;
-
-//JDK imports
-import org.apache.oodt.cas.metadata.Metadata;
-
-import java.util.List;
-import java.util.Vector;
-
-//OODT imports
-
-/**
- *
- * The response from a call to {@link SSOMetKeys#IDENTITY_READ_ENDPOINT}.
- *
- * @author mattmann
- * @version $Revision$
- *
- */
-public class IdentityDetails {
-
- private String name;
-
- private String type;
-
- private String realm;
-
- private List<String> groups;
-
- private Metadata attributes;
-
- public IdentityDetails() {
- this.name = null;
- this.type = null;
- this.realm = null;
- this.groups = new Vector<String>();
- this.attributes = new Metadata();
- }
-
- /**
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param name
- * the name to set
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * @return the type
- */
- public String getType() {
- return type;
- }
-
- /**
- * @param type
- * the type to set
- */
- public void setType(String type) {
- this.type = type;
- }
-
- /**
- * @return the realm
- */
- public String getRealm() {
- return realm;
- }
-
- /**
- * @param realm
- * the realm to set
- */
- public void setRealm(String realm) {
- this.realm = realm;
- }
-
- /**
- * @return the groups
- */
- public List<String> getGroups() {
- return groups;
- }
-
- /**
- * @param groups
- * the groups to set
- */
- public void setGroups(List<String> groups) {
- this.groups = groups;
- }
-
- /**
- * @return the attributes
- */
- public Metadata getAttributes() {
- return attributes;
- }
-
- /**
- * @param attributes
- * the attributes to set
- */
- public void setAttributes(Metadata attributes) {
- this.attributes = attributes;
- }
-
- public String toString() {
- return "[name=" + this.name + ",type=" + this.type + ",realm=" + this.realm + ",roles=" + this.groups
- + ",attributes=" + this.attributes.getMap() + "]";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/sso/src/main/java/org/apache/oodt/security/sso/opensso/SSOMetKeys.java
----------------------------------------------------------------------
diff --git a/sso/src/main/java/org/apache/oodt/security/sso/opensso/SSOMetKeys.java b/sso/src/main/java/org/apache/oodt/security/sso/opensso/SSOMetKeys.java
deleted file mode 100755
index 0e97221..0000000
--- a/sso/src/main/java/org/apache/oodt/security/sso/opensso/SSOMetKeys.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.security.sso.opensso;
-
-/**
- *
- * Met keys for dealing with {@link SSOProxy}.
- *
- */
-public interface SSOMetKeys {
-
- /* service endpoints */
- String AUTHENTICATE_ENDPOINT = "https://host/opensso/identity/authenticate";
-
- String IDENTITY_READ_ENDPOINT = "https://host/opensso/identity/read";
-
- String IDENTITY_ATTRIBUTES_ENDPOINT = "https://host/opensso/identity/attributes";
-
- String LOGOUT_ENDPOINT = "https://host/opensso/identity/logout";
-
- /* cookie names */
-
- String SSO_COOKIE_KEY = "iPlanetDirectoryPro";
-
- String USER_COOKIE_KEY = "curationWebapp";
-
- /* Identity Details response object */
-
- String IDENTITY_DETAILS_NAME = "identitydetails.name";
-
- String IDENTITY_DETAILS_TYPE = "identitydetails.type";
-
- String IDENTITY_DETAILS_REALM = "identitydetails.realm";
-
- String IDENTITY_DETAILS_GROUP = "identitydetails.group";
-
- String IDENTITY_DETAILS_ATTR_NAME = "identitydetails.attribute.name";
-
- String IDENTITY_DETAILS_ATTR_VALUE = "identitydetails.attribute.value";
-
- String IDENTITY_DETAILS_ATTR_SKIP_LINE = "identitydetails.attribute=";
-
- /* User Details response object */
- String USER_DETAILS_TOKEN = "userdetails.token.id";
-
- String USER_DETAILS_ROLE = "userdetails.role=id";
-
- String USER_DETAILS_ATTR_NAME = "userdetails.attribute.name";
-
- String USER_DETAILS_ATTR_VALUE = "userdetails.attribute.value";
-
- String UID_ATTRIBUTE_NAME = "uid";
-
- /* commands available from SSOProxy command line */
- String AUTH_COMMAND = "authenticate";
-
- String IDENTITY_COMMAND = "identity";
-
- String ATTRIBUTES_COMMAND = "attributes";
-
- String LOGOUT_COMMAND = "logout";
-
- /* general stuff */
- String UNKNOWN_USER = "Unknown";
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/sso/src/main/java/org/apache/oodt/security/sso/opensso/SSOProxy.java
----------------------------------------------------------------------
diff --git a/sso/src/main/java/org/apache/oodt/security/sso/opensso/SSOProxy.java b/sso/src/main/java/org/apache/oodt/security/sso/opensso/SSOProxy.java
deleted file mode 100755
index 5d77083..0000000
--- a/sso/src/main/java/org/apache/oodt/security/sso/opensso/SSOProxy.java
+++ /dev/null
@@ -1,308 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.security.sso.opensso;
-
-
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpException;
-import org.apache.commons.httpclient.HttpStatus;
-import org.apache.commons.httpclient.NameValuePair;
-import org.apache.commons.httpclient.methods.PostMethod;
-
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- *
- * A client class to the services provided by the <a
- * href="https://opensso.dev.java.net/">OpenSSO</a> project. The descriptions of
- * these services are <a
- * href="http://developers.sun.com/identity/reference/techart/id-svcs.html"
- * >here</a>.
- *
- * @author mattmann
- * @version $Revision$
- *
- */
-public class SSOProxy implements SSOMetKeys {
-
- private static final Logger LOG = Logger.getLogger(SSOProxy.class.getName());
- private static final String AUTH_ENDPOINT;
- private static final String AUTH_ENDPOINT_KEY = "AUTH_ENDPOINT";
- private static final String IDENT_READ_ENDPOINT;
- private static final String IDENT_READ_ENDPOINT_KEY = "IDENT_READ_ENDPOINT";
- private static final String IDENT_ATTR_ENDPOINT;
- private static final String IDENT_ATTR_ENDPOINT_KEY = "IDENT_ATTR_ENDPOINT";
- private static final String LOG_ENDPOINT;
- private static final String LOG_ENDPOINT_KEY = "LOG_ENDPOINT";
-
- static {
- if (System.getProperty(AUTH_ENDPOINT_KEY) != null) {
- AUTH_ENDPOINT = System.getProperty(AUTH_ENDPOINT_KEY);
- } else {
- AUTH_ENDPOINT = AUTHENTICATE_ENDPOINT;
- }
- if (System.getProperty(IDENT_READ_ENDPOINT_KEY) != null) {
- IDENT_READ_ENDPOINT = System.getProperty(IDENT_READ_ENDPOINT_KEY);
- } else {
- IDENT_READ_ENDPOINT = IDENTITY_READ_ENDPOINT;
- }
- if (System.getProperty(IDENT_ATTR_ENDPOINT_KEY) != null) {
- IDENT_ATTR_ENDPOINT = System.getProperty(IDENT_ATTR_ENDPOINT_KEY);
- } else {
- IDENT_ATTR_ENDPOINT = IDENTITY_ATTRIBUTES_ENDPOINT;
- }
- if (System.getProperty(LOG_ENDPOINT_KEY) != null) {
- LOG_ENDPOINT = System.getProperty(LOG_ENDPOINT_KEY);
- } else {
- LOG_ENDPOINT = LOGOUT_ENDPOINT;
- }
-
- LOG.log(Level.INFO, AUTH_ENDPOINT_KEY + " set to " + AUTH_ENDPOINT);
- LOG.log(Level.INFO, IDENT_READ_ENDPOINT_KEY + " set to " + IDENT_READ_ENDPOINT);
- LOG.log(Level.INFO, IDENT_ATTR_ENDPOINT_KEY + " set to " + IDENT_ATTR_ENDPOINT);
- LOG.log(Level.INFO, LOG_ENDPOINT_KEY + " set to " + LOG_ENDPOINT);
- }
-
- public String authenticate(String username, String password) {
- HttpClient httpClient = new HttpClient();
- PostMethod post = new PostMethod(AUTH_ENDPOINT);
- String response;
- String ssoToken = null;
-
- NameValuePair[] data = { new NameValuePair("username", username),
- new NameValuePair("password", password),
- new NameValuePair("uri", "realm/lmmp") };
-
- post.setRequestBody(data);
-
- try {
- httpClient.executeMethod(post);
- if (post.getStatusCode() != HttpStatus.SC_OK) {
- throw new HttpException(post.getStatusLine().toString());
- }
- response = post.getResponseBodyAsString().trim();
- ssoToken = response.substring(9);
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- } finally {
- post.releaseConnection();
- }
-
- return ssoToken;
- }
-
- public IdentityDetails readIdentity(String username, String token)
- throws IOException, SingleSignOnException {
- HttpClient httpClient = new HttpClient();
- PostMethod post = new PostMethod(IDENT_READ_ENDPOINT);
- LOG.log(Level.INFO, "Obtaining identity: username: [" + username
- + "]: token: [" + token + "]: REST url: [" + IDENT_READ_ENDPOINT
- + "]");
- NameValuePair[] data = { new NameValuePair("name", username),
- new NameValuePair("admin", token) };
-
- post.setRequestBody(data);
-
- httpClient.executeMethod(post);
- if (post.getStatusCode() != HttpStatus.SC_OK) {
- throw new SingleSignOnException(post.getStatusLine().toString());
- }
-
- return parseIdentityDetails(post.getResponseBodyAsString().trim());
-
- }
-
- public UserDetails getUserAttributes(String token) throws IOException, SingleSignOnException {
- HttpClient httpClient = new HttpClient();
- PostMethod post = new PostMethod(IDENT_ATTR_ENDPOINT);
- LOG.log(Level.INFO, "Obtaining user attributes: token: [" + token
- + "]: REST url: [" + IDENT_ATTR_ENDPOINT + "]");
- NameValuePair[] data = { new NameValuePair("subjectid", token) };
-
- post.setRequestBody(data);
-
- httpClient.executeMethod(post);
- if (post.getStatusCode() != HttpStatus.SC_OK) {
- throw new SingleSignOnException(post.getStatusLine().toString());
- }
-
- return parseUserDetails(post.getResponseBodyAsString().trim());
-
- }
-
- public void logout(String token) {
- HttpClient httpClient = new HttpClient();
- PostMethod post = new PostMethod(LOG_ENDPOINT);
- LOG.log(Level.INFO, "Logging out: token: [" + token + "]: REST url: ["
- + LOG_ENDPOINT + "]");
- NameValuePair[] data = { new NameValuePair("subjectid", token) };
- post.setRequestBody(data);
-
- try {
- httpClient.executeMethod(post);
- if (post.getStatusCode() != HttpStatus.SC_OK) {
- throw new HttpException(post.getStatusLine().toString());
- }
- } catch (HttpException e) {
- // TODO Auto-generated catch block
- LOG.log(Level.SEVERE, e.getMessage());
- } catch (IOException e) {
- // TODO Auto-generated catch block
- LOG.log(Level.SEVERE, e.getMessage());
- } finally {
- post.releaseConnection();
- }
- }
-
- private IdentityDetails parseIdentityDetails(String serviceResponse) {
- ByteArrayInputStream is = new ByteArrayInputStream(serviceResponse
- .getBytes());
- BufferedReader br = new BufferedReader(new InputStreamReader(is));
- IdentityDetails details = new IdentityDetails();
- String line = null, lastAttrKeyRead = null;
-
- try {
- while ((line = br.readLine()) != null) {
- if (line.equals(IDENTITY_DETAILS_ATTR_SKIP_LINE)) {
- continue;
- }
- String key, val;
- if (line.startsWith(IDENTITY_DETAILS_REALM)) {
- // can't parse it the same way
- key = line.substring(0, IDENTITY_DETAILS_REALM.length());
- val = line.substring(IDENTITY_DETAILS_REALM.length() + 1);
- } else {
- String[] lineToks = line.split("=");
- key = lineToks[0];
- val = lineToks[1];
- }
-
- if (key.equals(IDENTITY_DETAILS_NAME)) {
- details.setName(val);
- } else if (key.equals(IDENTITY_DETAILS_TYPE)) {
- details.setType(val);
- } else if (key.equals(IDENTITY_DETAILS_REALM)) {
- details.setRealm(val);
- } else if (key.equals(IDENTITY_DETAILS_GROUP)) {
- details.getGroups().add(val);
- } else if (key.equals(IDENTITY_DETAILS_ATTR_NAME)) {
- lastAttrKeyRead = val;
- } else if (key.equals(IDENTITY_DETAILS_ATTR_VALUE)) {
- details.getAttributes().addMetadata(lastAttrKeyRead, val);
- }
- }
- } catch (IOException e) {
- LOG.log(Level.SEVERE, e.getMessage());
- LOG.log(Level.WARNING, "Error reading service response line: [" + line
- + "]: Message: " + e.getMessage());
- } finally {
- try {
- is.close();
- } catch (Exception ignore) {
- }
-
- try {
- br.close();
- } catch (Exception ignore) {
- }
-
- }
-
- return details;
- }
-
- private UserDetails parseUserDetails(String serviceResponse) {
- ByteArrayInputStream is = new ByteArrayInputStream(serviceResponse
- .getBytes());
- BufferedReader br = new BufferedReader(new InputStreamReader(is));
- UserDetails details = new UserDetails();
- String line = null, lastAttrKeyRead = null;
-
- try {
- while ((line = br.readLine()) != null) {
- String key, val;
- if (line.startsWith(USER_DETAILS_ROLE)) {
- // can't parse by splitting, parse by using substring
- key = line.substring(0, USER_DETAILS_ROLE.length());
- val = line.substring(USER_DETAILS_ROLE.length() + 1);
- } else {
- String[] lineToks = line.split("=");
- key = lineToks[0];
- val = lineToks[1];
- }
-
- if (key.equals(USER_DETAILS_TOKEN)) {
- details.setToken(val);
- } else if (key.equals(USER_DETAILS_ROLE)) {
- details.getRoles().add(val);
- } else if (key.equals(USER_DETAILS_ATTR_NAME)) {
- lastAttrKeyRead = val;
- } else if (key.equals(USER_DETAILS_ATTR_VALUE)) {
- details.getAttributes().addMetadata(lastAttrKeyRead, val);
- }
- }
- } catch (IOException e) {
- LOG.log(Level.SEVERE, e.getMessage());
- LOG.log(Level.WARNING, "Error reading service response line: [" + line
- + "]: Message: " + e.getMessage());
- } finally {
- try {
- is.close();
- } catch (Exception ignore) {
- }
-
- try {
- br.close();
- } catch (Exception ignore) {
- }
-
- }
-
- return details;
- }
-
- public static void main(String[] args) throws IOException, SingleSignOnException {
- String usage = "SSOProxy <cmd> [args]\n\n" + "Where cmd is one of:\n"
- + "authenticate <user> <pass>\n" + "identity <user> <token>\n"
- + "attributes <token>\nlogout <token>\n";
-
- if (args.length < 2 || args.length > 3) {
- System.err.println(usage);
- System.exit(1);
- }
-
- String cmd = args[0];
- SSOProxy sso = new SSOProxy();
- if (cmd.equals(AUTH_COMMAND)) {
- System.out.println(sso.authenticate(args[1], args[2]));
- } else if (cmd.equals(IDENTITY_COMMAND)) {
- System.out.println(sso.readIdentity(args[1], args[2]));
- } else if (cmd.equals(ATTRIBUTES_COMMAND)) {
- System.out.println(sso.getUserAttributes(args[1]));
- } else if (cmd.equals(LOGOUT_COMMAND)) {
- sso.logout(args[1]);
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/sso/src/main/java/org/apache/oodt/security/sso/opensso/SingleSignOnException.java
----------------------------------------------------------------------
diff --git a/sso/src/main/java/org/apache/oodt/security/sso/opensso/SingleSignOnException.java b/sso/src/main/java/org/apache/oodt/security/sso/opensso/SingleSignOnException.java
deleted file mode 100644
index bed65e7..0000000
--- a/sso/src/main/java/org/apache/oodt/security/sso/opensso/SingleSignOnException.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package org.apache.oodt.security.sso.opensso;
-
-/**
- * Created by bugg on 27/10/15.
- */
-public class SingleSignOnException extends Exception {
-
- public SingleSignOnException(String message) {
- super(message);
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/sso/src/main/java/org/apache/oodt/security/sso/opensso/UserDetails.java
----------------------------------------------------------------------
diff --git a/sso/src/main/java/org/apache/oodt/security/sso/opensso/UserDetails.java b/sso/src/main/java/org/apache/oodt/security/sso/opensso/UserDetails.java
deleted file mode 100755
index ae442b1..0000000
--- a/sso/src/main/java/org/apache/oodt/security/sso/opensso/UserDetails.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.security.sso.opensso;
-
-//OODT imports
-import org.apache.oodt.cas.metadata.Metadata;
-
-//JDK imports
-import java.util.List;
-import java.util.Vector;
-
-/**
- *
- * The response from a query to {@link SSOMetKeys#IDENTITY_ATTRIBUTES_ENDPOINT}.
- *
- * @author mattmann
- * @version $Revision$
- *
- */
-public class UserDetails {
-
- private String token;
-
- private List<String> roles;
-
- private Metadata attributes;
-
- public UserDetails() {
- this.token = null;
- this.roles = new Vector<String>();
- this.attributes = new Metadata();
- }
-
- /**
- * @return the token
- */
- public String getToken() {
- return token;
- }
-
- /**
- * @param token
- * the token to set
- */
- public void setToken(String token) {
- this.token = token;
- }
-
- /**
- * @return the roles
- */
- public List<String> getRoles() {
- return roles;
- }
-
- /**
- * @param roles
- * the roles to set
- */
- public void setRoles(List<String> roles) {
- this.roles = roles;
- }
-
- /**
- * @return the attributes
- */
- public Metadata getAttributes() {
- return attributes;
- }
-
- /**
- * @param attributes
- * the attributes to set
- */
- public void setAttributes(Metadata attributes) {
- this.attributes = attributes;
- }
-
- public String toString() {
- return "[token=" + this.token + ",roles=" + this.roles + ",attributes=" + this.attributes.getMap() + "]";
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/sso/src/main/php/pear/Config.php
----------------------------------------------------------------------
diff --git a/sso/src/main/php/pear/Config.php b/sso/src/main/php/pear/Config.php
deleted file mode 100644
index 8d3cec1..0000000
--- a/sso/src/main/php/pear/Config.php
+++ /dev/null
@@ -1,65 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- *
- * @package Org_Apache_Oodt_Security
- * @author Andrew F. Hart
- * @version $Revision$
- *
- * PHP Single Sign On Authentication Library and Utilities
- *
- */
-
-/**
- * LDAP Host URI
- *
- * The path to the host where the LDAP directory server is running
- * @var string
- */
-define("SSO_LDAP_HOST", "ldaps://host.domain");
-
-/**
- * LDAP Port
- *
- * The port on @link{SSO_LDAP_HOST} where the LDAP directory server
- * is listening.
- *
- * Default ports:
- * 389: Standard (non-ssl) LDAP (ldap://...)
- * 636: Secure LDAP (ldaps://...)
- * @var string
- */
-define("SSO_LDAP_PORT", 636);
-
-/**
- * Base DN
- *
- * The base domain name to use when interacting with the LDAP server
- *
- * @var string
- */
-define("SSO_BASE_DN", "dc=sample, dc=jpl, dc=nasa, dc=gov");
-
-/**
- * Cookie Key
- *
- * The unique string to use in identifying the security cookie
- *
- */
-define("SSO_COOKIE_KEY", "__ac__sc__");
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/sso/src/main/php/pear/SingleSignOn.php
----------------------------------------------------------------------
diff --git a/sso/src/main/php/pear/SingleSignOn.php b/sso/src/main/php/pear/SingleSignOn.php
deleted file mode 100644
index 512dffa..0000000
--- a/sso/src/main/php/pear/SingleSignOn.php
+++ /dev/null
@@ -1,202 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- *
- * @package Org_Apache_Oodt_Security
- * @author Chris A. Mattmann
- * @author Andrew F. Hart
- * @version $Revision$
- *
- * PHP Single Sign On Library for EDRN PHP-based products.
- *
- */
-
-class Org_Apache_Oodt_Security_SingleSignOn {
-
- private $connectionStatus;
-
- private $conn;
-
- public function __construct() {
- $this->connectionStatus = 1;
- }
-
- public function getCurrentUsername() {
- return $this->getSingleSignOnUsername();
- }
-
- public function isLoggedIn() {
- return ($this->getSingleSignOnUsername() != null);
- }
-
- public function login($username, $password) {
- // first check to see if we are already signed in
- if ($this->getSingleSignOnUsername() <> ""
- && strcmp($this->getSingleSignOnUsername(), $username) == 0) {
- // we're logged in already
- return true;
- } else {
- // log in via LDAP
- $ldaprdn = "uid=" . $username . ',' . SSO_BASE_DN;
- $ldappass = $password;
-
- // connect to ldap server
- $ldapconn = $this->connect(SSO_LDAP_HOST, SSO_LDAP_PORT);
- if ($ldapconn) {
-
- // binding to ldap server
- $ldapbind = @ ldap_bind($ldapconn, $ldaprdn, $ldappass);
-
- // verify binding
- if ($ldapbind) {
- $this->createSingleSignOnCookie($username, $password);
- return true;
- } else {
- return false;
- }
-
- } else {
- $this->connectionStatus = 0;
- return false;
- }
- }
-
- }
-
- public function logout() {
- $this->clearSingleSignOnInfo();
- }
-
- public function getLastConnectionStatus() {
- return ($this->connectionStatus == 1);
- }
-
- public function retrieveGroupsForUser($username,$searchDirectory = SSO_BASE_DN) {
- // attempt to connect to ldap server
- $ldapconn = $this->connect(SSO_LDAP_HOST,SSO_LDAP_PORT);
- $groups = array();
- if ($ldapconn) {
- $filter = "(&(objectClass=groupOfUniqueNames)"
- ."(uniqueMember=uid={$username}," . SSO_BASE_DN . "))";
- $result = ldap_search($ldapconn,$searchDirectory,$filter,array('cn'));
-
- if ($result) {
- $entries = ldap_get_entries($ldapconn,$result);
- foreach ($entries as $rawGroup) {
- if (isset($rawGroup['cn'][0])
- && $rawGroup['cn'][0] != '') {
- $groups[] = $rawGroup['cn'][0];
- }
- }
- }
- }
-
- return $groups;
- }
-
- /**
- *
- * retrieves the set of attributes from the users ldap entry
- * @param string $username user for which attributes will be returned
- * @param array $attributes ldap attributes to retrieve
- * @param string $searchDirectory optional path to users ldap entry
- */
- public function retrieveUserAttributes($username,$attributes,$searchDirectory = SSO_BASE_DN) {
- // attempt to connect to ldap server
- $ldapconn = $this->connect(SSO_LDAP_HOST,SSO_LDAP_PORT);
- $attr = array();
-
- if ($ldapconn) {
- // get user attributes
- $filter = "uid=".$username;
- $result = ldap_search($ldapconn,$searchDirectory,$filter,$attributes);
- if ($result) {
- $entries = ldap_get_entries($ldapconn,$result);
- return $entries;
- } else {
- return array();
- }
- }
- }
-
-
- public function changePassword($newPass,$encryptionMethod = "SHA") {
- if ($this->isLoggedIn()) {
- $user = "uid={$this->getSingleSignOnUsername()}," . SSO_BASE_DN ;
- $entry = array();
-
- switch (strtoupper($encryptionMethod)) {
- case "SHA":
- $entry['userPassword'] = "{SHA} " . base64_encode(pack("H*",sha1($newPass)));
- break;
- case "MD5":
- $entry['userPassword'] = "{MD5} " . base64_encode(pack("H*",md5($newPass)));
- break;
- default:
- throw new Exception("Unsupported encryption method requested");
- }
-
- if (ldap_mod_replace($this->conn,$user,$entry)) {
- return true;
- } else {
- return false;
- }
- } else {
- return false;
- }
- }
-
- public function connect($server,$port) {
- if ($conn = ldap_connect($server,$port)) {
- // Connection established
- $this->connectionStatus = 1;
- ldap_set_option($conn, LDAP_OPT_PROTOCOL_VERSION, 3);
- ldap_set_option($conn, LDAP_OPT_DEBUG_LEVEL, 7);
- ldap_set_option($conn, LDAP_OPT_REFERRALS, 0);
- $this->conn = $conn;
- return $conn;
- } else {
- // Connection failed
- return false;
- }
- }
-
- private function clearSingleSignOnInfo() {
- $oldCookie = $_COOKIE[SSO_COOKIE_KEY];
- setcookie(SSO_COOKIE_KEY, $oldCookie, 1, "/");
- }
-
- private function getSingleSignOnUsername() {
- $theCookie = $_COOKIE[SSO_COOKIE_KEY];
- if ($theCookie <> "") {
- $userpass = base64_decode(urldecode($theCookie));
- $userpassArr = explode(":", $userpass);
- return $userpassArr[0];
- } else
- return null;
- }
-
- private function createSingleSignOnCookie($username, $password) {
- if (!isset ($_COOKIE[SSO_COOKIE_KEY])) {
- $theCookieStrUnencoded = $username . ":" . $password;
- $theCookieStrEncoded = "\"".base64_encode($theCookieStrUnencoded)."\"";
- setcookie(SSO_COOKIE_KEY, $theCookieStrEncoded, time() + (86400 * 7), "/"); // expire in 1 day
- }
- }
-}
-?>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/sso/src/main/php/pear/package.xml
----------------------------------------------------------------------
diff --git a/sso/src/main/php/pear/package.xml b/sso/src/main/php/pear/package.xml
deleted file mode 100644
index fe6abcf..0000000
--- a/sso/src/main/php/pear/package.xml
+++ /dev/null
@@ -1,94 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
- @package Org_Apache_Oodt_Security
- @author Chris A. Mattmann
- @author Andrew F. Hart
- @version $Revision$
--->
-<package version="2.0" xmlns="http://pear.php.net/dtd/package-2.0"
- xmlns:tasks="http://pear.php.net/dtd/tasks-1.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0.xsd
- http://pear.php.net/dtd/package-2.0
- http://pear.php.net/dtd/package-2.0.xsd">
- <name>Apache_OODT_Security</name>
- <channel>pear.apache.org/oodt</channel>
- <summary>OODT Single Sign On Package</summary>
- <description>
- This package provides a PHP library for single sign-on for
- OODT applications which authenticate and authorize against an
- LDAP server.
- </description>
- <lead>
- <name>Andrew Hart</name>
- <user>ahart</user>
- <email>andrew.f.hart@jpl.nasa.gov</email>
- <active>yes</active>
- </lead>
- <date>2013-06-29</date>
- <version>
- <release>0.6.0</release>
- <api>0.6.0</api>
- </version>
- <stability>
- <release>stable</release>
- <api>stable</api>
- </stability>
- <license uri="http://www.apache.org/licenses/LICENSE-2.0.html">Apache Software License 2.0</license>
- <notes>
- This package provides a PHP library for single sign-on for
- OODT applications which authenticate and authorize against an
- LDAP server.
- </notes>
- <contents>
- <dir name="/" baseinstalldir="Org/Apache/Oodt/Security">
- <file name="Config.php" role="php"/>
- <file name="SingleSignOn.php" role="php"/>
- </dir><!-- / -->
- </contents>
- <dependencies>
- <required>
- <php>
- <min>5.1.6</min>
- </php>
- <pearinstaller>
- <min>1.6.1</min>
- </pearinstaller>
- </required>
- </dependencies>
- <phprelease />
- <changelog>
- <release>
- <version>
- <release>0.1.0</release>
- <api>0.1.0</api>
- </version>
- <stability>
- <release>stable</release>
- <api>stable</api>
- </stability>
- <date>2009-03-04</date>
- <license uri="http://oodt.jpl.nasa.gov">OODT License</license>
- <notes>
- This is the initial release of the OODT CAS Security utility as a PEAR package.
- </notes>
- </release>
- </changelog>
-</package>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/vagrant/radix/README.txt
----------------------------------------------------------------------
diff --git a/vagrant/radix/README.txt b/vagrant/radix/README.txt
deleted file mode 100644
index eb2eddf..0000000
--- a/vagrant/radix/README.txt
+++ /dev/null
@@ -1,51 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-##################################################################################
-#
-# README.txt
-#
-# @author riverma@apache.org
-#
-# @description This README describes how to setup, install, and run radix-vagrant.
-# After completing these steps, you will have a fully configured Ubuntu Virtual
-# Machine* running a fresh version of OODT RADiX.
-##################################################################################
-
-
-Requirements:
-1. 5GB of space to install VM on
-2. Vagrant: see http://www.vagrantup.com/
-3. VirtualBox: see https://www.virtualbox.org/wiki/Downloads
-
-Setup:
-1. Modify the contents of vagrant/env.sh to reflect your desired configuration
- - add your project name etc here
- - configure which type of RADiX build you want here (e.g. solr-enabled)
-2. Modify the Vagrantfile VM_NAME to name your VM (VM names must be unique)
-3. vagrant up
-NOTE: The above command will take up to 15 minutes the first time you run it.
-NOTE: All source files will be placed within /usr/local/src within the VM.
-
-Start:
-* NOTE: The provisioning script auto starts OODT, so you may skip to step 2
-1. (optional) Launch OODT if not already running below
- > cd $OODT_HOME/bin
- > ./oodt start
-2. Navigate to: http://localhost:8080/opsui
-
------
-* You can learn more about how to use your newly created virtual machine at:
-http://www.vagrantup.com/
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/vagrant/radix/Vagrantfile
----------------------------------------------------------------------
diff --git a/vagrant/radix/Vagrantfile b/vagrant/radix/Vagrantfile
deleted file mode 100644
index c067295..0000000
--- a/vagrant/radix/Vagrantfile
+++ /dev/null
@@ -1,129 +0,0 @@
-# -*- mode: ruby -*-
-# vi: set ft=ruby :
-
-# Virtual machine name
-VM_NAME = "oodt_radix_vm"
-
-# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
-VAGRANTFILE_API_VERSION = "2"
-
-Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
- # All Vagrant configuration is done here. The most common configuration
- # options are documented and commented below. For a complete reference,
- # please see the online documentation at vagrantup.com.
-
- # Every Vagrant virtual environment requires a box to build off of.
- config.vm.box = "chef/ubuntu-13.10"
-
- config.vm.define VM_NAME do |oodt_radix|
- end
- config.vm.provider :virtualbox do |vb|
- vb.name = VM_NAME
- end
-
- # The url from where the 'config.vm.box' box will be fetched if it
- # doesn't already exist on the user's system.
- # config.vm.box_url = "http://domain.com/path/to/above.box"
-
- # Create a forwarded port mapping which allows access to a specific port
- # within the machine from a port on the host machine. In the example below,
- # accessing "localhost:8080" will access port 80 on the guest machine.
- config.vm.network "forwarded_port", guest: 8080, host: 8080
-
- config.vm.provision :shell, :path => "vagrant/provision.sh", :privileged => false
-
- # Create a private network, which allows host-only access to the machine
- # using a specific IP.
- # config.vm.network "private_network", ip: "192.168.33.10"
-
- # Create a public network, which generally matched to bridged network.
- # Bridged networks make the machine appear as another physical device on
- # your network.
- # config.vm.network "public_network"
-
- # If true, then any SSH connections made will enable agent forwarding.
- # Default value: false
- # config.ssh.forward_agent = true
-
- # Share an additional folder to the guest VM. The first argument is
- # the path on the host to the actual folder. The second argument is
- # the path on the guest to mount the folder. And the optional third
- # argument is a set of non-required options.
- # config.vm.synced_folder "../data", "/vagrant_data"
-
- # Provider-specific configuration so you can fine-tune various
- # backing providers for Vagrant. These expose provider-specific options.
- # Example for VirtualBox:
- #
- # config.vm.provider "virtualbox" do |vb|
- # # Don't boot with headless mode
- # vb.gui = true
- #
- # # Use VBoxManage to customize the VM. For example to change memory:
- # vb.customize ["modifyvm", :id, "--memory", "1024"]
- # end
- #
- # View the documentation for the provider you're using for more
- # information on available options.
-
- # Enable provisioning with Puppet stand alone. Puppet manifests
- # are contained in a directory path relative to this Vagrantfile.
- # You will need to create the manifests directory and a manifest in
- # the file base.pp in the manifests_path directory.
- #
- # An example Puppet manifest to provision the message of the day:
- #
- # # group { "puppet":
- # # ensure => "present",
- # # }
- # #
- # # File { owner => 0, group => 0, mode => 0644 }
- # #
- # # file { '/etc/motd':
- # # content => "Welcome to Apache OODT RADiX! Built by Vagrant.
- # # Managed by Puppet.\n"
- # # }
- #
- # config.vm.provision "puppet" do |puppet|
- # puppet.manifests_path = "manifests"
- # puppet.manifest_file = "site.pp"
- # end
-
- # Enable provisioning with chef solo, specifying a cookbooks path, roles
- # path, and data_bags path (all relative to this Vagrantfile), and adding
- # some recipes and/or roles.
- #
- # config.vm.provision "chef_solo" do |chef|
- # chef.cookbooks_path = "../my-recipes/cookbooks"
- # chef.roles_path = "../my-recipes/roles"
- # chef.data_bags_path = "../my-recipes/data_bags"
- # chef.add_recipe "mysql"
- # chef.add_role "web"
- #
- # # You may also specify custom JSON attributes:
- # chef.json = { :mysql_password => "foo" }
- # end
-
- # Enable provisioning with chef server, specifying the chef server URL,
- # and the path to the validation key (relative to this Vagrantfile).
- #
- # The Opscode Platform uses HTTPS. Substitute your organization for
- # ORGNAME in the URL and validation key.
- #
- # If you have your own Chef Server, use the appropriate URL, which may be
- # HTTP instead of HTTPS depending on your configuration. Also change the
- # validation key to validation.pem.
- #
- # config.vm.provision "chef_client" do |chef|
- # chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME"
- # chef.validation_key_path = "ORGNAME-validator.pem"
- # end
- #
- # If you're using the Opscode platform, your validator client is
- # ORGNAME-validator, replacing ORGNAME with your organization name.
- #
- # If you have your own Chef Server, the default validation client name is
- # chef-validator, unless you changed the configuration.
- #
- # chef.validation_client_name = "ORGNAME-validator"
-end
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/vagrant/radix/vagrant/conf/terminal/bashrc
----------------------------------------------------------------------
diff --git a/vagrant/radix/vagrant/conf/terminal/bashrc b/vagrant/radix/vagrant/conf/terminal/bashrc
deleted file mode 100644
index 8c21864..0000000
--- a/vagrant/radix/vagrant/conf/terminal/bashrc
+++ /dev/null
@@ -1,110 +0,0 @@
-# ~/.bashrc: executed by bash(1) for non-login shells.
-# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
-# for examples
-
-# If not running interactively, don't do anything
-[ -z "$PS1" ] && return
-
-# don't put duplicate lines or lines starting with space in the history.
-# See bash(1) for more options
-HISTCONTROL=ignoreboth
-
-# append to the history file, don't overwrite it
-shopt -s histappend
-
-# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
-HISTSIZE=1000
-HISTFILESIZE=2000
-
-# check the window size after each command and, if necessary,
-# update the values of LINES and COLUMNS.
-shopt -s checkwinsize
-
-# If set, the pattern "**" used in a pathname expansion context will
-# match all files and zero or more directories and subdirectories.
-#shopt -s globstar
-
-# make less more friendly for non-text input files, see lesspipe(1)
-[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
-
-# set variable identifying the chroot you work in (used in the prompt below)
-if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
- debian_chroot=$(cat /etc/debian_chroot)
-fi
-
-# set a fancy prompt (non-color, unless we know we "want" color)
-case "$TERM" in
- xterm-color) color_prompt=yes;;
-esac
-
-# uncomment for a colored prompt, if the terminal has the capability; turned
-# off by default to not distract the user: the focus in a terminal window
-# should be on the output of commands, not on the prompt
-#force_color_prompt=yes
-
-if [ -n "$force_color_prompt" ]; then
- if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
- # We have color support; assume it's compliant with Ecma-48
- # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
- # a case would tend to support setf rather than setaf.)
- color_prompt=yes
- else
- color_prompt=
- fi
-fi
-
-if [ "$color_prompt" = yes ]; then
- PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
-else
- PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
-fi
-unset color_prompt force_color_prompt
-
-# If this is an xterm set the title to user@host:dir
-case "$TERM" in
-xterm*|rxvt*)
- PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
- ;;
-*)
- ;;
-esac
-
-# enable color support of ls and also add handy aliases
-if [ -x /usr/bin/dircolors ]; then
- test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
- alias ls='ls --color=auto'
- #alias dir='dir --color=auto'
- #alias vdir='vdir --color=auto'
-
- alias grep='grep --color=auto'
- alias fgrep='fgrep --color=auto'
- alias egrep='egrep --color=auto'
-fi
-
-# some more ls aliases
-alias ll='ls -alF'
-alias la='ls -A'
-alias l='ls -CF'
-
-# Add an "alert" alias for long running commands. Use like so:
-# sleep 10; alert
-alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
-
-# Alias definitions.
-# You may want to put all your additions into a separate file like
-# ~/.bash_aliases, instead of adding them here directly.
-# See /usr/share/doc/bash-doc/examples in the bash-doc package.
-
-if [ -f ~/.bash_aliases ]; then
- . ~/.bash_aliases
-fi
-
-# enable programmable completion features (you don't need to enable
-# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
-# sources /etc/bash.bashrc).
-if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
- . /etc/bash_completion
-fi
-
-# Export env.sh
-source /vagrant/vagrant/env.sh
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/vagrant/radix/vagrant/env.sh
----------------------------------------------------------------------
diff --git a/vagrant/radix/vagrant/env.sh b/vagrant/radix/vagrant/env.sh
deleted file mode 100644
index 9e2ac28..0000000
--- a/vagrant/radix/vagrant/env.sh
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/bash
-
-# 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.
-
-# CHANGE BELOW FOR YOUR PROJECT NEEDS!
-export PROJECT_GROUP_ID=com.mycompany.mydms
-export PROJECT_ARTIFACT_ID=mycompany-myoodt
-export BUILD_FLAGS=-Pfm-solr-catalog # NOTE: more flag options at http://s.apache.org/CJL
-export OODT_DEPLOYMENT_HOME=/usr/local/oodt
-
-# General configuration (probably don't need to modify)
-export OODT_SRC_REPO=https://svn.apache.org/repos/asf/oodt/trunk # NOTE: This should match the below OODT version
-export OODT_VERSION=0.7-SNAPSHOT
-export JAVA_HOME=/usr/lib/jvm/default-java
-
[16/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableRangedProfileElement.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableRangedProfileElement.java b/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableRangedProfileElement.java
deleted file mode 100644
index b2125f6..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableRangedProfileElement.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile.handlers.lightweight;
-
-import java.util.List;
-import org.apache.oodt.profile.RangedProfileElement;
-
-/**
- * Searchable profile element with a range of valid values.
- *
- * @author Kelly
- * @version $Revision: 1.1.1.1 $
- */
-public class SearchableRangedProfileElement extends RangedProfileElement implements SearchableProfileElement {
- public SearchableRangedProfileElement(SearchableProfile profile, String name, String id, String desc, String type,
- String unit, List synonyms, boolean obligation, int maxOccurrence, String comment, String min, String max) {
- super(profile, name, id, desc, type, unit, synonyms, obligation, maxOccurrence, comment, min, max);
- }
-
- public Result result(String value, String operator) {
- Result rc = FalseResult.INSTANCE;
- double numeric = Double.parseDouble(value);
- if (operator.equals("EQ") || operator.equals("LIKE")) {
- if (Double.parseDouble(min) <= numeric && numeric <= Double.parseDouble(max)) {
- rc = new MatchingResult(this);
- }
- } else if (operator.equals("NE") || operator.equals("NOTLIKE")) {
- if (numeric < Double.parseDouble(min) || numeric > Double.parseDouble(max)) {
- rc = new MatchingResult(this);
- }
- } else if (operator.equals("LT")) {
- if (numeric > Double.parseDouble(min)) {
- rc = new MatchingResult(this);
- }
- } else if (operator.equals("GT")) {
- if (numeric < Double.parseDouble(max)) {
- rc = new MatchingResult(this);
- }
- } else if (operator.equals("LE")) {
- if (numeric >= Double.parseDouble(min)) {
- rc = new MatchingResult(this);
- }
- } else {
- if (numeric <= Double.parseDouble(max)) {
- rc = new MatchingResult(this);
- }
- }
- return rc;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableResourceAttributes.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableResourceAttributes.java b/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableResourceAttributes.java
deleted file mode 100644
index 77786e1..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableResourceAttributes.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile.handlers.lightweight;
-
-import java.util.HashSet;
-import java.util.List;
-import org.apache.oodt.profile.ResourceAttributes;
-import org.w3c.dom.Element;
-
-/**
- * Resource attributes that can be searched.
- *
- * @author Kelly
- * @version $Revision: 1.1.1.1 $
- */
-public class SearchableResourceAttributes extends ResourceAttributes {
- public SearchableResourceAttributes(SearchableProfile profile, Element node) {
- super(profile, node);
- }
-
- /**
- * Produce a search result.
- *
- * @param value Desired value.
- * @param operator What operator to use for comparison.
- * @return a <code>Result</code> value.
- */
- public Result result(String name, String value, String operator) {
- if ("Identifier".equals(name)) {
- return computeResult(identifier, value, operator);
- } else if ("Title".equals(name)) {
- return computeResult(title, value, operator);
- } else if ("Format".equals(name)) {
- return computeResult(formats, value, operator);
- } else if ("Description".equals(name)) {
- return computeResult(description, value, operator);
- } else if ("Creator".equals(name)) {
- return computeResult(creators, value, operator);
- } else if ("Subject".equals(name)) {
- return computeResult(subjects, value, operator);
- } else if ("Publisher".equals(name)) {
- return computeResult(publishers, value, operator);
- } else if ("Contributor".equals(name)) {
- return computeResult(contributors, value, operator);
- } else if ("Date".equals(name)) {
- return computeResult(dates, value, operator);
- } else if ("Type".equals(name)) {
- return computeResult(types, value, operator);
- } else if ("Source".equals(name)) {
- return computeResult(sources, value, operator);
- } else if ("Language".equals(name)) {
- return computeResult(languages, value, operator);
- } else if ("Relation".equals(name)) {
- return computeResult(relations, value, operator);
- } else if ("Coverage".equals(name)) {
- return computeResult(coverages, value, operator);
- } else if ("Rights".equals(name)) {
- return computeResult(rights, value, operator);
- } else if ("resContext".equals(name)) {
- return computeResult(contexts, value, operator);
- } else if ("resClass".equals(name)) {
- return computeResult(clazz, value, operator);
- } else if ("resLocation".equals(name)) {
- return computeResult(locations, value, operator);
- } else {
- throw new IllegalArgumentException("Unknown attribute \"" + name + "\"");
- }
- }
-
- private Result computeResult(String a, String b, String op) {
- int c = a.compareTo(b);
- boolean t;
- if ("EQ".equals(op) || "LIKE".equals(op)) {
- t = c == 0;
- } else if ("GE".equals(op)) {
- t = c >= 0;
- } else if ("GT".equals(op)) {
- t = c > 0;
- } else if ("LE".equals(op)) {
- t = c <= 0;
- } else if ("LT".equals(op)) {
- t = c < 0;
- } else if ("NE".equals(op) || "NOTLIKE".equals(op)) {
- t = c != 0;
- } else {
- throw new IllegalArgumentException("Unknown relational operator \"" + op + "\"");
- }
- if (t) {
- return new MatchingResult(new HashSet(profile.getProfileElements().values()));
- } else {
- return FalseResult.INSTANCE;
- }
- }
-
- private Result computeResult(List a, String b, String op) {
- if (a == null || a.isEmpty()) {
- return FalseResult.INSTANCE;
- }
-
- Result f = FalseResult.INSTANCE;
- Result t = new MatchingResult(new HashSet(profile.getProfileElements().values()));
- Result rc = f;
- if ("EQ".equals(op) || "LIKE".equals(op)) {
- if (a.contains(b)) {
- rc = t;
- } else if ("NE".equals(op) || "NOTLIKE".equals(op)) {
- if (!a.contains(b)) {
- rc = t;
- } else if ("LT".equals(op) || "GT".equals(op) || "LE".equals(op) || "GE".equals(op)) {
- for (Object anA : a) {
- String value = (String) anA;
- rc = computeResult(value, b, op);
- if (rc != f) {
- break;
- }
- }
- } else {
- throw new IllegalArgumentException("Unknown relational operator \"" + op + "\"");
- }
- }
- }
- return rc;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableUnspecifiedProfileElement.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableUnspecifiedProfileElement.java b/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableUnspecifiedProfileElement.java
deleted file mode 100644
index f480877..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableUnspecifiedProfileElement.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile.handlers.lightweight;
-
-import java.util.List;
-import org.apache.oodt.profile.UnspecifiedProfileElement;
-
-/**
- * Searchable profile element with unspecified values.
- *
- * @author Kelly
- * @version $Revision: 1.1.1.1 $
- */
-public class SearchableUnspecifiedProfileElement extends UnspecifiedProfileElement implements SearchableProfileElement {
- public SearchableUnspecifiedProfileElement(SearchableProfile profile, String name, String id, String desc, String type,
- String unit, List synonyms, boolean obligation, int maxOccurrence, String comment) {
- super(profile, name, id, desc, type, unit, synonyms, obligation, maxOccurrence, comment);
- }
-
- public Result result(String value, String operator) {
- return new MatchingResult(this);
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/Union.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/Union.java b/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/Union.java
deleted file mode 100644
index 003670a..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/Union.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile.handlers.lightweight;
-
-import java.util.Set;
-import org.apache.oodt.profile.ProfileElement;
-
-/**
- * A union of matching elements.
- *
- * @author Kelly
- */
-class Union implements Result {
- /**
- * Construct a union.
- *
- * @param lhs Left-hand side
- * @param rhs Right-hand side.
- */
- public Union(Result lhs, Result rhs) {
- this.lhs = lhs;
- this.rhs = rhs;
- }
-
- public Set matchingElements() {
- Set union = ProfileElement.profiles(lhs.matchingElements());
- union.addAll(ProfileElement.profiles(rhs.matchingElements()));
- Set rc = ProfileElement.elements(union, lhs.matchingElements());
- rc.addAll(ProfileElement.elements(union, rhs.matchingElements()));
- return rc;
- }
-
- public String toString() {
- return "union[" + lhs + "," + rhs + "]";
- }
-
- /** Left-hand side of the result. */
- private Result lhs;
-
- /** Right-hand side of the result. */
- private Result rhs;
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/WhereExpression.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/WhereExpression.java b/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/WhereExpression.java
deleted file mode 100644
index cf488a6..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/WhereExpression.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile.handlers.lightweight;
-
-import java.util.Map;
-
-/**
- * A where-expression.
- *
- * @author Kelly
- */
-interface WhereExpression {
- /**
- * Compute the result tree of this where expression based on the map of profile elements.
- *
- * @param resAttr Resource attributes to check.
- * @param elements Map from {@link String} element name to {@link ProfileElement}.
- * @return A result tree that when evaluated yields matching {@link ProfileElement}s.
- */
- Result result(SearchableResourceAttributes resAttr, Map elements);
-
- /**
- * Return a simplified version of this expression.
- *
- * Our result generation can't handle "NOT" expressions (like "not (blah < 3)")
- * since we can't do set inversion, so we simplify the expression by removing all
- * "NOT" nodes.
- *
- * @return An equivalent expression without negative nodes.
- */
- WhereExpression simplify();
-
- /**
- * Negate this expression.
- *
- * @return The negation of this expression.
- */
- WhereExpression negate();
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/package.html
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/package.html b/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/package.html
deleted file mode 100644
index 56d73cd..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/package.html
+++ /dev/null
@@ -1,32 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<!--
-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.
--->
-<html>
- <head>
- <title>Lightweight Profile Handler.
- </title>
- </head>
- <body>
- <p>Lightweight profile handler. The lightweight profile handler
- is lightweight because it doesn't rely on any external
- search/retrieval mechanism. It's 100% pure Java, baby.
- </p>
- <p>To use this handler, create an XML file that contains the
- profiles you want to serve. Set the system property
- <code>profiles.url</code>
- to the location of that file. Fire 'er up.
- </p>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/site/resources/examples/src.jar
----------------------------------------------------------------------
diff --git a/profile/src/site/resources/examples/src.jar b/profile/src/site/resources/examples/src.jar
deleted file mode 100644
index 3edbb96..0000000
Binary files a/profile/src/site/resources/examples/src.jar and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/site/resources/images/class.png
----------------------------------------------------------------------
diff --git a/profile/src/site/resources/images/class.png b/profile/src/site/resources/images/class.png
deleted file mode 100644
index d8a7ab4..0000000
Binary files a/profile/src/site/resources/images/class.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/site/resources/images/class.psd
----------------------------------------------------------------------
diff --git a/profile/src/site/resources/images/class.psd b/profile/src/site/resources/images/class.psd
deleted file mode 100644
index 3a20fd4..0000000
Binary files a/profile/src/site/resources/images/class.psd and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/site/resources/images/delegation.png
----------------------------------------------------------------------
diff --git a/profile/src/site/resources/images/delegation.png b/profile/src/site/resources/images/delegation.png
deleted file mode 100644
index fd8d5cf..0000000
Binary files a/profile/src/site/resources/images/delegation.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/site/resources/images/delegation.psd
----------------------------------------------------------------------
diff --git a/profile/src/site/resources/images/delegation.psd b/profile/src/site/resources/images/delegation.psd
deleted file mode 100644
index 02a2fd9..0000000
Binary files a/profile/src/site/resources/images/delegation.psd and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/site/resources/images/grid-profile.jpg
----------------------------------------------------------------------
diff --git a/profile/src/site/resources/images/grid-profile.jpg b/profile/src/site/resources/images/grid-profile.jpg
deleted file mode 100644
index de71567..0000000
Binary files a/profile/src/site/resources/images/grid-profile.jpg and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/site/resources/images/stack.png
----------------------------------------------------------------------
diff --git a/profile/src/site/resources/images/stack.png b/profile/src/site/resources/images/stack.png
deleted file mode 100644
index 10856a5..0000000
Binary files a/profile/src/site/resources/images/stack.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/site/resources/images/stack.psd
----------------------------------------------------------------------
diff --git a/profile/src/site/resources/images/stack.psd b/profile/src/site/resources/images/stack.psd
deleted file mode 100644
index 6d23e2d..0000000
Binary files a/profile/src/site/resources/images/stack.psd and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/site/resources/images/tree.png
----------------------------------------------------------------------
diff --git a/profile/src/site/resources/images/tree.png b/profile/src/site/resources/images/tree.png
deleted file mode 100644
index 52cf31f..0000000
Binary files a/profile/src/site/resources/images/tree.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/site/resources/images/tree.psd
----------------------------------------------------------------------
diff --git a/profile/src/site/resources/images/tree.psd b/profile/src/site/resources/images/tree.psd
deleted file mode 100644
index b51ce99..0000000
Binary files a/profile/src/site/resources/images/tree.psd and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/site/site.xml
----------------------------------------------------------------------
diff --git a/profile/src/site/site.xml b/profile/src/site/site.xml
deleted file mode 100644
index 3cfecdf..0000000
--- a/profile/src/site/site.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more contributor
-license agreements. See the NOTICE.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 name="Profile Service">
-
- <body>
- <links>
- <item name="OODT" href="../oodt-site/"/>
- <item name="Grid" href="../grid/"/>
- </links>
-
- <menu ref="reports" inherit="bottom"/>
- <menu name="User's Guide">
- <item name="Information Captured" href="info/"/>
- <item name="Querying Profiles" href="querying/"/>
- <item name="Profile Repr." href="rep/"/>
- <item name="Basic Handler" href="handler/"/>
- <item name="Advanced Handler" href="adv/"/>
- </menu>
-
- </body>
-</project>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/site/xdoc/adv/index.xml
----------------------------------------------------------------------
diff --git a/profile/src/site/xdoc/adv/index.xml b/profile/src/site/xdoc/adv/index.xml
deleted file mode 100755
index 3c8b913..0000000
--- a/profile/src/site/xdoc/adv/index.xml
+++ /dev/null
@@ -1,1072 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more contributor
-license agreements. See the NOTICE.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.
--->
-<document>
- <properties>
- <title>Developing a Real Profile Handler</title>
- <author email="Sean.Kelly@jpl.nasa.gov">Sean Kelly</author>
- </properties>
- <!-- Wizzy Noise - Haiku -->
- <body>
- <section name="Developing a Real Profile Handler">
- <p>In the <a href="../handler/">basic profile handler
- tutorial</a>, we developed a profile handler that answered
- every query with a list of exactly zero profile objects. It
- also responded to requests to retrieve a profile by a
- specific ID with <code>null</code>, meaning "not found by
- this handler." Useful, huh? Not really.
- </p>
-
- <p>But it did get our profile server ready for <em>this</em>
- tutorial, where we'll write a <em>real</em> profile handler
- that analyzes incoming queries, consults a local "database",
- constructs a set of matching profile results, and responds to
- requests to profiles by ID. Get some fresh coffee, because
- this is going to be a tough one.
- </p>
-
- <p>And yes, you'll need to have gone through <em>all</em> of the
- following before proceeding:
- </p>
-
- <ul>
- <li><a href="../info/">Information Captured in a Profile</a></li>
- <li><a href="../querying/">Querying Profiles</a></li>
- <li><a href="../rep">Profile Representation</a></li>
- <li><a href="../handler">Developing a Profile Handler</a></li>
- </ul>
- </section>
-
- <section name="The Music Database">
- <p>Let's say you've got an OODT <a href="/grid-product/">product
- server</a> already running that serves up your favorite
- music files. All you have to do is pass in the URI to a
- track and it spits back the MP3 data which can run into your
- favorite media player. You've set it up so your URIs are
- all unique for each track, and you just have to pass in an
- unparsed XMLQuery like <code>urn:sk:tr5B7E.mp3</code> and
- you get the matching data.
- </p>
-
- <p>But since you're not in the habit of memorizing hexadecimal
- numbers inside of URIs, let's write a profile server who's job
- it is to take queries for specific artists, genres, albums,
- ratings, track titles, and so forth, and spit out the matching
- profiles. The profiles have a places for a URI (in the
- <code>Identifier</code> field) that you can then pass to the
- hypothetical product server to get the track data. (In fact,
- this is a common OODT pattern: profile query to do resource
- location, product query to do resource retrieval.) While
- you're listening to the track, you can read all sorts of other
- juicy metadata about it by examining the returned profile.
- </p>
-
- <subsection name="The Metadata">
- <p>For this demonstration, we'll just focus on three kinds of
- metadata instead of going all-out, <a
- href="http://www.apple.com/itunes/">iTunes</a> style:
- </p>
-
- <ul>
- <li>Artist name</li>
- <li>Album name</li>
- <li>Track name</li>
- </ul>
-
- <p>Each profile will describe a single track. The resource
- attributes will have:
- </p>
-
- <ul>
- <li>The URI of the track as the <code>Identifier</code>.</li>
- <li>The name of the track as the <code>Title</code>.</li>
- <li>The name of the artist as the <code>Creator</code>.</li>
- </ul>
-
- <p>In addition, we'll put in two profile elements:</p>
-
- <ul>
- <li>The name of the album as an
- <code>EnumeratedProfileElement</code>.
- </li>
- <li>The name of the artist as an
- <code>EnumeratedProfileElement</code>. Yes, this is
- redundant with the artist named as the <code>Creator</code>
- in the resource attributes; but one profile element by
- itself would get too lonely!</li>
- </ul>
- </subsection>
-
- <subsection name="Query Style">
- <p>Both product handlers and profile handlers get to choose
- whether they want unparsed query expressions in their
- XMLQuery objects or if they want parsed query expressions.
- Parsed query expressions generate the "where" boolean stack.
- While the product server that this profile server is meant
- to work with wants unparsed ones, we'll use parsed
- expressions for this profile handler. Why? Well, having a
- well-defined query language and a way to operate on it will
- save a little trouble from us having to generate a parser.
- </p>
-
- <p>The queries will use element names <code>artist</code>,
- <code>album</code>, and <code>track</code> only, to match
- what we'll save in our music database. Here are a couple example queries:
- </p>
-
- <source>artist = Beatles AND album = Revolver
-track = 'Blue Suede Shoes'</source>
- </subsection>
- </section>
-
- <section name="Developing the Handler">
- <p>We'll develop the handler in parts, so we can discuss each
- section, and then show the entire source file.
- </p>
-
- <subsection name='Making the "Database"'>
- <p>Our music database will be nothing more than Java objects
- kept in memory. We'll create separate objects of three
- classes:
- </p>
-
- <ul>
- <li><code>Artist</code>. <code>Artist</code> objects represent
- people or groups who create music. <code>Artist</code>s
- will have zero or more <code>Track</code>s.
- </li>
- <li><code>Album</code>. <code>Album</code> objects are
- collections of <code>Track</code>s.
- </li>
- <li><code>Track</code>. <code>Track</code> objects appear
- on one <code>Album</code> and are made by one
- <code>Artist</code>. They have the URN necessary to pass
- to the hypothetical music product server in order to
- actually play music.
- </li>
- </ul>
-
- <p>A better music model would probably separate out artists
- and composers, account for remixes, compilation albums,
- re-issues, multiple renditions, and so forth, but this is
- government work, and it'll do.
- </p>
-
- <p>Here's class <code>Artist</code>:</p>
-
- <source>class Artist {
- public Artist(String name) {
- this.name = name;
- tracks = new ArrayList();
- }
- public String getName() {
- return name;
- }
- public List getTracks() {
- return tracks;
- }
- public int hashCode() {
- return name.hashCode();
- }
- public boolean equals(Object obj) {
- if (obj == this) return true;
- if (!(obj instanceof Artist)) return false;
- Artist rhs = (Artist) obj;
- return name.equals(rhs.name);
- }
- private String name;
- private List tracks;
-}</source>
-
- <p>As you can see, <code>Artist</code>s have a name and a
- <code>List</code> of <code>Track</code>s they've made. Now,
- here's class <code>Album</code>:
- </p>
-
- <source>class Album {
- public Album(String name) {
- this.name = name;
- tracks = new ArrayList();
- }
- public String getName() {
- return name;
- }
- public List getTracks() {
- return tracks;
- }
- public int hashCode() {
- return name.hashCode();
- }
- public boolean equals(Object obj) {
- if (obj == this) return true;
- if (!(obj instanceof Album)) return false;
- Album rhs = (Album) obj;
- return name.equals(rhs.name);
- }
- private String name;
- private List tracks;
-}</source>
-
- <p>As with <code>Artist</code>s, <code>Album</code>s (or
- should that be <em>Alba</em>?) have names and collections of
- <code>Track</code>s. Finally, here's class <code>Track</code>:
- </p>
-
- <source>class Track {
- public Track(String name, URI id, Artist artist,
- Album album) {
- this.name = name;
- this.id = id;
- this.artist = artist;
- this.album = album;
- artist.getTracks().add(this);
- album.getTracks().add(this);
- }
- public String getName() { return name; }
- public URI getID() { return id; }
- public Artist getArtist() { return artist; }
- public Album getAlbum() { return album; }
- public int hashCode() {
- return name.hashCode() ^ id.hashCode();
- }
- public boolean equals(Object obj) {
- if (obj == this) return true;
- if (!(obj instanceof Track)) return false;
- Track rhs = (Track) obj;
- return id.equals(rhs.id);
- }
- private String name;
- private URI id;
- private Artist artist;
- private Album album;
-}</source>
-
- <p>As you can see from the code, a track belongs to an
- <code>Artist</code> and to an <code>Album</code> and has a
- URI which you can use to get to the track's MP3 data.
- Finally, with these three "entity" classes in hand, we can
- create a music database:
- </p>
-
- <source>class DB {
- public static Set ARTISTS = new HashSet();
- public static Set ALBUMS = new HashSet();
- public static Set TRACKS = new HashSet();
- static {
- Artist bach = new Artist("Bach");
- Album brandenburg123
- = new Album("Brandenburg Concerti 1, 2, 3");
- Album brandenburg456
- = new Album("Brandenburg Concerti 4, 5, 6");
- Track brandenburg1
- = new Track("Brandenburg Concerto #1",
- URI.create("urn:sk:tr91BC.mp3"), bach,
- brandenburg123);
- Track brandenburg2
- = new Track("Brandenburg Concerto #2",
- URI.create("urn:sk:tr311E.mp3"), bach,
- brandenburg123);
- Track brandenburg3
- = new Track("Brandenburg Concerto #3",
- URI.create("urn:sk:trA981.mp3"), bach,
- brandenburg123);
- Track brandenburg4
- = new Track("Brandenburg Concerto #4",
- URI.create("urn:sk:tr233A.mp3"), bach,
- brandenburg456);
- Track brandenburg5
- = new Track("Brandenburg Concerto #5",
- URI.create("urn:sk:trA6E5.mp3"), bach,
- brandenburg456);
-
- Track brandenburg6
- = new Track("Brandenburg Concerto #6",
- URI.create("urn:sk:tr01E9.mp3"), bach,
- brandenburg456);
-
- Artist delerium = new Artist("Delerium");
- Album semantic = new Album("Semantic Spaces");
- Album poem = new Album("Poem");
- Track flowers
- = new Track("Flowers Become Screens",
- URI.create("urn:sk:tr3A5E.mp3"), delerium,
- semantic);
- Track metaphor = new Track("Metaphor",
- URI.create("urn:sk:tr0E13.mp3"), delerium,
- semantic);
- Track innocente = new Track("Innocente",
- URI.create("urn:sk:tr004A.mp3"), delerium,
- poem);
- Track aria = new Track("Aria",
- URI.create("urn:sk:tr004A.mp3"), delerium,
- poem);
-
- ARTISTS.add(bach);
- ARTISTS.add(delerium);
- ALBUMS.add(brandenburg123);
- ALBUMS.add(brandenburg456);
- ALBUMS.add(semantic);
- ALBUMS.add(poem);
- TRACKS.add(brandenburg1);
- TRACKS.add(brandenburg2);
- TRACKS.add(brandenburg3);
- TRACKS.add(brandenburg4);
- TRACKS.add(brandenburg5);
- TRACKS.add(brandenburg6);
- TRACKS.add(flowers);
- TRACKS.add(metaphor);
- TRACKS.add(innocente);
- TRACKS.add(aria);
- }
-}</source>
-
- <p>(Please don't judge this limited collection as the breadth
- of my listening tastes. It's actually much narrower now!)
- In this small database, we've got two artists, Bach and
- Delerium, with four albums: <i>Brandenburg Concerti 1, 2,
- 3</i> and <i>4, 5, 6</i>; and <i>Semantic Spaces</i> and
- <i>Poem</i>. And we've got 10 tracks: 3 belonging to one
- album, 3 belonging to another, 2 belonging to yet another,
- and the last 2 belonging to the last album. Six are by
- Bach, and four by Delerium. Each track has
- </p>
- </subsection>
-
- <subsection name="Querying our Database">
- <p>Recall that the <a href="/edm-query/">XMLQuery</a>'s query
- language uses triples of the form (element, relation,
- literal) like <code>album != Poem</code>. The relations
- include =, !=, <, >, <=, >=, LIKE, and NOTLIKE.
- The triples are linked with AND, OR, and NOT. For this
- tutorial, we'll do the = and != cases. The rest you can
- fill in for your own edification. Our approach will be to
- examine the postfix "where" boolean stack and convert it
- into an infix boolean expression tree. We'll ask the tree
- to evaluate itself into a matching set of
- <code>Track</code>s. Then all we have to do is descibe the
- matching <code>Track</code>s as <code>Profile</code>
- objects.
- </p>
-
- <p>Let's start by defining a node in our expression tree:</p>
-
- <source>interface Expr {
- Set evaluate();
-}</source>
-
- <p>The <code>evaluate</code> method means "evaluate into a
- <code>Set</code> of matching <code>Track</code> objects."
- With this interface, we can then define classes that make up
- different flavors of tree nodes. One of the easier ones is
- a constant tree node that either matches <em>every</em>
- track available (constant true) or <em>none</em> of them
- (constant false):
- </p>
-
- <source>class Constant implements Expr {
- public Constant(boolean value) {
- this.value = value;
- }
- public Set evaluate() {
- return value? DB.TRACKS
- : Collections.EMPTY_SET;
- }
- private boolean value;
-}</source>
-
- <p>Next, let's do negation. This takes the set complement of
- an existing tree node:
- </p>
-
- <source>class Not implements Expr {
- public Not(Expr expr) {
- this.expr = expr;
- }
- public Set evaluate() {
- Set matches = expr.evaluate();
- Set inverse = new HashSet();
- for (Iterator i = DB.TRACKS.iterator();
- i.hasNext();) {
- Track t = (Track) i.next();
- if (!matches.contains(t))
- inverse.add(t);
- }
- return inverse;
- }
- private Expr expr;
-}</source>
-
- <p>As you can see, this node is constructed with another tree
- node expression. To evaluate this node, we evaluate the
- expression passed in. Then we take its inverse by iterating
- through each track in the database and adding it to the
- matching set if it <em>doesn't</em> occur in the
- expression's matching set.
- </p>
-
- <p>The union tree node takes two expressions and adds the two
- sets of matching tracks together:
- </p>
-
- <source>class Or implements Expr {
- public Or(Expr lhs, Expr rhs) {
- this.lhs = lhs;
- this.rhs = rhs;
- }
- public Set evaluate() {
- Set left = lhs.evaluate();
- Set right = rhs.evaluate();
- left.addAll(right);
- return left;
- }
- private Expr lhs;
- private Expr rhs;
-}</source>
-
- <p>The intersection tree node evaluates to <code>Track</code>s
- that occur only in both expressions' tracks:
- </p>
-
- <source>class And implements Expr {
- public And(Expr lhs, Expr rhs) {
- this.lhs = lhs;
- this.rhs = rhs;
- }
- public Set evaluate() {
- Set left = lhs.evaluate();
- Set right = rhs.evaluate();
- left.retainAll(right);
- return left;
- }
- private Expr lhs;
- private Expr rhs;
-}</source>
-
- <p>With these nodes, we can cover the logical operators AND,
- OR, and NOT that appear in a postfix "where" stack, as well
- as an empty "where" stack, which, by convention, is meant to
- be a constant "true", matching all available resources. Now
- we just have to handle triples (element, relation, literal).
- First up, comparisons against <code>Artist</code>s:
- </p>
-
- <source>class ArtistExpr implements Expr {
- public ArtistExpr(String op, String value) {
- this.op = op;
- this.value = value;
- }
- public Set evaluate() {
- Set tracks = new HashSet();
- if ("EQ".equals(op)) {
- for (Iterator i = DB.ARTISTS.iterator();
- i.hasNext();) {
- Artist a = (Artist) i.next();
- if (a.getName().equals(value))
- tracks.addAll(a.getTracks());
- }
- } else if ("NE".equals(op)) {
- for (Iterator i = DB.ARTISTS.iterator();
- i.hasNext();) {
- Artist a = (Artist) i.next();
- if (!a.getName().equals(value))
- tracks.addAll(a.getTracks());
- }
- } else throw new
- UnsupportedOperationException("NYI");
- return tracks;
- }
- private String op;
- private String value;
-}</source>
-
- <p>For an expression like <code>artist = Bach</code> or
- <code>artist != Delerium</code> we use a expression node
- object of the above class. When it's <code>EQ</code>, we
- iterate through all the artists in the database and, when
- the artist's name matches, add all of that artist's tracks
- to the set of matches. When it's <code>NE</code>, we
- instead add all of the artists' tracks whose name
- <em>doesn't</em> match. (The other relational operators,
- <code>LT</code>, <code>GT</code>, <code>LE</code>,
- <code>GE</code>, <code>LIKE</code>, and <code>NOTLIKE</code>
- currently throw an exception. You're welcome to try to
- implement those.)
- </p>
-
- <p>The <code>AlbumExpr</code> expression node is quite similar:</p>
-
- <source>class AlbumExpr implements Expr {
- public AlbumExpr(String op, String value) {
- this.op = op;
- this.value = value;
- }
- public Set evaluate() {
- Set tracks = new HashSet();
- if ("EQ".equals(op)) {
- for (Iterator i = DB.ALBUMS.iterator();
- i.hasNext();) {
- Album a = (Album) i.next();
- if (a.getName().equals(value))
- tracks.addAll(a.getTracks());
- }
- } else if ("NE".equals(op)) {
- for (Iterator i = DB.ALBUMS.iterator();
- i.hasNext();) {
- Album a = (Album) i.next();
- if (!a.getName().equals(value))
- tracks.addAll(a.getTracks());
- }
- } else throw new
- UnsupportedOperationException("NYI");
- return tracks;
- }
- private String op;
- private String value;
-}</source>
-
- <p>(Another exercise for the reader: refactor out common code
- between these two classes.) Finally, the
- <code>TrackExpr</code> node is for expressions like
- <code>track = Poem</code>:
- </p>
-
- <source>class TrackExpr implements Expr {
- public TrackExpr(String op, String value) {
- this.op = op;
- this.value = value;
- }
- public Set evaluate() {
- Set tracks = new HashSet();
- if ("EQ".equals(op)) {
- for (Iterator i = DB.TRACKS.iterator();
- i.hasNext();) {
- Track t = (Track) i.next();
- if (t.getName().equals(value))
- tracks.add(t);
- }
- } else if ("NE".equals(op)) {
- for (Iterator i = DB.TRACKS.iterator();
- i.hasNext();) {
- Track t = (Track) i.next();
- if (!t.getName().equals(value))
- tracks.add(t);
- }
- } else throw new
- UnsupportedOperationException("NYI");
- return tracks;
- }
- private String op;
- private String value;
-}</source>
-
- <p>For <code>EQ</code>, we just iterate through every track in
- the database and add it to the set of matching tracks if the
- names match the name passed into the user's query. For
- <code>NE</code>, we add them if their names <em>don't</em> match.
- </p>
-
- <p>That completes all the code for the expression tree. Now
- we can start working on the class that implements the
- <code>ProfileHandler</code> interface,
- <code>MusicHandler</code>. Here, we'll build that
- expression tree with the incoming <code>XMLQuery</code>,
- which provides its "where" element stack as a postfix
- boolean expression. Here's the approach:
- </p>
-
- <ol>
- <li>Make a new, empty stack.</li>
- <li>For each element in the "where" stack:
- <ol>
- <li>If it's an element name (<code>artist</code>,
- <code>album</code>, <code>track</code>), push the name
- onto the stack.
- </li>
- <li>If it's a literal value (<code>Bach</code>,
- <code>Poem</code>, etc.), push it onto the stack.
- </li>
- <li>If it's a relational operator (<code>EQ</code>, <code>NE</code>, etc.):
- <ol>
- <li>Pop two values off.</li>
- <li>Push an <code>ArtistExpr</code>, <code>AlbumExpr</code>, or <code>TrackExpr</code>.</li>
- </ol>
- </li>
- <li>It it's a logical operator:
- <ul>
- <li>For <code>AND</code>, pop two values off and push an <code>And</code> node.</li>
- <li>For <code>OR</code>, pop two values off and push an <code>Or</code> node.</li>
- <li>For <code>NOT</code>, pop one value off and push a <code>Not</code> node.</li>
- </ul>
- </li>
- </ol>
- </li>
- </ol>
- <p>In the end, there will be one element left on the stack, an
- <code>Expr</code> node representing the root of the
- expression tree. Here's the method of
- <code>MusicHandler</code> that implements the algorithm:
- </p>
-
- <source>private static Expr transform(XMLQuery q) {
- Stack stack = new Stack();
- for (Iterator i = q.getWhereElementSet()
- .iterator(); i.hasNext();) {
- QueryElement e = (QueryElement) i.next();
- String keyword = e.getValue();
- String type = e.getRole();
- if ("elemName".equals(type))
- stack.push(keyword);
- else if ("LITERAL".equals(type))
- stack.push(keyword);
- else if ("RELOP".equals(type))
- addRelational(keyword, (String)stack.pop(),
- (String)stack.pop(), stack);
- else if ("LOGOP".equals(type))
- addLogical(keyword, stack);
- else throw new
- IllegalArgumentException("Unknown query "
- + type + " type");
- }
- if (stack.size() == 0)
- return new Constant(true);
- else if (stack.size() > 1)
- throw new IllegalArgumentException("Unbalanced"
- + " query");
- else return (Expr) stack.pop();
-}</source>
-
- <p>For relational and logical operators, this method defers to
- two other utility methods, which we'll see shortly. After
- iterating through the entire "where" set, we check to see if
- there's an empty stack. That's the case where the user
- passes in an empty expression, which by convention we'll
- take to mean they want everything. Otherwise, there should
- be just one <code>Expr</code> node on the stack, the root of
- the expression tree.
- </p>
-
- <p>To handle adding a <code>RELOP</code>, we pop two values
- off, the element name (<code>artist</code>,
- <code>album</code>, or <code>track</code>), and the literal
- value the user wants (<code>Bach</code>, <code>Poem</code>,
- etc.), along with the operator and the stack:
- </p>
-
- <source>private static void addRelational(String op,
- String value, String kind, Stack stack) {
- if ("artist".equals(kind))
- stack.push(new ArtistExpr(op, value));
- else if ("album".equals(kind))
- stack.push(new AlbumExpr(op, value));
- else if ("track".equals(kind))
- stack.push(new TrackExpr(op, value));
- else throw new
- IllegalArgumentException("Unknown profile"
- + " element " + kind);
-}</source>
-
- <p>This method then replaces the popped off values with the
- matching <code>Expr</code> class for artists, albums, or
- tracks.
- </p>
-
- <p>To handle adding a <code>LOGOP</code>, we pass the logical
- operator and the entire stack to this method:
- </p>
-
- <source>private static void addLogical(String op,
- Stack stack) {
- if ("AND".equals(op))
- stack.push(new And((Expr)stack.pop(),
- (Expr) stack.pop()));
- else if ("OR".equals(op))
- stack.push(new Or((Expr)stack.pop(),
- (Expr) stack.pop()));
- else if ("NOT".equals(op))
- stack.push(new Not((Expr)stack.pop()));
- else throw new
- IllegalArgumentException("Illegal operator "
- + op);
-}</source>
-
- <p>With all this code in place we can generate the expression
- tree. Let's look at an example. Suppose when constructing the
- <code>XMLQuery</code>, the user passed in</p>
-
- <source>artist = Bach and not album = Poem or track != Aria</source>
-
- <p>The XMLQuery query language generates a postfix stack of
- <code>QueryElement</code> objects in the "where" list:
- </p>
-
- <img src="../images/stack.png" alt="Stack" />
-
- <p>And we then create this tree:</p>
-
- <img src="../images/tree.png" alt="Tree" />
-
- <p>Calling the root's <code>evaluate</code> method then yields
- a <code>java.util.Set</code> of <code>Track</code> objects
- that match that expression.
- </p>
-
- <p>OK, we've got a set of <code>Track</code>s. But what we
- want are a set of <em><code>Profile</code>s</em>. The next
- step is to describe those tracks using the profile metadata
- model.
- </p>
- </subsection>
-
- <subsection name="Describing Tracks">
- <p>Query handlers serve up <code>List</code>s of
- <code>Profile</code> objects, where <code>Profile</code>s
- contain metadata descriptions of resources. For this
- tutorial, the resources we're describing are music tracks,
- represented by instances of <code>Track</code> objects.
- When the handler's <code>findProfiles</code> and
- <code>get</code> methods are called by the OODT framework to
- service a request, all we have to do is find the matching
- <code>Track</code> (or <code>Track</code>s) and create
- matching <code>Profile</code>s.
- </p>
-
- <p>Recall that we're setting up the resource attributes of the
- profile so that
- </p>
- <ul>
- <li>The URI of the track appears in the <code>Identifier</code>.</li>
- <li>The name of the track appears in the <code>Title</code>.</li>
- <li>The name of the artist appears the <code>Creator</code>.</li>
- </ul>
-
- <p>In addition, we'll put in two profile elements:</p>
-
- <ul>
- <li>The name of the album as an
- <code>EnumeratedProfileElement</code>.
- </li>
- <li>The name of the artist redundantly as an
- <code>EnumeratedProfileElement</code>.
- </li>
- </ul>
-
- <p>Now, let's create a utility method <code>describe</code>
- which takes a <code>java.util.Set</code> of matching
- <code>Track</code>s and yields a <code>java.util.List</code>
- of corresponding <code>Profile</code>s:
- </p>
-
- <source>private static List describe(Set tracks) {
- List profiles = new ArrayList();
- for (Iterator i = tracks.iterator();
- i.hasNext();) {
- Track t = (Track) i.next();
- String id = t.getID().toString();
- String trackName = t.getName();
- String albumName = t.getAlbum().getName();
- String artistName = t.getArtist().getName();
- Profile p = createProfile(id, trackName,
- albumName, artistName);
- profiles.add(p);
- }
- return profiles;
-}</source>
-
- <p>We build a list of <code>Profile</code>s by calling another
- method, <code>createProfile</code>. It takes the track's
- URI, its name, the name of the album on which it appears,
- and the name of the artist who created it, and yields a
- <code>Profile</code>:
- </p>
-
- <source>private static Profile createProfile(String id,
- String trackName, String albumName,
- String artistName) {
- Profile p = new Profile();
- ProfileAttributes pa=new ProfileAttributes(id,
- "1.0", "profile", "active", "unclassified",
- /*parent*/null, /*children*/EL,
- "1.3.6.1.4.1.7655", /*revNotes*/EL);
- p.setProfileAttributes(pa);
- ResourceAttributes ra=new ResourceAttributes(p,
- id, trackName,
- Collections.singletonList("audio/mpeg"),
- /*desc*/null,
- Collections.singletonList(artistName),
- /*subjects*/EL, /*pubs*/EL, /*contrib*/EL,
- /*dates*/EL, /*types*/EL, /*sources*/EL,
- /*langs*/EL, /*relations*/EL, /*covs*/EL,
- /*rights*/EL,
- Collections.singletonList("SK.Music"),
- "granule", "system.productServer",
- Collections.singletonList("urn:eda:rmi:"
- + "MyProductServer"));
- p.setResourceAttributes(ra);
- EnumeratedProfileElement artistElem =
- new EnumeratedProfileElement(p, "artist",
- "artist", "Name of the artist of a work",
- "string", "name", /*syns*/EL, /*ob*/true,
- /*maxOccur*/1, /*comment*/null,
- Collections.singletonList(artistName));
- p.getProfileElements().put("artist",
- artistElem);
- EnumeratedProfileElement albumElem =
- new EnumeratedProfileElement(p, "album",
- "album", "Name of album where track occurs",
- "string", "name", /*syns*/EL, /*ob*/true,
- /*maxOccur*/1, /*comment*/null,
- Collections.singletonList(albumName));
- p.getProfileElements().put("album",
- albumElem);
- return p;
-}</source>
-
- <p>The profile attributes say that</p>
- <ul>
- <li>The ID of the profile itself is the same as the track's URI.</li>
- <li>The version of the profile is 1.0.</li>
- <li>The type is "profile".</li>
- <li>It's currently active.</li>
- <li>It's not top-secret, it's "unclassified".</li>
- <li>It has no parent profile.</li>
- <li>It has no child profiles.</li>
- <li>The registration authority has OID 1.3.6.1.4.1.7655</li>
- <li>There are no revision notes.</li>
- </ul>
-
- <p>The resource attributes say that</p>
- <ul>
- <li>The Identifier is the track's URI.</li> <li>The Title is
- the track's title.</li> <li>The sole Format in which the
- track is available is <code>audio/mpeg</code>.</li>
- <li>There's no description.</li> <li>The sole Creator is the
- name of the artist.</li> <li>There are no subject keywords,
- publishers, contributors, dates, types, sources, languages,
- relations, coverages, nor rights.</li>
- <li>The sole resource context is "Tutorial.Music".</li>
- <li>The resource's aggregation is "granule", meaning this profile is describing a single, discrete resource.</li>
- <li>The resource's class is "system.productServer", meaning you need to contact a product server at the resource location to retrieve the resource.</li>
- <li>The resource location is <code>urn:eda:rmi:MyProductServer</code>.</li>
- </ul>
-
- <p>Finally, the two profile elements tell (again) who the
- artist was and also on what album the track appears.
- </p>
-
- <p>What's with all the <code>EL</code>s? It's just to save on typing:</p>
-
- <source>private static final List EL
- = Collections.EMPTY_LIST;</source>
- </subsection>
-
- <subsection name="Implementng the Interface">
- <p>The <code>ProfileHandler</code> interface stipulates two
- methods, one for finding profiles given an
- <code>XMLQuery</code> and another for retrieving a single
- profile given its ID. With all of these utility methods in
- place, these are both easy to write. First, the
- <code>findProfiles</code> method:
- </p>
-
- <source>public List findProfiles(XMLQuery q) {
- Expr expr = transform(q);
- Set matches = expr.evaluate();
- List profiles = describe(matches);
- return profiles;
-}</source>
-
- <p>The algorithm should be painfully obvious by now: transform
- the query to a tree, evaluate the tree into a set of
- matching tracks, and describe the tracks.
- </p>
-
- <p>The <code>get</code> method takes a profile's ID and
- returns the matching profile, or <code>null</code> if it's
- not found. Since we're using the track's ID as the
- profile's ID as well, we can just iterate through our
- tracks, find the one with the matching ID, and
- <code>describe</code> it:
- </p>
-
- <source>public Profile get(String id) {
- URI uri = URI.create(id);
- for (Iterator i = DB.TRACKS.iterator();
- i.hasNext();) {
- Track t = (Track) i.next();
- if (t.getID().equals(uri))
- return createProfile(t.getID().toString(),
- t.getName(), t.getAlbum().getName(),
- t.getArtist().getName());
- }
- return null;
-}</source>
-
- </subsection>
-
- <subsection name="Complete Source Code">
- <p>Don't feel like cutting and pasting all of those code
- fragments? No problem. All of the source files are
- available <a href="../examples/src.jar">in a jar</a>.
- </p>
- </subsection>
- </section>
-
- <section name="Compiling the Handler">
- <p>As with the <a
- href="../handler/"><code>NullHandler</code></a>, we'll use the
- J2SDK command-line tools. And if you've gone through the <a
- href="../handler/"><code>NullHandler</code> tutorial</a>, you've
- got all the dependent jars in place already. Just put the
- <code>MusicHandler.java</code> and all the related source files
- under <code>$PS_HOME/src</code>, compile, and build the jar:
- </p>
-
- <source>% <b>ls src</b>
-Album.java Expr.java
-AlbumExpr.java MusicHandler.java
-And.java Not.java
-Artist.java NullHandler.java
-ArtistExpr.java Or.java
-Constant.java Track.java
-DB.java TrackExpr.java
-% <b>javac -extdirs lib -d classes src/*.java</b>
-% <b>ls classes</b>
-Album.class Expr.class
-AlbumExpr.class MusicHandler.class
-And.class Not.class
-Artist.class NullHandler.class
-ArtistExpr.class Or.class
-Constant.class Track.class
-DB.class TrackExpr.class
-% <b>cd classes</b>
-% <b>jar -uf ../lib/my-handler.jar *.class</b>
-% <b>cd ..</b>
-% <b>jar -tf lib/my-handler.jar</b>
-META-INF/
-META-INF/MANIFEST.MF
-NullHandler.class
-Album.class
-AlbumExpr.class
-And.class
-Artist.class
-ArtistExpr.class
-Constant.class
-DB.class
-Expr.class
-MusicHandler.class
-Not.class
-Or.class
-Track.class
-TrackExpr.class</source>
-
- <p>We also need to update the <code>$PS_HOME/bin/ps</code>
- script. Currently, it's instantiating just the
- <code>NullHandler</code>; we need it to instantiate the
- <code>MusicHandler</code> too. Stop any currently running
- profile server by pressing CTRL+C (or whatever your interrupt
- key is) in the window running the server. Then edit the
- script so it reads as follows:
- </p>
-
- <source>#!/bin/sh
-exec java -Djava.ext.dirs=$PS_HOME/lib \
- -Dhandlers=NullHandler,MusicHandler \
- jpl.eda.ExecServer \
- jpl.eda.profile.rmi.ProfileServiceImpl \
- urn:eda:rmi:MyProfileService</source>
-
- <p>Now the profile server will delegate to <em>two</em>
- handlers: the <code>NullHandler</code> and the
- <code>MusicHandler</code>. With more than one handler, the
- OODT framework calls each one in turn and collects all of the
- matching profiles together to return to the
- <code>ProfileClient</code>. (Of course, the
- <code>NullHandler</code> never actually generates any matching
- profiles.)
- </p>
- </section>
-
- <section name="Querying the Profile Server">
- <p>Start the profile server by running
- <code>$PS_HOME/bin/ps</code> in one window (presumably the RMI
- registry is still running in another window). In yet another
- window, we'll run our <code>$PS_HOME/bin/pc</code> script to
- query the profile server:
- </p>
-
- <source>% <b>$PS_HOME/bin/pc 'artist = Delerium
- AND album != Poem OR artist = Bach'</b><![CDATA[
-Object context ready; delegating to:
-[jpl.eda.object.jndi.RMIContext@dec8b3]
-[<?xml version="1.0" encoding="UTF-8"?>
-<profile><profAttributes><profId>urn:sk:tr91BC.mp3</profId>...]]></source>
-
- <p>Whoa! There's a huge load of XML! In fact what the
- <code>ProfileClient</code> is printing is a
- <code>java.util.List</code> of profiles in XML format, each
- separated by a comma, and the whole list in square brackets.
- If you search this output carefully, though, you can pick out
- the <code><Title></code> elements and see indeed that
- we've got six matching tracks:
- </p>
-
- <ul>
- <li>Brandenburg Concerto #1</li>
- <li>Brandenburg Concerto #2</li>
- <li>Brandenburg Concerto #3</li>
- <li>Brandenburg Concerto #4</li>
- <li>Brandenburg Concerto #5</li>
- <li>Brandenburg Concerto #6</li>
- <li>Flowers Become Screens</li>
- <li>Metaphor</li>
- </ul>
-
- <p>Sure enough, this matches the XMLQuery query language
- expression we passed in: There are tracks by Delerium but
- <em>not</em> from the Poem album, and there are all the tracks
- by Bach.
- </p>
- </section>
-
- <section name='Conclusion'>
- <p>In this long tutorial we developed a real profile handler
- that answered queries by transforming them from postfix stacks
- into expression trees and using those trees to query an
- in-memory database made of Java objects. We then described
- matching data by creating <code>Profile</code>s.
- </p>
-
- <p>You might be thinking that this seems like a lot of work, and
- there might be some easier ways to go. You could use the
- <code>LightweightProfileHandler</code> for resources that
- never change, but only if you don't have too many of them and
- don't mind managing potentially large XML documents. You
- could choose to use unparsed XMLQuery expressions and instead
- make the user query in the same language as your data system,
- obviating the need for complex expression trees.
- </p>
-
- <p>However, with the tools presented in this tutorial, you could
- adapt the expression tree code to generating system-specific
- queries, and describe those results with as much or as little
- detail as necessary.
- </p>
-
- <p>Happy profiling!</p>
- </section>
- </body>
-</document>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/site/xdoc/handler/index.xml
----------------------------------------------------------------------
diff --git a/profile/src/site/xdoc/handler/index.xml b/profile/src/site/xdoc/handler/index.xml
deleted file mode 100755
index ba02b14..0000000
--- a/profile/src/site/xdoc/handler/index.xml
+++ /dev/null
@@ -1,595 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more contributor
-license agreements. See the NOTICE.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.
--->
-<document>
- <properties>
- <title>Developing a Profile Handler</title>
- <author email="Sean.Kelly@jpl.nasa.gov">Sean Kelly</author>
- </properties>
- <!-- Shift - Nexus Overload -->
- <body>
- <section name="Developing a Profile Handler">
- <p>Profiles describe resources. But where do profiles come from?
- From profile handlers. Profile handlers are interchangeable
- components of a profile server that accept queries for
- profiles and return matching profiles. Profile handlers take a
- static or a dynamic collection of information and serve an
- equivalent set of profiles. Developing a new profile handler
- is as simple as writing a Java class that implements a
- specific interface or two.
- </p>
-
- <p>If you're not already familiar with the <code>XMLQuery</code>
- class, go ahead and <a href="/edm-query/tutorial/">take its
- tutorial now</a>. We'll wait!
- </p>
- </section>
-
- <section name="Introduction">
- <p>Profile handlers handle queries for profiles. They're the
- interchangeable part of a profile server that you can develop
- for special needs. Profile servers delegate all incoming
- requests to zero or more profile handlers, as shown in the
- following class diagram:
- </p>
-
- <img src="../images/delegation.png" alt="Delegation model" />
-
- <p>Developing, testing, and deploying a new profile handler
- involves:
- </p>
- <ol>
- <li>Creating a class that implements (however indirectly)
- the <code>jpl.eda.profile.handlers.ProfileHandler</code> interface.
- </li>
- <li>Creating a new process that runs either the RMI or
- CORBA <code>ProfileServiceImpl</code> class,
- specifying the name of your handler class.
- </li>
- <li>Starting the server and sending in queries.
- </li>
- </ol>
- <p>This document describes each of these steps in detail.</p>
- </section>
-
- <section name="Writing the Handler Class">
- <p>Writing the class that handles profile queries and delivers
- profile results is easily the hardest part in developing a new
- kind of profile server. Profile servers' handlers can serve
- profiles describing static resources, can synthesize profile
- on the fly to describe resources, and can create profile
- metadata for resources that change all the time.
- </p>
-
- <p>Understanding the resources you're trying to describe with
- profiles is the most important thing you can do before
- beginning to write your profile handler:
- </p>
-
- <ul>
- <li>Do you always have the same set of static resources?
- If so, you can write a static profile document to describe
- them and use the
- <code>LightweightProfileHandler</code>, thus
- avoiding having to write a new handler at all.
- </li>
- <li>Do you have resources that never change, but may add to or
- remove from that set? If so, you can use the
- <code>OracleProfileImpl</code> handler which uses an Oracle
- database to store a set of profiles that you can update.
- </li>
- <li>Do you have resources that do change, or that come
- from a dynamic set of data? If so, you'll have to write a
- handler.
- </li>
- </ul>
-
- <subsection name="Choosing the Handler Interface to Implement">
- <p>The OODT Framework provides two handler interfaces (one is
- an extension of the other):
- </p>
- <ul>
- <li><code>jpl.eda.profile.handlers.ProfileHandler</code>
- is the basic profile handler. It defines methods for
- <em>handling</em> searches for profiles.
- </li>
-
- <li><code>jpl.eda.profile.handlers.ProfileManager</code> is an
- extension that not just <em>handles</em> profile queries
- but also <em>manages</em> the set of profiles maintained
- by the server, by providing methods for adding to,
- removing from, and updating the set of managed profiles.
- </li>
- </ul>
-
- <p>For nearly all applications, the <code>ProfileHandler</code>
- interface is sufficient. If you need to provide profile
- management capabilities, it still may be handy to start with
- the <code>ProfileHandler</code> interface, implement and test
- its methods, and <em>then</em> change to the
- <code>ProfileManager</code>.
- </p>
- </subsection>
-
- <subsection name="The ProfileHandler Interface">
- <p>The <code>ProfileHandler</code> interface is
- as follows:
- </p>
-
- <source>package jpl.eda.profile.handlers;
-
-import java.util.List;
-import jpl.eda.profile.Profile;
-import jpl.eda.profile.ProfileException;
-import jpl.eda.xmlquery.XMLQuery;
-
-public interface ProfileHandler {
- List findProfiles(XMLQuery query) throws ProfileException;
- Profile get(String profID) throws ProfileException;
-}</source>
-
- <p>The two methods are described in detail below.</p>
-
- <dl>
- <dt><code>findProfiles</code></dt>
- <dd>This method accepts a query in the form of an
- <code>XMLQuery</code> object and returns a
- Java <code>List</code> of
- <code>Profile</code> objects that match. If
- there are no matches, this method must return an empty
- list. If an error occurs, it should throw the
- <code>ProfileException</code>.
-
- <p>This is by far the most used and most important
- method, and really is the <i>raison
- d'etre</i> for profile servers. It's
- what the OODT Framework uses to allow clients to ask
- your server for resources based on metadata .
- </p>
- </dd>
- <dt><code>get</code></dt>
- <dd>This method accepts the ID of a profile in the form
- of a Java <code>String</code> and returns
- either a <code>Profile</code> object with that
- ID or null if the ID is unknown. This method enables a
- client to retrieve a profile using a priori knowledge of
- the profile's ID (perhaps from a previous search).
- </dd>
- </dl>
- </subsection>
-
- <subsection name="The ProfileManager Interface">
- <p>The <code>ProfileManager</code> interface
- builds on the <code>ProfileHandler</code>, and is
- listed below:
- </p>
- <source>package jpl.eda.profile.handlers;
-
-import java.util.Collection;
-import java.util.Iterator;
-import jpl.eda.profile.Profile;
-import jpl.eda.profile.ProfileException;
-import jpl.eda.xmlquery.XMLQuery;
-
-public interface ProfileManager extends ProfileHandler {
- void add(Profile profile) throws ProfileException;
- void addAll(Collection collection) throws ProfileException;
- void clear() throws ProfileException;
- boolean contains(Profile profile) throws ProfileException;
- boolean containsAll(Collection collection) throws ProfileException;
- Collection getAll() throws ProfileException;
- boolean isEmpty() throws ProfileException;
- Iterator iterator() throws ProfileException;
- boolean remove(String profID, String version) throws ProfileException;
- boolean remove(String profID) throws ProfileException;
- int size() throws ProfileException;
- void replace(Profile profile) throws ProfileException;
-}</source>
-
- <p>If you choose to implement a profile manager, please see
- the API documentation for the
- <code>ProfileManager</code> class for the
- expectations of each method.
- </p>
- </subsection>
- </section>
-
- <section name="Our First Profile Handler">
- <p>Although not terribly useful, a “null” profile
- handler is a good example to start with because it is small and
- will make sure your environment is in good working order before
- proceeding to a real profile handler.
- </p>
-
- <p>What's a “null” profile handler? It's one that
- serves no profiles. That is, for any query with
- <code>findProfiles</code> and any retrieval with
- <code>get</code> it never returns any profiles.
- </p>
-
- <subsection name="Directory Layout">
- <p>For these examples, we'll work on a kind of Unix system
- with a <code>csh</code> shell. Other shell users or Windows
- users will need to adjust. We'll also use the J2SDK
- command-line tools. If you're using an Integrated
- Development Environment of some sort, please adjust
- accordingly.
- </p>
-
- <p>We'll create a "home" directory for our profile servers
- with subdirectories to hold specific components like source
- code, jar files, and scripts. We'll call this home
- directory by an environment variable, <code>PS_HOME</code>
- (PS for Profile Server), so that scripts won't have to refer
- to things by relative paths:
- </p>
-
- <source>% <b>mkdir ps</b>
-% <b>cd ps</b>
-% <b>setenv PS_HOME `pwd`</b>
-% <b>mkdir bin classes lib src</b></source>
- </subsection>
-
- <subsection name="Source File">
- <p>One of the easier parts is the source itself for the
- ‘null’ profile handler. Here it is:
- </p>
- <source>import java.util.Collections;
-import java.util.List;
-import jpl.eda.profile.Profile;
-import jpl.eda.profile.handlers.ProfileHandler;
-import jpl.eda.xmlquery.XMLQuery;
-
-public class NullHandler implements ProfileHandler {
- public List findProfiles(XMLQuery query) {
- return Collections.EMPTY_LIST;
- }
- public Profile get(String id) {
- return null;
- }
-}</source>
-
- <p>Note that for every query, the
- <code>findProfiles</code> method returns an empty list
- (meaning that no profiles matched), and that for any retrieval
- the <code>get</code> method returns null, meaning that
- the handler believes there's no such profile.
- </p>
- <p>This class should be compiled into a file named
- <code>$PS_HOME/src/NullHandler.java</code>
- since it is a public class.
- </p>
-
- <p><em>Note:</em> Profile handler classes <em>must</em> be
- public <em>and</em> provide a no-arguments
- constructor. You should retrieve any initialization
- settings through the System Properties or by other means
- specific to your profile handler.
- </p>
- </subsection>
-
- <subsection name="Compiling the Handler">
- <p>Compiling this profile handler requires the following
- dependent components:
- </p>
-
- <ul>
- <li><a href="/grid-profile/">Profile Service</a>. This
- defines the entire profile model, handler interfaces,
- servers, clients, and so forth.
- </li>
- <li><a href="/edm-query/">Query Expression</a>. This
- defines the <code>XMLQuery</code> and related classes.
- </li>
- </ul>
-
- <p>Download the binary distributions of the above two packages
- and copy the jar file from each into the
- <code>$PS_HOME/lib</code> directory. Then you can compile
- the <code>NullHandler.java</code> file.
- </p>
-
- <source>% <b>ls</b>
-bin classes lib src
-% <b>ls -l lib</b>
-total 244
--rw-r--r-- 1 kelly kelly 43879 28 Feb 07:05 edm-query-2.0.2.jar
--rw-r--r-- 1 kelly kelly 201453 28 Feb 07:01 grid-profile-3.0.2.jar
-% <b>javac -extdirs lib -d classes src/NullHandler.java</b>
-% <b>ls -l classes</b>
-total 4
--rw-r--r-- 1 kelly kelly 511 28 Feb 07:07 NullHandler.class
-% <b>jar -cf lib/my-handler.jar -C classes NullHandler.class</b>
-% <b>jar -tf lib/my-handler.jar</b>
-META-INF/
-META-INF/MANIFEST.MF
-NullHandler.class</source>
-
- <p>We now have a new jar file, <code>my-handler.jar</code>
- which contains our ‘null’ profile handler,
- compiled and ready to go.
- </p>
- </subsection>
-
- <subsection name="Starting an RMI Registry">
- <p>Clients access profile servers with an open-ended set of
- network protocols. We currently have implementations for
- RMI and CORBA. For this tutorial, we'll use RMI, since it's
- enormously less complex. Clients of RMI systems first
- contact an RMI registry and look up a server object's
- network address. The registry maintains mappings from a
- server object's name to its network address. When servers
- start up, they register with the RMI registry so clients can
- later find them.
- </p>
-
- <p>To start an RMI Registry, you'll need the following components:</p>
-
- <ul>
- <li><a href="/edm-commons/">EDM Common Components</a>.
- These are common utilities used by every OODT
- service.
- </li>
- <li><a href="/rmi-registry/">OODT RMI Registry</a>. This is the
- actual RMI registry.</li>
- </ul>
-
- <p>Download each component's binary distribution, unpack each
- one, and take collect the jar files into the
- <code>lib</code> directory. The RMI Registry will also need
- the <code>grid-profile</code> jar file, which we've already
- got.
- </p>
-
- <source>% <b>ls -l $PS_HOME/lib</b>
-total 404
--rw-r--r-- 1 kelly kelly 149503 28 Feb 07:28 edm-commons-2.2.5.jar
--rw-r--r-- 1 kelly kelly 43879 28 Feb 07:05 edm-query-2.0.2.jar
--rw-r--r-- 1 kelly kelly 201453 28 Feb 07:01 grid-profile-3.0.2.jar
--rw-r--r-- 1 kelly kelly 796 28 Feb 07:07 my-handler.jar
--rw-r--r-- 1 kelly kelly 8055 28 Feb 07:28 rmi-registry-1.0.0.jar</source>
-
- <p>Now all we need is a convenient script to start the RMI
- registry. We'll call it <code>rmi-reg</code> and stick it
- in the <code>bin</code> directory. Here's the
- <code>rmi-reg</code> script:</p>
-
- <source>#!/bin/sh
-exec java -Djava.ext.dirs=$PS_HOME/lib \
- gov.nasa.jpl.oodt.rmi.RMIRegistry</source>
-
- <p>This script tells the Java virtual machine to find
- extension jars in the directory <code>$PS_HOME/lib</code>. It
- then says that the main class to execute is
- <code>gov.nasa.jpl.oodt.rmi.RMIRegistry</code>.
- </p>
-
- <p>Go ahead and make this script executable and start the RMI
- Registry. In another window (with the appropriate setting of
- <code>PS_HOME</code>), run
- <code>$PS_HOME/bin/rmi-reg</code>. You should see output
- similar to the following:
- </p>
-
- <source>% <b>chmod 755 $PS_HOME/bin/rmi-reg</b>
-% <b>$PS_HOME/bin/rmi-reg</b>
-Mon Feb 28 07:30:13 CST 2005: no objects registered</source>
-
- <p>The RMI Registry is now running. Every two minutes it will
- display an update of all registered objects. Naturally, we
- don't have any profile service running right now, so it will
- say <code>no objects registered</code>. Go ahead and ignore
- this window for now. It's time to start our profile server.
- </p>
- </subsection>
-
- <subsection name="Starting the Profile Server">
- <p>With our handler compiled and our RMI registry running,
- we're ready to start our profile server. As said before,
- profile servers delegate to zero or more profile handlers to
- actually handle all incoming requests. You tell the profile
- server what handlers to instantiate by naming their classes
- in a system property. That property is called
- <code>handlers</code>, and its value is a comma-separated
- list of fully qualified class names, including the package
- name prefixes. Since our <code>NullHandler</code> is just
- in the default package, <code>NullHandler</code> <em>is</em>
- its fully-qualified class name.
- </p>
-
- <p>Profile server processes require the following components
- in addition to the ones we've downloaded so far:</p>
-
- <ul>
- <li><a href="http://ws.apache.org/xmlrpc">Apache
- XML-RPC</a>. This is used internally by OODT services.
- Download version 1.1, not a later version! If you prefer,
- you can <a
- href="http://ibiblio.org/maven/xmlrpc/jars/xmlrpc-1.1.jar">fetch
- the jar file directly</a>.
- </li>
-
- <li><a href="http://jena.sourceforge.net/">Jena Semantic Web
- Framework for Java</a>. This is used by the classes
- that represent profiles. You'll need version 1.6.1 You
- can also <a
- href="http://oodt.jpl.nasa.gov/download/public/Jena/jars/jena-1.6.1.jar">fetch
- the jar file directly</a>.
- </li>
- </ul>
-
- <p>Copy these two other jars to the <code>$PS_HOME/lib</code>
- directory. You should now have seven jars there:
- </p>
-
- <source>% <b>ls -l $PS_HOME/lib</b>
-total 1580
--rw-r--r-- 1 kelly kelly 149503 28 Feb 07:28 edm-commons-2.2.5.jar
--rw-r--r-- 1 kelly kelly 43879 28 Feb 07:05 edm-query-2.0.2.jar
--rw-r--r-- 1 kelly kelly 201453 28 Feb 07:01 grid-profile-3.0.2.jar
--rw-r--r-- 1 kelly kelly 1144107 28 Feb 09:23 jena-1.6.1.jar
--rw-r--r-- 1 kelly kelly 796 28 Feb 07:07 my-handler.jar
--rw-r--r-- 1 kelly kelly 8055 28 Feb 07:28 rmi-registry-1.0.0.jar
--rw-r--r-- 1 kelly kelly 53978 28 Feb 09:20 xmlrpc-1.1.jar</source>
-
- <p>Now, create a second shell script to make starting the
- profile server convenient and call it
- <code>$PS_HOME/bin/ps</code>. It should look like this:
- </p>
-
- <source>#!/bin/sh
-exec java -Djava.ext.dirs=$PS_HOME/lib \
- -Dhandlers=NullHandler \
- jpl.eda.ExecServer \
- jpl.eda.profile.rmi.ProfileServiceImpl \
- urn:eda:rmi:MyProfileService</source>
-
- <p>Make the script executable and start the profile server:</p>
-
- <source>% <b>chmod 755 $PS_HOME/bin/ps</b>
-% <b>$PS_HOME/bin/ps</b>
-Object context ready; delegating to: [jpl.eda.object.jndi.RMIContext@dec8b3]</source>
-
- <p>The profile server will start, check its
- <code>handlers</code> property, and create an object of each
- class named by it. Then it'll register itself with the RMI
- registry and wait for requests to come in from profile clients.
- </p>
-
- </subsection>
-
- <subsection name="What's in a Name?">
- <p>The profile server registers itself using a name provided
- on the command-line, in this case,
- <code>urn:eda:rmi:MyProfileService</code>. Let's take apart
- the name and see how it works.
- </p>
-
- <p>If you're familiar with web standards, you can see that the
- name is a Uniform Resource Name (URN), since it starts with
- <code>urn:</code>. The OODT Framework uses URNs to identify
- services and other objects. The <code>eda:</code> tells
- that the name is part of the Enterprise Data Architecture
- (EDA) namespace. (EDA was the name of a project related to
- OODT that was merged with OODT. For now, just always use
- <code>eda:</code> in your URNs.)
- </p>
-
- <p>Next comes <code>rmi:</code>. This is a special flag for
- the OODT services that tells that we're using a name of an
- RMI-accessible object. The OODT framework will know to use
- an RMI registry to register the server.
- </p>
-
- <p>Finally is <code>MyProfileService</code>. This is the
- actual name used in the RMI registry. You can call your
- profile server anything you want. For example, suppose you
- have three profile servers; one in the US, one in Canada,
- and one in Australia. You might name them:
- </p>
-
- <ul>
- <li><code>urn:eda:rmi:US</code></li>
- <li><code>urn:eda:rmi:Canada</code></li>
- <li><code>urn:eda:rmi:Australia</code></li>
- </ul>
-
- <p>Or you might prefer to use ISO country codes. Or you might
- name them according to the kinds of profiles they serve,
- such as <code>urn:eda:rmi:BiomarkerMetadata</code> or
- <code>urn:eda:rmi:BusniessForecastMetadata</code>.
- </p>
-
- <p>The RMI registry will happily re-assign a name if one's
- already in use, so when deploying your own profile (and
- other) servers, be sure to give each one a unique name.
- </p>
- </subsection>
-
- <subsection name="Querying the Profile Server">
- <p>To query a profile server, you use the
- <code>ProfileClient</code> class. It provides methods to
- contact a named profile server, performing the lookup in the
- RMI registry, contacting the profile server, and passing in
- queries and profile retrievals. The
- <code>ProfileClient</code> class is also an
- <em>executable</em> class, making it perfect for testing a
- new profile server from the command-line.
- </p>
-
- <p>Still, we'll make a script, called
- <code>$PS_HOME/bin/pc</code> (for "profile client") to
- execute it, though, to save from having to type hugely long
- Java command-lines:
- </p>
-
- <source>#!/bin/sh
-if [ $# -ne 1 ]; then
- echo "Usage: `basename $0` <query-expression>" 1>&2
- exit 1
-fi
-exec java -Djava.ext.dirs=$PS_HOME/lib \
- jpl.eda.profile.ProfileClient \
- urn:eda:rmi:MyProfileService \
- "$1"</source>
-
- <p>Make this script executable and then run it:</p>
-
- <source>% <b>chmod 755 $PS_HOME/bin/pc</b>
-% <b>$PS_HOME/bin/pc "temperature = 37"</b>
-Object context ready; delegating to: [jpl.eda.object.jndi.RMIContext@dec8b3]
-[]</source>
-
- <p>Although it may not look spetacular, this is a success!
- The two square brackets, <code>[]</code>, indicates the list
- of matching profiles to our query expression,
- <code>temperature = 37</code>. In this case, there were no
- matches, which is exactly what we wanted.
- </p>
- </subsection>
- </section>
-
- <section name="Conclusion">
- <p>The Null Profile Server made sure our development
- environment worked from end to end for creating, deploying, and
- testing a profile handler. Now you're ready to implement a real
- profile handler:
- </p>
-
- <ul>
- <li>Instead of returning an empty list, create a
- <code>Profile</code> object and return it as a
- singleton list. See the API documentation for
- <code>Profile</code> as well as other articles
- for manipulating this class.
- </li>
- <li>Analyze the methods of the
- <code>XMLQuery</code> class to determine the
- query passed in from the user. Use that information to
- synthesize the correct <code>Profile</code>
- object. See the API documentation for class
- <code>XMLQuery</code> for more information.
- </li>
- <li>Connecting to an external data source (such as the
- local filesystem or a database), synthesize appropriate
- profiles in response to queries and profile retrieval with
- the <code>get</code> method.
- </li>
- </ul>
- </section>
- </body>
-</document>
[20/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/site/xdoc/tutorials/lh/index.xml
----------------------------------------------------------------------
diff --git a/product/src/site/xdoc/tutorials/lh/index.xml b/product/src/site/xdoc/tutorials/lh/index.xml
deleted file mode 100755
index cb3de01..0000000
--- a/product/src/site/xdoc/tutorials/lh/index.xml
+++ /dev/null
@@ -1,718 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<document>
- <properties>
- <title>Serving Large Products</title>
- <author email="Sean.Kelly@jpl.nasa.gov">Sean Kelly</author>
- </properties>
-
- <body>
- <section name="Serving Large Products">
- <p>In the <a href="../qh/">last tutorial</a>, we created a query
- handler and "installed" it in a product server. We could
- query it for products (mathematical constants) using the
- XMLQuery's postfix boolean stacks. The handler would return
- results by embedding them in the returned XMLQuery. Now we'll
- return larger products that live outside of the XMLQuery.
- </p>
- </section>
-
- <section name="What's Large?">
- <p>There's a <a
- href="http://www.worldslargestthings.com/california/clam.htm">giant
- clam</a> at Pismo Beach, a <a
- href="http://www.worldslargestthings.com/kansas/cawkercity.htm">giant
- ball of twine</a> in Kansas, and for those who drive SUVs, a
- <a
- href="http://www.worldslargestthings.com/missouri/gaspump.htm">giant
- gas pump</a>. For the OODT framework, large is similarly hard to define.
- </p>
-
- <p>One of the original architects of the OODT framework thought
- that putting a products result in with the query meant that
- you'd never lose the separation between product and the query
- that generated it. I'm not sure I see the value in that, but
- regardless, it posed a practical challenge: an
- <code>XMLQuery</code> object in memory with one or two large
- results in it will exhaust the Java virtual machine's available
- memory.
- </p>
-
- <p>It's even worse in when the XMLQuery is expressed as a
- textual XML document. In this case, a binary product must be
- encoded in a text format (we use <a
- href="ftp://ftp.rfc-editor.org/in-notes/rfc2045.txt">Base64</a>),
- making the XMLQuery in XML format even larger than as a Java
- object. Moreover, those XML documents must be parsed at some
- time to reconstitute them as Java objects. We use a DOM-based
- parser, which holds the entire document in memory. Naturally,
- things tend to explode at this rate.
- </p>
-
- <p>There is a way out of the quagmire, though. Instead of
- writing a <code>QueryHandler</code>, write a
- <code>LargeProductQueryHandler</code>. A
- <code>QueryHandler</code> puts <code>Result</code> objects
- into the <code>XMLQuery</code> which hold the entire product.
- A <code>LargeProductQueryHandler</code> puts
- <code>LargeResult</code> objects which hold <em>a reference to
- the product</em>.
- </p>
- </section>
-
- <section name="Large Handlers and Large Results">
- <p>The OODT framework provides an extension to the
- <code>QueryHandler</code> interface called
- <code>jpl.eda.product.LargeProductQueryHandler</code>. This
- interface adds two methods that you must implement:
- </p>
-
- <ul>
- <li><code>retrieveChunk</code>. This method returns a byte
- array representing a chunk of the product. The OODT
- framework calls this method repeatedly to gather chunks of
- the product for the product client. It takes a <em>product
- ID</em> (a string) that identifies which product is being
- retrieved. It also takes an byte offset into the product
- data and a size of the byte chunk to return. You return the
- matching chunk.
- </li>
-
- <li><code>close</code>. This method is called by the OODT
- framework to tell the query handler it's done getting a
- product. It takes a <em>product ID</em> that tells which
- product is no longer being retrieved. You use this method
- to perform any cleanup necessary.
- </li>
- </ul>
-
- <p>Because it extends the <code>QueryHandler</code> interface,
- you still have to implement the <code>query</code> method.
- However, as a <code>LargeProductQueryHandler</code>, you can
- add <code>LargeResult</code> objects to the
- <code>XMLQuery</code> passed in. <code>LargeResult</code>s
- identify the <em>product ID</em> (string) that the OODT
- framework will later use when it calls
- <code>retrieveChunk</code> and <code>close</code>.
- </p>
-
- <p>For example, suppose you're serving large images by
- generating them from various other data sources:
- </p>
-
- <ol>
- <li>The <code>query</code> method would examine the user's
- query, consult the various data sources, and generate the
- image, storing it in a temporary file. It would also assign
- a string <em>product ID</em> to this file, use that product
- ID in a <code>LargeResult</code> object, add the
- <code>LargeResult</code> to the <code>XMLQuery</code>, and
- return the modified <code>XMLQuery</code>.
- </li>
-
- <li>Shortly afterward, the OODT framework will repeatedly call
- the <code>retrieveChunk</code> method. This method would
- check the <em>product ID</em> passed in and locate the
- corresponding temporary file generated earlier by the
- <code>query</code> method. It would index into the file by
- the offset requested by the framework, read the number of
- bytes requested by the framework, package that up into a
- byte array, and return it. Eventually, the OODT framework
- will have read the entire product this way.
- </li>
-
- <li>Lastly, the OODT framework will call the
- <code>close</code> method. This method would check the
- <em>product ID</em> and locate and delete the temporary
- file.
- </li>
- </ol>
-
- <p>To put this into practice, let's create a
- <code>LargeProductQueryHandler</code> that serves files out of
- the product server's filesystem.
- </p>
- </section>
-
- <section name="Writing the Handler">
- <p>We'll develop a <code>FileHandler</code> that will serve
- files out of the product server's filesystem. Providing
- filesystem access through the OODT framework in this way is
- probably not a very good idea (after all, product clients
- could request copies of sensitive files), but for a
- demonstration it'll do.
- </p>
-
- <p>Because files can be quite large, we'll use a
- <code>LargeProductQueryHandler</code>. It will serve queries
- of the form
- </p>
-
- <p><code>file = <var>path</var></code></p>
-
- <p>where <var>path</var> is the full path of the file the user
- wants. The handler will add <code>LargeResult</code>s to the
- XMLQuery, and the <em>product ID</em> will just simply be the
- <var>path</var> of the requested file. The
- <code>retrieveChunk</code> method will open the file with the
- given product ID (which is just the path to the file) and
- return a block of data out of it. The <code>close</code>
- method won't need to do anything, since we're not creating
- temporary files or making network conncetions or anything;
- there's just nothing to clean up.
- </p>
-
- <subsection name="Getting the Path">
- <p>First, let's create a utility method that takes the
- <code>XMLQuery</code> and returns a <code>java.io.File</code>
- that matches the requested file. Because the query takes the form
- </p>
-
- <p><code>file = <var>path</var></code></p>
-
- <p>there should be three <code>QueryElement</code>s on the "where" stack:</p>
-
- <ol>
- <li>The zeroth (topmost) has role = <code>elemName</code>
- and value = <code>file</code>.
- </li>
- <li>The first (middle) has role = <code>LITERAL</code> and
- value = the <var>path</var> of the file the user wants.
- </li>
- <li>The last (bottom) has role = <code>RELOP</code> and
- value = <code>EQ</code>.
- </li>
- </ol>
-
- <p>We'll reject any other query by returning <code>null</code>
- from this method. Further, if the file named by the
- <var>path</var> doesn't exist, or if it's not a file (for
- example, it's a directory or a socket), we'll return <code>null</code>.
- </p>
-
- <p>Here's the start of our <code>FileHandler.java</code>:</p>
-
- <source>import java.io.File;
-import java.util.List;
-import jpl.eda.product.LargeProductQueryHandler;
-import jpl.eda.xmlquery.QueryElement;
-import jpl.eda.xmlquery.XMLQuery;
-public class FileHandler
- implements LargeProductQueryHandler {
- private static File getFile(XMLQuery q) {
- List stack = q.getWhereElementSet();
- if (stack.size() != 3) return null;
- QueryElement e = (QueryElement) stack.get(0);
- if (!"elemName".equals(e.getRole())
- || !"file".equals(e.getValue()))
- return null;
- e = (QueryElement) stack.get(2);
- if (!"RELOP".equals(e.getRole())
- || !"EQ".equals(e.getValue()))
- return null;
- e = (QueryElement) stack.get(1);
- if (!"LITERAL".equals(e.getRole()))
- return null;
- File file = new File(e.getValue());
- if (!file.isFile()) return null;
- return file;
- }
-}</source>
- </subsection>
- <subsection name="Checking the MIME Type">
- <p>Recall that the user can say what MIME types of products
- are acceptable by specifying the preference list in the
- XMLQuery. This lets a product server that serves, say,
- video clips, convert them to <code>video/mpeg</code>
- (MPEG-2), <code>video/mpeg4-generic</code> (MPEG-4),
- <code>video/quicktime</code> (Apple Quicktime), or some
- other format, in order to better serve its clients.
- </p>
-
- <p>Since our product server just serves <em>files of any
- format</em>, we won't really bother with the list of
- acceptable MIME types. After all, the
- <code>/etc/passwd</code> file <em>could</em> be a JPEG
- image on some systems. (Yes, we could go through the
- extra step of determining the MIME type of a file by
- looking at its extension or its contents, but this is an
- OODT tutorial, not a something-else-tutorial!)
- </p>
-
- <p>However, we will honor the user's wishes by labeling the
- result's MIME type based on what the user specifies in the
- acceptable MIME type list. So, if the product client says
- that <code>image/jpeg</code> is acceptable and the file is
- <code>/etc/passwd</code>, we'll call
- <code>/etc/passwd</code> a JPEG image. However, we won't
- try to read the client's mind: if the user wants
- <code>image/*</code>, then we'll just say it's a binary
- file, <code>application/octet-stream</code>.
- </p>
-
- <p>Here's the code:</p>
-
- <source>import java.util.Iterator;
-...
-public class FileHandler
- implements LargeProductQueryHandler {
- ...
- private static String getMimeType(XMLQuery q) {
- for (Iterator i = q.getMimeAccept().iterator();
- i.hasNext();) {
- String t = (String) i.next();
- if (t.indexOf('*') == -1) return t;
- }
- return "application/octet-stream";
- }
-}</source>
- </subsection>
-
- <subsection name="Inserting the Result">
- <p>Once we've got the file that the user wants and the MIME
- type to call it, all we have to do is insert the
- <code>LargeResult</code>. Remember that it's the
- <code>LargeResult</code> that tells the OODT framework what
- the <em>product ID</em> is for later
- <code>retrieveChunk</code> and <code>close</code> calls.
- The <em>product ID</em> is passed as the first argument to
- the <code>LargeResult</code> constructor.
- </p>
-
- <p>We'll write a utility method to insert the <code>LargeResult</code>:</p>
-
- <source>import java.io.IOException;
-import java.util.Collections;
-import jpl.eda.xmlquery.LargeResult;
-...
-public class FileHandler
- implements LargeProductQueryHandler {
- ...
- private static void insert(File file, String type,
- XMLQuery q) throws IOException {
- String id = file.getCanonicalPath();
- long size = file.length();
- LargeResult lr = new LargeResult(id, type,
- /*profileID*/null, /*resourceID*/null,
- /*headers*/Collections.EMPTY_LIST, size);
- q.getResults().add(lr);
- }
-}</source>
-
- </subsection>
-
- <subsection name='Handling the Query'>
- <p>With our three utility methods in hand, writing the
- required <code>query</code> method is a piece of cake. Here
- it is:
- </p>
-
- <source>import jpl.eda.product.ProductException;
-...
-public class FileHandler
- implements LargeProductQueryHandler {
- ...
- public XMLQuery query(XMLQuery q)
- throws ProductException {
- try {
- File file = getFile(q);
- if (file == null) return q;
- String type = getMimeType(q);
- insert(file, type, q);
- return q;
- } catch (IOException ex) {
- throw new ProductException(ex);
- }
- }
-}</source>
-
- <p>The <code>query</code> method as defined by the
- <code>QueryHandler</code> interface (and extended into the
- <code>LargeProductQueryHandler</code> interface) is allowed
- to throw only one kind of checked exception:
- <code>ProductException</code>. So, in case the
- <code>insert</code> method throws an
- <code>IOException</code>, we transform it into a
- <code>ProductException</code>.
- </p>
-
- <p>Now there are just two more required methods to implement,
- <code>retrieveChunk</code> and <code>close</code>.
- </p>
- </subsection>
-
- <subsection name='Blowing Chunks'>
- <p>The OODT framework repeatedly calls handler's
- <code>retrieveChunk</code> method to get chunks of the
- product, evenutally getting the entire product (unless the
- product client decides to abort the transfer). For our file
- handler, retrieve chunk just has to
- </p>
- <ol>
- <li>Make sure the file specified by the <em>product ID</em>
- still exists (after all, it could be deleted at any time,
- even before the first <code>retrieveChunk</code> got
- called).
- </li>
- <li>Open the file.</li>
- <li>Skip into the file by the requested offset.</li>
- <li>Read the requested number of bytes out of the file.</li>
- <li>Return those bytes.</li>
- <li>Close the file.</li>
- </ol>
-
- <p>We'll write a quick little <code>skip</code> method to skip
- into a file's input stream:
- </p>
-
- <source>private static void skip(long offset,
- InputStream in) throws IOException {
- while (offset > 0)
- offset -= in.skip(offset);
-}</source>
-
- <p>And here's another little utility method to read a
- specified number of bytes out of a file's input stream:
- </p>
-
- <source>private static byte[] read(int length,
- InputStream in) throws IOException {
- byte[] buf = new byte[length];
- int numRead;
- int index = 0;
- int toRead = length;
- while (toRead > 0) {
- numRead = in.read(buf, index, toRead);
- index += numRead;
- toRead -= numRead;
- }
- return buf;
-}</source>
-
- <p>(By now, you're probably wondering why we just didn't use
- <code>java.io.RandomAccessFile</code>; I'm wondering that
- too!)</p>
-
- <p>Finally, we can implement the required
- <code>retrieveChunk</code> method:
- </p>
-
- <source>import java.io.BufferedInputStream;
-import java.io.FileInputStream;
-...
-public class FileHandler
- implements LargeProductQueryHandler {
- ...
- public byte[] retrieveChunk(String id, long offset,
- int length) throws ProductException {
- BufferedInputStream in = null;
- try {
- File f = new File(id);
- if (!f.isFile()) throw new ProductException(id
- + " isn't a file (anymore?)");
- in = new BufferedInputStream(new FileInputStream(f));
- skip(offset, in);
- byte[] buf = read(length, in);
- return buf;
- } catch (IOException ex) {
- throw new ProductException(ex);
- } finally {
- if (in != null) try {
- in.close();
- } catch (IOException ignore) {}
- }
- }
-}</source>
-
- </subsection>
-
- <subsection name='Closing Up'>
- <p>Because the OODT framework has no idea what data sources a
- <code>LargeProductQueryHandler</code> will eventually
- consult, what temporary files it may need to clean up, what
- network sockets it might need to shut down, and so forth, it
- needs some way to indicate to a query handler that's it's
- done calling <code>retrieveChunk</code> for a certain
- <em>product ID</em>. The <code>close</code> method does this.
- </p>
-
- <p>In our example, <code>close</code> doesn't need to do
- anything, but we are obligated to implement it:
- </p>
-
- <source>...
-public class FileHandler
- implements LargeProductQueryHandler {
- ...
- public void close(String id) {}
-}</source>
- </subsection>
-
- <subsection name='Complete Source Code'>
- <p>Here's the complete source file, <code>FileHandler.java</code>:</p>
- <source>import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.io.IOException;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import jpl.eda.product.LargeProductQueryHandler;
-import jpl.eda.product.ProductException;
-import jpl.eda.xmlquery.LargeResult;
-import jpl.eda.xmlquery.QueryElement;
-import jpl.eda.xmlquery.XMLQuery;
-
-public class FileHandler
- implements LargeProductQueryHandler {
- private static File getFile(XMLQuery q) {
- List stack = q.getWhereElementSet();
- if (stack.size() != 3) return null;
- QueryElement e = (QueryElement) stack.get(0);
- if (!"elemName".equals(e.getRole())
- || !"file".equals(e.getValue()))
- return null;
- e = (QueryElement) stack.get(2);
- if (!"RELOP".equals(e.getRole())
- || !"EQ".equals(e.getValue()))
- return null;
- e = (QueryElement) stack.get(1);
- if (!"LITERAL".equals(e.getRole()))
- return null;
- File file = new File(e.getValue());
- if (!file.isFile()) return null;
- return file;
- }
- private static String getMimeType(XMLQuery q) {
- for (Iterator i = q.getMimeAccept().iterator();
- i.hasNext();) {
- String t = (String) i.next();
- if (t.indexOf('*') == -1) return t;
- }
- return "application/octet-stream";
- }
- private static void insert(File file, String type,
- XMLQuery q) throws IOException {
- String id = file.getCanonicalPath();
- long size = file.length();
- LargeResult lr = new LargeResult(id, type,
- /*profileID*/null, /*resourceID*/null,
- /*headers*/Collections.EMPTY_LIST, size);
- q.getResults().add(lr);
- }
- public XMLQuery query(XMLQuery q)
- throws ProductException {
- try {
- File file = getFile(q);
- if (file == null) return q;
- String type = getMimeType(q);
- insert(file, type, q);
- return q;
- } catch (IOException ex) {
- throw new ProductException(ex);
- }
- }
- private static void skip(long offset,
- InputStream in) throws IOException {
- while (offset > 0)
- offset -= in.skip(offset);
- }
- private static byte[] read(int length,
- InputStream in) throws IOException {
- byte[] buf = new byte[length];
- int numRead;
- int index = 0;
- int toRead = length;
- while (toRead > 0) {
- numRead = in.read(buf, index, toRead);
- index += numRead;
- toRead -= numRead;
- }
- return buf;
- }
- public byte[] retrieveChunk(String id, long offset,
- int length) throws ProductException {
- BufferedInputStream in = null;
- try {
- File f = new File(id);
- if (!f.isFile()) throw new ProductException(id
- + " isn't a file (anymore?)");
- in = new BufferedInputStream(new FileInputStream(f));
- skip(offset, in);
- byte[] buf = read(length, in);
- return buf;
- } catch (IOException ex) {
- throw new ProductException(ex);
- } finally {
- if (in != null) try {
- in.close();
- } catch (IOException ignore) {}
- }
- }
- public void close(String id) {}
-}</source>
- </subsection>
- </section>
-
- <section name='Compiling the Code'>
- <p>We'll compile this code using the J2SDK command-line tools,
- but if you're more comfortable with some kind of Integrated
- Development Environment (IDE), adjust as necessary.
- </p>
-
- <p>Let's go back again to the <code>$PS_HOME</code> directory we
- made earlier; create the file
- <code>$PS_HOME/src/FileHandler.java</code> with the contents
- shown above. Then, compile and update the jar file as follows:
- </p>
-
- <source>% <b>javac -extdirs lib \
- -d classes src/FileHandler.java</b>
-% <b>ls -l classes</b>
-total 8
--rw-r--r-- 1 kelly kelly 2524 25 Feb 15:46 ConstantHandler.class
--rw-r--r-- 1 kelly kelly 3163 26 Feb 16:15 FileHandler.class
-% <b>jar -uf lib/my-handlers.jar \
- -C classes FileHandler.class</b>
-% <b>jar -tf lib/my-handlers.jar</b>
-META-INF/
-META-INF/MANIFEST.MF
-ConstantHandler.class
-FileHandler.class</source>
-
- <p>We've now got a jar with the <code>ConstantHandler</code>
- from the <a href="../qh/">last tutorial</a> and our new
- <code>FileHandler</code>.
- </p>
- </section>
-
- <section name='Specifying and Running the New Query Handler'>
- <p>The <code>$PS_HOME/bin/ps</code> script already has a system
- property specifying the <code>ConstantHandler</code>, so we
- just need to add the <code>FileHandler</code> to that list.
- </p>
-
- <p>First, stop the product server by hitting CTRL+C (or your
- interrupt key) in the window in which it's currently running.
- Then, modify the <code>$PS_HOME/bin/ps</code> script to read
- as follows:
- </p>
-
- <source>#!/bin/sh
-exec java -Djava.ext.dirs=$PS_HOME/lib \
- -Dhandlers=ConstantHandler,FileHandler \
- jpl.eda.ExecServer \
- jpl.eda.product.rmi.ProductServiceImpl \
- urn:eda:rmi:MyProductService</source>
-
- <p>Then start the server by running
- <code>$PS_HOME/bin/ps</code>. If all goes well, the product
- server will be ready to answer queries again, this time
- passing each incoming <code>XMLQuery</code> to <em>two</em>
- different query handlers.
- </p>
-
- <p>Edit the <code>$PS_HOME/bin/pc</code> script once more to
- make sure the <code>-out</code> and not the <code>-xml</code>
- command-line argument is being used. Let's try querying for a
- file:
- </p>
-
- <source>% <b>$PS_HOME/bin/pc "file = /etc/passwd"</b>
-nobody:*:-2:-2:Unprivileged User:/:/usr/bin/false
-root:*:0:0:System Administrator:/var/root:/bin/sh
-daemon:*:1:1:System Services:/var/root:/usr/bin/false
-...</source>
-
- <p>If you like, you can change the <code>-out</code> to
- <code>-xml</code> again and examine the XML version. This
- time, the product data isn't in the XMLQuery object.
- </p>
- </section>
-
- <section name="What's the Difference?">
- <p>On the client side, the interface to get product results in
- <code>LargeResult</code>s versus regular <code>Result</code>s
- is identical. The client calls <code>getInputStream</code> to
- get a binary stream to read the product data.
- </p>
-
- <p>There is a speed penalty for large results. What
- <code>Result.getInputStream</code> returns is an input stream
- to product data already contained in the XMLQuery. It's a
- stream to a buffer already in the client's address space, so
- it's nice and fast.
- </p>
-
- <p><code>LargeResult</code> overrides the
- <code>getInputStream</code> method to instead return an input
- stream that repeatedly makes calls back to the product
- server's <code>retrieveChunk</code> method. Since the product
- is <em>not</em> already in the local address space of the
- client, getting large products is a bit slower. To
- compensate, the input stream actually starts a background
- thread to start retrieving chunks of the product ahead of the
- product client, up to a certain point (we don't want to run
- out of memory again).
- </p>
-
- <p>On the server side, the difference is in programming
- complexity. Creating a <code>LargeProductQueryHandler</code>
- requires implementing three methods instead of just one. You
- may have to clean up temporary files, close network ports, or
- do other cleanup. You may even have to guard against clients
- that present specially-crafted product IDs that try to
- circumvent access controls to products.
- </p>
-
- <p><code>LargeResult</code>s are more general, and will work for
- any size product, from zero bytes on up. And you can even mix
- and match: a <code>LargeProductQueryHandler</code> can add
- regular <code>Result</code>s to an XMLQuery as well as
- <code>LargeResult</code>s. You might program some logic that,
- under a certain threshold, to return regular
- <code>Result</code>s for small sized products, and
- <code>LargeResult</code>s for anything bigger than small.
- </p>
- </section>
-
- <section name='Conclusion'>
- <p>In this tutorial, we implemented a
- <code>LargeProductQueryHandler</code> that served large
- products. In this case, large could mean zero bytes (empty
- products) up to gargantuan numbers of bytes. This handler
- queried for files in the product server's filesystem, which is
- a bit insecure so you might want to terminate the product
- server as soon as possible. We also learned that what the
- advantages and disadvantages were between regular product
- results and large product results, and that
- <code>LargeProductQueryHandler</code>s can use
- <code>LargeResult</code> objects in addition to regular
- <code>Result</code> objects.
- </p>
-
- <p>If you've also completed the <a href="../ps">Your First
- Product Service</a> tutorial and the <a
- href="../qh/">Developing a Query Handler</a> tutorial, you
- are now a master of the OODT Product Service.
- Congratulations!
- </p>
- </section>
- </body>
-</document>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/site/xdoc/tutorials/ps/index.xml
----------------------------------------------------------------------
diff --git a/product/src/site/xdoc/tutorials/ps/index.xml b/product/src/site/xdoc/tutorials/ps/index.xml
deleted file mode 100755
index 91bfc00..0000000
--- a/product/src/site/xdoc/tutorials/ps/index.xml
+++ /dev/null
@@ -1,481 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<document>
- <properties>
- <title>Your First Product Service</title>
- <author email="Sean.Kelly@jpl.nasa.gov">Sean Kelly</author>
- </properties>
-
- <body>
- <section name="Your First Product Service">
- <p>This tutorial introduces starting a basic product server.
- This product server will be capable of accepting queries, but
- will not actually respond with any data. By completing this
- tutorial, you'll have a working product server in which you
- can install more complex logic to actually handle product
- requests.
- </p>
- </section>
-
- <section name="The Product Service">
- <p>The OODT Product Service is a remotely accessible software
- component that enables you to retrieve products, which can be
- any kind of data. In OODT, a <em>product client</em> passes a
- <em>query</em> into a known product server. The product
- server delegates that query to its installed <em>query
- handlers</em>; each one gets a chance at satisfying the query
- with requested data. Query handlers are the interfaces between
- the generic OODT framework and your system-specific data
- stores. They have the job of understanding the passed in
- query, finding or even synthesizing the matching product,
- applying conversions to Internet-standard formats, and
- returning results. The product service then collects all the
- matching products from the query handlers and returns them to
- the product client.
- </p>
-
- <p>To deploy a product server, you need to come up with query
- handlers that interface to your site- or discipline-specific
- data stores. Then, start a product server and inform it of
- what query handlers to use.
- </p>
-
- <subsection name="Delegation Model">
- <p>The OODT product service <em>delegates</em> incoming
- queries to zero or more query handlers. In the case of zero
- query handlers, the product service always replies to every
- query with "zero matches." Otherwise, the query handlers
- get a chance to satisfy the query, and may or may not add
- matching products to the result.
- </p>
-
- <p>The following class diagram demonstrates this delegation model:</p>
-
- <img src="../../images/delegation.png" alt="Delegation Class Diagram" />
-
- <p>Here, a product client calls a server to process a query
- for products. The server delegates to query handlers, which
- are Java objects that implement the
- <code>QueryHandler</code> interface. Two query handlers in
- this diagram, <code>MyHandler</code> and
- <code>MyOtherHandler</code> can both try to satisfy the
- query by adding matching products to the total result. They
- can each add more than one matching product, just one, or
- none at all. The server then returns the matches, if any,
- to the client.
- </p>
- </subsection>
-
- <subsection name="Large Products">
- <p>In OODT, a query contains its matching products. When a
- client passes a query to a product server, the query object
- returns to the client <em>with matching products embedded in
- it</em>. This can, however, make query objects too large to
- be comfortably passed around a network of OODT services (query
- objects must reside completely in memory). In this case, a
- special extension of a <code>QueryHandler</code>, a
- <code>LargeProductQueryHandler</code>, can instead place a
- <em>reference</em> to the product data in the query.
- </p>
- <p>To product clients, the difference is invisible: the
- product data is still accessed from the query object the
- same way. As a developer of product services, though, you
- may need to decide which kind of query handler to make:
- regular or large.
- </p>
- </subsection>
-
- <subsection name="Communicating with a Product Service">
- <p>The product service is a remotely accessible object.
- Therefore, product clients access it with a remote object
- access protocol. Currently, OODT supports RMI and CORBA. You
- can also access product services with HTTP; in this case, a
- proxy object provides the HTTP interface while internally it
- accesses a product service with RMI or CORBA.
- </p>
-
- <p>For this tutorial, we'll use RMI because it's enormously
- less complex than CORBA.
- </p>
- </subsection>
- </section>
-
- <section name="Making the Staging Area">
- <p>To start a product service, we'll create a directory
- structure that will hold software components (jar files) as
- well as scripts that will simplify the usually over-long Java
- command lines. (Note that these examples are for Mac OS X,
- Linux, or other Unix-like systems. Windows users will have to
- adapt.)
- </p>
-
- <p>Let's start by making a directory hierarchy for our product
- service called <code>ps</code> (this example uses a C-style
- shell <code>csh</code>, if you're using <code>bash</code> or
- another style shell, substitute the appropriate commands).
- </p>
-
- <source>% <b>mkdir ps</b>
-% <b>cd ps</b>
-% <b>setenv PS_HOME `pwd`</b>
-% <b>mkdir bin lib</b>
-% <b>ls -RF $PS_HOME</b>
-bin/ lib/
-
-/Users/kelly/tmp/ps/bin:
-
-/Users/kelly/tmp/ps/lib:</source>
-
- <p>Note that we're using an environment variable
- <code>PS_HOME</code> to contain the path of the directory
- we're using to hold everything. We'll use this environment
- variable as we develop the scripts to launch the product service.
- </p>
- </section>
-
- <section name="The RMI Registry">
- <p>Since we're using Remote Method Invocation (RMI) for this
- tutorial, we'll need to start an RMI Registry. An RMI
- Registry serves as a catalog that maps between named objects,
- such as your product server, to the appropriate network
- address and port where the object can be located. Your
- product client will use the RMI registry to locate the product
- server so it can connect to the product server and communicate with it.
- </p>
-
- <subsection name="Collecting the RMI Registry Components">
- <p>To start an RMI Registry, you'll need the following components:</p>
-
- <ul>
- <li><a href="/edm-commons/">EDM Common Components</a>.
- These are common utilities used by every OODT
- service.</li> <li><a href="/grid-product/">Grid Product
- Service</a>. This is the product service, product client,
- query handler interface, and related classes.</li> <li><a
- href="/rmi-registry/">OODT RMI Registry</a>. This is the
- actual RMI registry.</li>
- </ul>
-
- <p>Download each component's binary distribution, unpack each
- one, and take collect the jar files into the
- <code>lib</code> directory. For example:
- </p>
-
- <source>% <b>cp /tmp/edm-commons-2.2.5/*.jar $PS_HOME/lib</b>
-% <b>cp /tmp/grid-product-3.0.3/*.jar $PS_HOME/lib</b>
-% <b>cp /tmp/rmi-registry-1.0.0/*.jar $PS_HOME/lib</b>
-% <b>ls -l $PS_HOME/lib</b>
-total 312
--rw-r--r-- 1 kelly kelly 149503 24 Feb 14:06 edm-commons-2.2.5.jar
--rw-r--r-- 1 kelly kelly 120844 24 Feb 14:07 grid-product-3.0.3.jar
--rw-r--r-- 1 kelly kelly 8055 24 Feb 14:07 rmi-registry-1.0.0.jar</source>
- </subsection>
-
- <subsection name="Writing the RMI Script">
- <p>To keep from having to type long Java command lines, we'll
- create a simple shell script that will start the RMI
- registry. We'll call it <code>rmi-reg</code> and stick it
- in the <code>bin</code> directory.
- </p>
-
- <p>Here's the <code>rmi-reg</code> script:</p>
- <source>#!/bin/sh
-exec java -Djava.ext.dirs=$PS_HOME/lib \
- gov.nasa.jpl.oodt.rmi.RMIRegistry</source>
-
- <p>This script tells the Java virtual machine to find
- extension jars in the directory <code>$PS_HOME/lib</code>. It
- then says that the main class to execute is
- <code>gov.nasa.jpl.oodt.rmi.RMIRegistry</code>.
- </p>
-
- <p>Go ahead and make this script executable and start the RMI
- Registry. In another window (with the appropriate setting of
- <code>PS_HOME</code>), run
- <code>$PS_HOME/bin/rmi-reg</code>. You should see output
- similar to the following:
- </p>
-
- <source>% <b>chmod 755 $PS_HOME/bin/rmi-reg</b>
-% <b>$PS_HOME/bin/rmi-reg</b>
-Thu Feb 24 14:10:25 CST 2005: no objects registered</source>
-
- <p>The RMI Registry is now running. Every two minutes it will
- display an update of all registered objects. Naturally, we
- don't have any product service running right now, so it will
- say <code>no objects registered</code>. Go ahead and ignore
- this window for now. It's time to start our product server.
- </p>
- </subsection>
- </section>
-
- <section name="The Product Server">
- <p>With an RMI Registry in place, we're ready to start our
- product server. As with the RMI Registry, we'll need the
- software components and to make a script to launch it.
- </p>
-
- <subsection name="Collecting the Product Server Components">
- <p>We already have two of the components needed to start the
- product server, <code>edm-commons</code> and
- <code>grid-product</code>. We need two more:
- </p>
-
- <ul>
- <li><a href="/edm-query/">EDM Query Expression</a>. This
- component encapsulates the implementation of an OODT query
- and also contains some product retrieval utilities.</li>
- <li><a href="http://ws.apache.org/xmlrpc">Apache
- XML-RPC</a>. This is used internally by OODT services.
- Download version 1.1, not a later version! If you prefer,
- you can <a
- href="http://ibiblio.org/maven/xmlrpc/jars/xmlrpc-1.1.jar">fetch
- the jar file directly</a>.</li>
- </ul>
-
- <p>As before, put these jars into the
- <code>$PS_HOME/lib</code> directory:
- </p>
-
- <source>% <b>ls -l $PS_HOME/lib</b>
-total 376
--rw-r--r-- 1 kelly kelly 149503 24 Feb 14:06 edm-commons-2.2.5.jar
--rw-r--r-- 1 kelly kelly 43879 24 Feb 14:35 edm-query-2.0.2.jar
--rw-r--r-- 1 kelly kelly 120844 24 Feb 14:07 grid-product-3.0.3.jar
--rw-r--r-- 1 kelly kelly 8055 24 Feb 14:07 rmi-registry-1.0.0.jar
--rw-r--r-- 1 kelly kelly 53978 24 Feb 14:35 xmlrpc-1.1.jar</source>
- </subsection>
-
- <subsection name="Writing the Product Server Script">
- <p>To launch the product server, we'll create a script called
- <code>ps</code> in the <code>$PS_HOME/bin</code> directory.
- Here's its contents:
- </p>
-
- <source>#!/bin/sh
-exec java -Djava.ext.dirs=$PS_HOME/lib \
- jpl.eda.ExecServer \
- jpl.eda.product.rmi.ProductServiceImpl \
- urn:eda:rmi:MyProductService</source>
-
- <p>Like with the RMI server, this tells Java where to find
- extension jars (<code>$PS_HOME/lib</code>). The main class
- is <code>jpl.eda.ExecServer</code>, this is a framework
- class from <code>edm-commons</code> that provides basic
- start-up functions for a variety of services. In this case,
- the service is
- <code>jpl.eda.product.rmi.ProductServiceImpl</code>; this is
- the name of the class that provides the RMI version of the
- OODT product service. We then pass in one final
- command-line argument,
- <code>urn:eda:rmi:MyProductService</code>. This names the product service.
- </p>
- </subsection>
-
- <subsection name="What's in a Name?">
- <p>The product service registers itself using a name provided
- on the command-line, in this case,
- <code>urn:eda:rmi:MyProductService</code>. Let's take apart
- the name and see how it works.
- </p>
-
- <p>If you're familiar with web standards, you can see that the
- name is a Uniform Resource Name (URN), since it starts with
- <code>urn:</code>. The OODT Framework uses URNs to identify
- services and other objects. The <code>eda:</code> tells
- that the name is part of the Enterprise Data Architecture
- (EDA) namespace. (EDA was the name of a project related to
- OODT that was merged with OODT. For now, just always use
- <code>eda:</code> in your URNs.)
- </p>
-
- <p>Next comes <code>rmi:</code>. This is a special flag for
- the OODT services that tells that we're using a name of an
- RMI-accessible object. The OODT framework will know to use
- an RMI Registry to register the server.
- </p>
-
- <p>Finally is <code>MyProductService</code>. This is the
- actual name used in the RMI Registry. You can call your
- product service anything you want. For example, suppose you
- have three product servers; one in the US, one in Canada,
- and one in Australia. You might name them:
- </p>
-
- <ul>
- <li><code>urn:eda:rmi:US</code></li>
- <li><code>urn:eda:rmi:Canada</code></li>
- <li><code>urn:eda:rmi:Australia</code></li>
- </ul>
-
- <p>Or you might prefer to use ISO country codes. Or you might
- name them according to the kinds of products they serve,
- such as <code>urn:eda:rmi:Biomarkers</code> or
- <code>urn:eda:rmi:BusniessForecasts</code>.
- </p>
-
- <p>The RMI Registry will happily re-assign a name if one's
- already in use, so when deploying your own product servers,
- be sure to give each one a unique name.
- </p>
- </subsection>
-
- <subsection name="Launching the Product Server">
- <p>Make the <code>ps</code> script executable and start the
- product server at this time. Do this in a separate window
- with the appropriate setting of <code>PS_HOME</code>:
- </p>
-
- <source>% <b>chmod 755 $PS_HOME/bin/ps</b>
-% <b>$PS_HOME/bin/ps</b>
-Object context ready; delegating to: [jpl.eda.object.jndi.RMIContext@94257f]</source>
-
- <p>The product service is now running and ready to accept
- product queries. Since we didn't tell it what query
- handlers to use, it will always respond with zero matching
- products. That may not be interesting, but it's a good test
- to see if we can at least launch a product server. Now,
- let's launch a product client and query it.
- </p>
- </subsection>
- </section>
-
- <section name="Querying the Product Server">
- <p>To query the product server, we use a product client. The
- Java class <code>jpl.eda.product.ProductClient</code> provides
- the API for your own programs to query for and retrieve
- products. But it's also an executable class, so we can run it
- from the command-line in order to test our product server.
- However, let's again make a script to make invoking it a bit
- easier.
- </p>
-
- <p>We'll call the script <code>pc</code> for "product client,"
- and it will take a single command line argument, which will be
- the <em>query expression</em> to pass into the product server.
- Query expressions define the constraints on the kinds of
- products we want to achieve. Since the product server we've
- set up will always respond with zero products, though, we can
- pass in any syntactically valid query expression.
- </p>
-
- <p>Here's the script:</p>
-
- <source>#!/bin/sh
-if [ $# -ne 1 ]; then
- echo "Usage: `basename $0` <query-expression>" 1>&2
- exit 1
-fi
-
-exec java -Djava.ext.dirs=$PS_HOME/lib \
- jpl.eda.product.ProductClient \
- -out \
- urn:eda:rmi:MyProductService \
- "$1"</source>
-
-
- <p>This script checks to make sure there's exactly one
- command-line argument, the query expression. If there isn't,
- it prints a helpful usage message to the standard error
- stream, as is Unix tradition. Otherwise, it will execute the
- <code>jpl.eda.product.ProductClient</code> class with Java.
- When executed, this class expects three command-line arguments:
- </p>
-
- <ol>
- <li><code>-out</code> or <code>-xml</code>. OODT uses XML to
- represent the query that it passes to and receives back from
- a product server. With <code>-out</code>, the product
- client will write to the standard output the raw product
- data. With <code>-xml</code>, you'll instead see the XML
- representation of the query (with any embedded matching
- products) instead.
- </li>
-
- <li>The name of the product service to contact. In this case,
- we're using the one we started earlier, registered under the
- name <code>urn:eda:rmi:MyProductService</code>.
- </li>
-
- <li>The query expression.</li>
- </ol>
-
- <p>Now we can make this script executable and run it:</p>
-
- <source>% <b>chmod 755 $PS_HOME/bin/pc</b>
-<b>$PS_HOME/bin/pc "x = 3"</b>
-Object context ready; delegating to: [jpl.eda.object.jndi.RMIContext@c79809]
-No matching results</source>
-
- <p>Although not terribly exciting, this is good news. Here's
- what happened:
- </p>
-
- <ol>
- <li>The product client created a query object (of class
- <code>jpl.eda.xmlquery.XMLQuery</code> from the
- <code>edm-query</code> component) out of the string query
- <code>x = 3</code>.
- </li>
-
- <li>It asked the RMI Registry to tell it where (network
- address) it could find the product service named
- <code>MyProductService</code>.
- </li>
-
- <li>After getting the response back from the RMI Registry, it
- then contacted the product service over a network connection
- (even if to the same local system) and asked it to handle
- the query, passing the query object.
- </li>
-
- <li>The product service, having no query handlers to which to
- delegate, merely returned the query object unmodified over
- the network connection.
- </li>
-
- <li>The product client, having no product to write to the
- standard output (as indicated by the <code>-out</code>
- argument), wrote the diagnostic message <code>No matching
- results</code>.
- </li>
- </ol>
-
- <p>You can make this example slightly more interesting by
- changing the <code>-out</code> in the <code>pc</code> script
- to <code>-xml</code>. Now, when you run it, you'll see an XML
- document describing the query. One of the pertinent sections
- to note is:
- </p>
-
- <source>...<queryResultSet/>...</source>
-
- <p>This empty XML element means that there were no results.</p>
- </section>
-
- <section name="Conclusion">
- <p>By following this tutorial, you've started both an RMI
- Registry and a basic product server. You've queried that
- product server to insure that you can communicate with it. In
- later tutorials, you'll build on this product server by adding
- a query handler to it and returning actual product data.
- </p>
- </section>
-
- </body>
-</document>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/site/xdoc/tutorials/qh/index.xml
----------------------------------------------------------------------
diff --git a/product/src/site/xdoc/tutorials/qh/index.xml b/product/src/site/xdoc/tutorials/qh/index.xml
deleted file mode 100755
index b8e34f6..0000000
--- a/product/src/site/xdoc/tutorials/qh/index.xml
+++ /dev/null
@@ -1,704 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<document>
- <properties>
- <title>Developing a Query Handler</title>
- <author email="Sean.Kelly@jpl.nasa.gov">Sean Kelly</author>
- </properties>
-
- <body>
- <section name="Developing a Query Handler">
- <p>In the <a href="../ps/">last tutorial</a>, we started a
- product server. But this wasn't a very useful product server;
- it could answer queries but always respond with no results.
- That's because it had no query handlers. Query handlers have
- the responsibility of actually handling product queries. In
- this tutorial, we'll develop a query handler, install it into
- our product server, and query it to see if it works.
- </p>
-
- <p>To do this tutorial, you'll need mastery of two things:</p>
- <ul>
- <li>Using the <code>XMLQuery</code> class. Follow the <a
- href="/edm-query/tutorial/">query expression tutorail</a>
- now if you're not familiar with it.
- </li>
-
- <li>Running and querying a product server. Follow the <a
- href="../ps/">Your First Product Server</a> tutorial to
- get your product server up and running. In this tutorial,
- we'll build on that product server, so it's especially
- important to have it in good shape.
- </li>
- </ul>
- </section>
-
- <section name="Serving Up Constants">
- <p>Product servers delegate to query handlers. It's the job of
- query handlers to interpret incoming queries (expressed as
- <code>XMLQuery</code> objects), search for, retrieve, convert,
- or synthesize matching product results, adorn the
- <code>XMLQuery</code> object with <code>Result</code> objects,
- and return the modified query. At that point the OODT
- framework takes over again and tries other installed query
- handlers, eventually returning the completed
- <code>XMLQuery</code> back to the product client that made the
- query in the first place.
- </p>
-
- <p>We'll make a query handler that serves mathematical
- constants. Have you ever been in a position where you needed,
- say, the value of the third Flajolet number or perhaps
- Zeta(9)? No? Well, just pretend for now you did. What we'll
- do is develop a query handler for a product server that will
- serve values of various mathematical constants.
- </p>
-
- <p>The approach we'll take has three simple steps:</p>
-
- <ol>
- <li>Get some handy constants.</li>
- <li>Define the query expression.</li>
- <li>Write a query handler. The query handler will:
- <ol>
- <li>Examine the query expression to see if it's a request
- for a constant, and if so, what constant is
- requested.
- </li>
- <li>Examine the query's list of acceptable MIME types.</li>
- <li>If both check out, look up the desired constant's value.</li>
- <li>If found, add it as a <code>Result</code> in the <code>XMLQuery</code>.</li>
- </ol>
- </li>
- </ol>
- </section>
-
- <section name="Writing the Code">
- <p>In this section, we'll build up the query handler source code
- in pieces, examining each piece thoroughly. We'll then
- present the entire source file.
- </p>
-
- <subsection name='Gathering Handy Constants'>
- <p>The wonderful world of science and mathematics is replete
- with useful constant values. For this example, let's just pick three:
- </p>
-
- <ul>
- <li><var>pi</var> = 3.14159265...</li>
- <li><var>e</var> = 2.7182818285...</li>
- <li><var>gamma</var> = 0.577215664...</li>
- </ul>
-
- <p>In Java code, we can set up those values as a
- <code>Map</code> in a static field. Thus we start forming our
- source file, <code>ConstantHandler.java</code>:
- </p>
-
- <source>import java.util.concurrent.ConcurrentHashMap;
-import java.util.Map;
-import jpl.eda.product.QueryHandler;
-public class ConstantHandler
- implements QueryHandler {
- private static final Map CONSTANTS = new ConcurrentHashMap();
- static {
- CONSTANTS.put("pi", "3.14159265...");
- CONSTANTS.put("e", "2.7182818285...");
- CONSTANTS.put("gamma", "0.577215664...");
- }
-}</source>
-
- <p>As you can see, we're storing both the constant name and its
- value as <code>java.lang.String</code> objects.
- </p>
- </subsection>
-
- <subsection name='Defining the Query Expression'>
- <p>Recall that the <code>XMLQuery</code> class can use parsed
- queries (where it generates postfix boolean stacks) or
- unparsed ones. While unparsed ones are easier, we'll go with
- parsed ones to demonstrate how on the server-side you deal
- with those postfix stacks.
- </p>
-
- <p>Using the XMLQuery's expression language, we'll look for
- queries of the form:</p>
-
- <p><code>constant = <var>name</var></code></p>
-
- <p>where <var>name</var> is the name of a constant. That will
- form a postfix "where" stack with exactly three
- <code>QueryElement</code> objects on it:
- </p>
-
- <ol>
- <li>The first (top) <code>QueryElement</code> will have role =
- <code>elemName</code> and value = <code>constant</code>.
- </li>
-
- <li>The second (middle) <code>QueryElement</code> will have
- role = <code>LITERAL</code> and a value equal to the
- constant <var>name</var>.
- </li>
-
- <li>The third (bottom) <code>QueryElement</code> will have
- role = <code>RELOP</code> and value = <code>EQ</code>.
- </li>
- </ol>
-
- <p>If we get any other kind of stack, we'll reject it and return
- no matching results. That's reasonable behavior; after all, a
- query for <code>donutsEaten > 5 AND RETURN =
- episodeNumber</code> may be handled by a
- <code>SimpsonsEpisodeQueryHandler</code> that's <em>also</em>
- installed in the same product server.
- </p>
-
- <p>We'll define a utility method, <code>getConstantName</code>,
- that will take the <code>XMLQuery</code>, check for the
- postfix "where" stack as described, and return the matching
- constant <var>name</var>. If it gets a stack whose structure
- doesn't match, it will return <code>null</code>. We'll add
- this method to our <code>ConstantHandler.java</code> file:
- </p>
-
- <source>import java.util.List;
-import jpl.eda.xmlquery.XMLQuery;
-import jpl.eda.xmlquery.QueryElement;
-...
-public class ConstantHandler
- implements QueryHandler {
- ...
- private static String getConstantName(XMLQuery q) {
- List stack = q.getWhereElementSet();
- if (stack.size() != 3) return null;
- QueryElement e = (QueryElement) stack.get(0);
- if (!"elemName".equals(e.getRole())
- || !"constant".equals(e.getValue()))
- return null;
- e = (QueryElement) stack.get(2);
- if (!"RELOP".equals(e.getRole())
- || !"EQ".equals(e.getValue()))
- return null;
- e = (QueryElement) stack.get(1);
- if (!"LITERAL".equals(e.getRole()))
- return null;
- return e.getValue();
- }
-}</source>
-
- <p>Here, we first check to make sure there's exactly three
- elements, returning null if not. There's no need to go further.
- </p>
-
- <p>Assuming there's three elements, the code then checks the
- topmost element. For an expression <code>constant =
- <var>name</var></code>, the topmost element will have role
- <code>elemName</code> and value <code>constant</code>. If
- neither condition is true, we return null right away. No need
- to check further.
- </p>
-
- <p>If the topmost element checks out, we then check the
- bottommost element. For <code>constant =
- <var>name</var></code>, the bottom element is generated from
- the equals sign. It will have role <code>RELOP</code>
- (relational operator) and value <code>EQ</code>, meaning
- "equals".
- </p>
-
- <p>If it checks out, all we have to do is check the middle
- element. The infix expression <code>constant =
- <var>name</var></code> generates a postfix middle element of
- <var>name</var> as the value, with a role of
- <code>LITERAL</code>. We make sure it's <code>LITERAL</code>.
- If not, we're done; it's not a valid expression for our query
- handler.
- </p>
-
- <p>But if so, then the value of that query element is the name
- of the desired constant. So we return it, regardless of what
- it is.
- </p>
- </subsection>
-
- <subsection name='Checking for Acceptable MIME Types'>
- <p>Since all of our mathematical constants are strings, we'll
- say that the result MIME type of our products is
- <code>text/plain</code>. That means that any incoming
- <code>XMLQuery</code> must include any of the following MIME types:
- </p>
- <ol>
- <li><code>text/plain</code></li>
- <li><code>text/*</code></li>
- <li><code>*/*</code></li>
- </ol>
- <p>All of these match <code>text/plain</code>, which is the only
- product type we're capable of serving. (In your own product
- servers, you might have more complex logic; for example, you
- could write code to draw the numbers into an image file if the
- requested type is <code>image/jpeg</code> ... but I wouldn't
- want to.)
- </p>
- <p>To support this in our query handler, we'll write another
- utility method. It'll be called
- <code>isAcceptableType</code>, and it will take the
- <code>XMLQuery</code> and examine it to see what MIME types
- are acceptable to the caller. If it finds any of the ones in
- the above list, it will return <code>true</code>, and the
- caller can continue to process the query. If not, it will
- return <code>false</code>, and the query handler will stop
- processing and return the <code>XMLQuery</code> unadorned with
- any results.
- </p>
- <p>Here's the code:</p>
-
- <source>import java.util.Iterator;
-...
-public class ConstantHandler
- implements QueryHandler {
- ...
- private static boolean isAcceptableType(XMLQuery q) {
- List mimes = q.getMimeAccept();
- if (mimes.isEmpty()) return true;
- for (Iterator i = mimes.iterator(); i.hasNext();) {
- String type = (String) i.next();
- if ("text/plain".equals(type)
- || "text/*".equals(type)
- || "*/*".equals(type)) return true;
- }
- return false;
- }
-}</source>
-
- <p>Here, we check if the list of acceptable MIME types is empty.
- An empty list is the same as saying <code>*/*</code>, so that
- automatically says we've got an acceptable type. For a
- non-empty list, we go through each type one-by-one. If it's
- any of the strings <code>text/plain</code>,
- <code>text/*</code>, or <code>*/*</code>, then that's an
- acceptable type.
- </p>
-
- <p>However, if we get through the entire list and we don't find
- any type that the user wants that we can provide, we return
- <code>false</code>. The query handler will check for a
- <code>false</code> value and return early from handling the
- query, leaving the <code>XMLQuery</code> untouched.
- </p>
- </subsection>
-
- <subsection name='Inserting the Result'>
- <p>Assuming the query handler has found an acceptable MIME type,
- and has found a valid query and the name of the desired
- constant, it can lookup the constant in the
- <code>CONSTANTS</code> map. And assuming it finds a matching
- constant in that map, it can insert the value as a
- <code>Result</code> object.
- </p>
-
- <p>To insert the constant's value, we'll develop yet another
- utility method, this time called <code>insert</code>. This
- method will take the name of the constant, its value, and the
- <code>XMLQuery</code>. It will add a <code>Result</code>
- object to the <code>XMLQuery</code>. When the query handler
- returns this modified <code>XMLQuery</code> object, the
- framework will return it to the product client, which can then
- display the matching result.
- </p>
-
- <p><code>Result</code> objects can also have optional
- <code>Header</code> objects that serve as "column headings"
- for tabular like results. Our result isn't tabular, it's just
- a single value, but we'll add a heading anyway just to
- demonstrate how it's done. (You could argue that it's a
- one-by-one table, too!) The header's name will be the same as
- the constant's name; the data type will be <code>real</code>
- and the units will be <code>none</code>.
- </p>
-
- <p>Here's the code:</p>
-
- <source>import java.util.Collections;
-import jpl.eda.xmlquery.Header;
-import jpl.eda.xmlquery.Result;
-...
-public class ConstantHandler
- implements QueryHandler {
- ...
- private static void insert(String name,
- String value, XMLQuery q) {
- Header h = new Header(name, "real", "none");
- Result r = new Result(name, "text/plain",
- /*profileID*/null, /*resourceID*/null,
- Collections.singletonList(h),
- value, /*classified*/false, Result.INFINITE);
- q.getResults().add(r);
- }
-}</source>
-
- <p>In this method, we first create the header. Then we create
- the result; the result's ID (which differentiates it from
- other results in the same <code>XMLQuery</code> is just the
- name of the constant. Its MIME type is
- <code>text/plain</code>. We set the profile ID and resource
- ID fields to <code>null</code>, as recommended back in the <a
- href="/edm-query/tutorial/">XMLQuery Tutorial</a>. Then we
- add our sole header. Then we add the mathematical constant's
- value. Finally, this constant isn't classified, so we set the
- classified flag to <code>false</code>. Also, these
- mathematical constants should be valid forever, so we set the
- validity period to <code>Result.INFINITE</code>, a special
- value that means a never-ending validity period.
- </p>
- </subsection>
-
- <subsection name='Handling the Query'>
- <p>With all of these utility methods in hand, it's easy to
- handle the query now. The
- <code>jpl.eda.product.QueryHandler</code> interface
- specifies a single method that we must implement,
- <code>query</code>. This method accepts an
- <code>XMLQuery</code> object and returns an
- <code>XMLQuery</code> object. The returned one may or may
- not be adorned with matching results.
- </p>
-
- <p>Here's what we have to do:</p>
- <ol>
- <li>Get the constant name with <code>getConstantName</code>.
- If we get <code>null</code>, it means the query's not of
- the form <code>constant = <var>name</var></code>, so we
- ignore it.
- </li>
-
- <li>See if the user's willing to accept a
- <code>text/plain</code> MIME type. If not, we ignore this query.
- </li>
-
- <li>Find the constant in our <code>CONSTANTS</code> map. If
- it's not there, we ignore this query.
- </li>
-
- <li>Insert the constant's value into the <code>XMLQuery</code>.</li>
-
- <li>Returned the modified <code>XMLQuery</code>.</li>
- </ol>
-
- <p>The source:</p>
-
- <source>public class ConstantHandler
- implements QueryHandler {
- ...
- public XMLQuery query(XMLQuery q) {
- String name = getConstantName(q);
- if (name == null) return q;
- if (!isAcceptableType(q)) return q;
- String value = (String) CONSTANTS.get(name);
- if (value == null) return q;
- insert(name, value, q);
- return q;
- }
-}</source>
-
- </subsection>
-
- <subsection name='Complete Source Code'>
- <p>Here is the complete source file,
- <code>ConstantHandler.java</code>:</p>
-
- <source>import java.util.Collections;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import jpl.eda.product.QueryHandler;
-import jpl.eda.xmlquery.Header;
-import jpl.eda.xmlquery.Result;
-import jpl.eda.xmlquery.QueryElement;
-import jpl.eda.xmlquery.XMLQuery;
-
-public class ConstantHandler
- implements QueryHandler {
- private static final Map CONSTANTS = new ConcurrentHashMap();
- static {
- CONSTANTS.put("pi", "3.14159265...");
- CONSTANTS.put("e", "2.7182818285...");
- CONSTANTS.put("gamma", "0.577215664...");
- }
- private static String getConstantName(XMLQuery q) {
- List stack = q.getWhereElementSet();
- if (stack.size() != 3) return null;
- QueryElement e = (QueryElement) stack.get(0);
- if (!"elemName".equals(e.getRole())
- || !"constant".equals(e.getValue()))
- return null;
- e = (QueryElement) stack.get(2);
- if (!"RELOP".equals(e.getRole())
- || !"EQ".equals(e.getValue()))
- return null;
- e = (QueryElement) stack.get(1);
- if (!"LITERAL".equals(e.getRole()))
- return null;
- return e.getValue();
- }
- private static boolean isAcceptableType(XMLQuery q) {
- List mimes = q.getMimeAccept();
- if (mimes.isEmpty()) return true;
- for (Iterator i = mimes.iterator(); i.hasNext();) {
- String type = (String) i.next();
- if ("text/plain".equals(type)
- || "text/*".equals(type)
- || "*/*".equals(type)) return true;
- }
- return false;
- }
- private static void insert(String name,
- String value, XMLQuery q) {
- Header h = new Header(name, "real", "none");
- Result r = new Result(name, "text/plain",
- /*profileID*/null, /*resourceID*/null,
- Collections.singletonList(h),
- value, /*classified*/false, Result.INFINITE);
- q.getResults().add(r);
- }
- public XMLQuery query(XMLQuery q) {
- String name = getConstantName(q);
- if (name == null) return q;
- if (!isAcceptableType(q)) return q;
- String value = (String) CONSTANTS.get(name);
- if (value == null) return q;
- insert(name, value, q);
- return q;
- }
-}</source>
-
- <p>How should you go about compiling this and installing it in
- a product server? Read on!
- </p>
- </subsection>
- </section>
-
- <section name="Compiling the Code">
- <p>We'll compile this code using the J2SDK command-line tools,
- but if you're more comfortable with some kind of Integrated
- Development Environment (IDE), adjust as necessary.
- </p>
-
- <p>First, let's go back to the <code>$PS_HOME</code> directory
- we made earlier and make directories to hold both the source
- code and classes that we'll compile from it:
- </p>
-
- <source>% <b>cd $PS_HOME</b>
-% <b>mkdir classes src</b></source>
-
- <p>Then, create <code>$PS_HOME/src/ConstantHandler.java</code> using
- your favorite text editor (or by cutting and pasting the source
- from this page, or whatever). Finally, compile the file as follows:
- </p>
-
- <source>% <b>javac -extdirs lib \
- -d classes src/ConstantHandler.java</b>
-% ls -l classes
-total 4
--rw-r--r-- 1 kelly kelly 2524 25 Feb 15:46 ConstantHandler.class</source>
-
- <p>The <code>javac</code> command is the Java compiler. The
- <code>-extdirs lib</code> arguments tell the compiler where to
- find extension jars. In this case, the code references things
- defined in edm-query-2.0.2.jar and grid-product-3.0.3.jar.
- The <code>-d classes</code> tells where compiled classes
- should go.
- </p>
-
- <p>Next, make a jar file that contains your compiled class:</p>
-
- <source>% <b>jar -cf lib/my-handlers.jar \
- -C classes ConstantHandler.class</b>
-% <b>jar -tf lib/my-handlers.jar</b>
-META-INF/
-META-INF/MANIFEST.MF
-ConstantHandler.class</source>
-
- <p>We now have a new jar file of our own creation in the
- <code>$PS_HOME/lib</code> directory; this means that the
- product server will be able to find out new query handler.
- All we have to do now is tell our product server about it.
- </p>
- </section>
-
- <section name='Specfying the Query Handler'>
- <p>Query handlers aren't really <em>installed</em> into product
- servers. What you do is tell the product server what query
- handlers you want it to use by naming their classes. The
- product server will instantiate an object of each class and,
- as queries come in, it will delegate queries to each
- instantiated query handler.
- </p>
-
- <p>To tell a product server what query handlers to instantiate,
- you specify a system property called <code>handlers</code>.
- You set this property to a comma-separated list of class
- names. These should be fully-qualified class names (with
- package prefixes, if you used packages when making your query
- handlers), separated by commas. In this tutorial, we made
- just one query handler, and we didn't put it into a package,
- so we'll just use <code>ConstantHandler</code>.
- </p>
-
- <p>First, stop any product server you have running now by
- pressing CTRL+C (or whatever your interrupt key is) in the
- window that was running the product server. Next, modify the
- <code>$PS_HOME/bin/ps</code> file so it reads as follows:
- </p>
-
- <source>#!/bin/sh
-exec java -Djava.ext.dirs=$PS_HOME/lib \
- -Dhandlers=ConstantHandler \
- jpl.eda.ExecServer \
- jpl.eda.product.rmi.ProductServiceImpl \
- urn:eda:rmi:MyProductService</source>
-
- <p>We specified a system property on the command line using
- Java's <code>-D</code> option. This defines the system
- property <code>handlers</code> as having the value
- <code>ConstantHandler</code>. Finally, start the product
- server again by running <code>$PS_HOME/bin/ps</code>.
- </p>
- </section>
-
- <section name='Querying for Constants'>
- <p>Once again, edit the <code>$PS_HOME/bin/pc</code> script and
- change <code>-xml</code> back to <code>-out</code> so that
- instead of the XML output we'll see the raw product data.
- Then run it and see what happens:
- </p>
-
- <source>% <b>$PS_HOME/bin/pc 'constant = pi'</b>
-3.14159265...% </source>
-
- <p>Because the raw product data was the string
- <code>3.14159265...</code> without any trailing newline, the
- shell's prompt appeared right at the end of the product
- result. You might try piping the output of the above command
- through a pager like <code>more</code> or <code>less</code> to
- avoid this.
- </p>
-
- <p>Here's what happened when we ran this command:</p>
-
- <ol>
- <li>The product client created an <code>XMLQuery</code> object
- out of the string query <code>constant = pi</code>.
- </li>
-
- <li>It asked the RMI Registry to tell it where (network
- address) it could find the product service named
- <code>MyProductService</code>.
- </li>
-
- <li>After getting the response back from the RMI Registry, it
- then contacted the product service over a network connection
- (even if to the same local system) and asked it to handle
- the query, passing the query object.
- </li>
-
- <li>The product service had only one query handler, the
- <code>ConstantHandler</code>, to which to delegate, so it
- passed the XMLQuery to it.
- </li>
-
- <li>The <code>ConstantHandler</code>'s <code>query</code>
- method was called. It checked if the query was the kind it
- wanted, extracted the desired mathematical constant's name,
- checked for an acceptable requested MIME type, looked up the
- constant's value, inserted it as a <code>Result</code> into
- the <code>XMLQuery</code>, and returned the modified query.
- </li>
-
- <li>The product service, seeing it had no other handlers to
- try, returned the modified <code>XMLQuery</code> to the
- product client over the network connection.
- </li>
-
- <li>The product client took the first <code>Result</code> out
- of the <code>XMLQuery</code>, called
- <code>Result.getInputStream</code>, and copied each byte of
- the result to the standard output. This wrote
- <code>3.14159265...</code> to your window.
- </li>
- </ol>
-
- <p>If you change the <code>$PS_HOME/bin/pc</code> script again
- so that instead of <code>-out</code> it's <code>-xml</code>,
- you'll again see the XMLQuery as an XML document. The interesting part is the <code><queryResultSet></code>:
- </p>
-
- <source><![CDATA[<queryResultSet>
- <resultElement classified="false" validity="-1">
- <resultId>pi</resultId>
- <resultMimeType>text/plain</resultMimeType>
- <profId/>
- <identifier/>
- <resultHeader>
- <headerElement>
- <elemName>pi</elemName>
- <elemType>real</elemType>
- <elemUnit>none</elemUnit>
- </headerElement>
- </resultHeader>
- <resultValue xml:space="preserve">3.14159265...</resultValue>
- </resultElement>
-</queryResultSet>]]></source>
-
- <p>I'll let you figure out how this maps to the
- <code>Result</code> object we created in the code. OK, so is
- this really interesting? Not really, except to note that the
- actual result data, <code>3.1415265...</code>, appears in the
- XML document. In the OODT framework, we call this a "small"
- result, because the product data was embedded in the XMLQuery
- object. Text data like <code>text/plain</code> products
- appear just as text. Binary data like <code>image/jpeg</code>
- and <code>application/octet-stream</code> get base-64 encoded
- into text.
- </p>
- <p>As you can guess, there's a point at which encoded data goes
- from being nice and small and tidy to just too large to
- contain in a single object. In the OODT framework, we can use
- a special query handler for such large products, but that's
- another tutorial.
- </p>
- </section>
-
- <section name='Conclusion'>
- <p>In this tutorial, we learned how to write a complete query
- handler for a product server, including handling of postfix
- boolean "where" stacks, lists of acceptable MIME types, and
- result headers. We compiled the query handler, put it into a
- jar file, and specified it to our product server. And we
- could even query it and get data back.
- </p>
-
- <p>Don't toss out this product server yet, though. Another
- tutorial will use it and cover the infamous
- <code>LargeProductQueryHandler</code>.
- </p>
- </section>
- </body>
-</document>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/test/org/apache/oodt/product/handlers/ofsn/util/OFSNUtilsTest.java
----------------------------------------------------------------------
diff --git a/product/src/test/org/apache/oodt/product/handlers/ofsn/util/OFSNUtilsTest.java b/product/src/test/org/apache/oodt/product/handlers/ofsn/util/OFSNUtilsTest.java
deleted file mode 100644
index 31a4494..0000000
--- a/product/src/test/org/apache/oodt/product/handlers/ofsn/util/OFSNUtilsTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.product.handlers.ofsn.util;
-
-import junit.framework.TestCase;
-/*
- * 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.
- */
-
-import java.util.Collections;
-
-/**
- * Unit test for {@link OFSNUtils}.
- *
- * @author riverma
- */
-public class OFSNUtilsTest extends TestCase {
- public OFSNUtilsTest(String id) {
- super(id);
- }
-
- public void testValidateOFSN() {
-
- assertTrue(OFSNUtils.validateOFSN("/dataset/dir1"));
- assertTrue(OFSNUtils.validateOFSN("/dataset/dir1/"));
- assertTrue(OFSNUtils.validateOFSN("/dataset/dir1/file1.h5"));
- assertFalse(OFSNUtils.validateOFSN("/dataset/../../../../../../etc/passwd"));
-
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/test/org/apache/oodt/xmlquery/ChunkedProductInputStreamTest.java
----------------------------------------------------------------------
diff --git a/product/src/test/org/apache/oodt/xmlquery/ChunkedProductInputStreamTest.java b/product/src/test/org/apache/oodt/xmlquery/ChunkedProductInputStreamTest.java
deleted file mode 100644
index 9ab531a..0000000
--- a/product/src/test/org/apache/oodt/xmlquery/ChunkedProductInputStreamTest.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.xmlquery;
-
-import java.io.IOException;
-import java.util.Arrays;
-import org.apache.oodt.product.ProductException;
-import org.apache.oodt.product.Retriever;
-import junit.framework.TestCase;
-import java.io.ByteArrayOutputStream;
-
-/**
- * Unit test for <code>ChunkedProductInputStream</code>.
- *
- * @author Kelly
- * @version $Revision: 1.5 $
- */
-public class ChunkedProductInputStreamTest extends TestCase implements Retriever {
- /**
- * Creates a new <code>ChunkedProductInputStreamTest</code> instance.
- *
- * @param id Case name.
- */
- public ChunkedProductInputStreamTest(String id) {
- super(id);
- }
-
- public void setUp() throws Exception {
- super.setUp();
- data = new byte[4096];
- for (int i = 0; i < 4096; ++i)
- data[i] = (byte) (i % 256);
- }
-
- /**
- * Test reading a single byte at a time.
- *
- * @throws IOException if an error occurs.
- */
- public void testByteReading() throws IOException {
- ChunkedProductInputStream in = new ChunkedProductInputStream("test", this, 4096);
- for (int i = 0; i < 4096; ++i)
- assertEquals(toByte(i % 256), toByte(in.read() & 0xff));
- assertEquals(-1, in.read());
- in.close();
- }
-
- public void testArrayReading() throws IOException {
- ChunkedProductInputStream in = new ChunkedProductInputStream("test", this, 4096);
- ByteArrayOutputStream out = new ByteArrayOutputStream(4096);
- byte[] buf = new byte[256];
- int num;
- while ((num = in.read(buf)) != -1)
- out.write(buf, 0, num);
- in.close();
- out.close();
- assertTrue(Arrays.equals(data, out.toByteArray()));
- }
-
- /**
- * Test reading and skipping by various amounts.
- *
- * @throws IOException if an error occurs.
- */
- public void testReadingAndSkipping() throws IOException {
- ChunkedProductInputStream in = new ChunkedProductInputStream("test", this, 4096);
-
- byte[] buf = new byte[4]; // Byte number:
- assertEquals(0, in.read()); // 0
- assertEquals(0, in.skip(0)); // 0
- assertEquals(4, in.read(buf)); // 1, 2, 3, 4
- assertEquals(toByte(1), buf[0]);
- assertEquals(toByte(2), buf[1]);
- assertEquals(toByte(3), buf[2]);
- assertEquals(toByte(4), buf[3]);
- assertEquals(toByte(5), toByte(in.read())); // 5
- assertEquals(4, in.skip(4)); // 6, 7, 8, 9
- assertEquals(toByte(10), toByte(in.read())); // 10
- assertEquals(1000, in.skip(1000)); // 11, 12, ..., 1010
- assertEquals(toByte(1011 % 256), toByte(in.read())); // 1011
-
- buf = new byte[1000];
- int toRead = 1000;
- int index = 0;
- while (toRead > 0) { // 1012, 1013, ..., 2011
- int numRead = in.read(buf, index, toRead);
- if (numRead == -1)
- fail("Premature EOF");
- toRead -= numRead;
- index += numRead;
- }
- for (int i = 0; i < buf.length; ++i)
- assertEquals(data[i + 1012], buf[i]);
-
- assertEquals(2, in.read(buf, 1, 2)); // 2012, 2013
- assertEquals(toByte(1012 % 256), buf[0]);
- assertEquals(toByte(2012 % 256), buf[1]);
- assertEquals(toByte(2013 % 256), buf[2]);
- assertEquals(toByte(1015 % 256), buf[3]);
-
- assertEquals(2082, in.skip(2083)); // 2014, 2015, ..., 4095
- // Shouldn't we get the -1 read first, and THEN get an IOException on subsequent reads?
- try {
- assertEquals(-1, in.read());
- } catch (IOException ignore) {}
- in.close();
- }
-
- /**
- * Test reading into larger and larger arrays.
- *
- * @throws IOException if an error occurs.
- */
- public void testWideningWindows() throws IOException {
- // Scary; this test hangs on Windows. We really should investigate why as
- // it could bite us on the bum in the future.
- if (System.getProperty("os.name", "unknown").indexOf("Windows") != -1) return;
-
- byte[] read = new byte[4096];
- for (int size = 1; size <= 4096; size *= 2) {
- byte[] buf = new byte[size];
- ChunkedProductInputStream in = new ChunkedProductInputStream("test", this, 4096);
- ByteArrayOutputStream out = new ByteArrayOutputStream(4096);
- int num;
- while ((num = in.read(buf)) != -1)
- out.write(buf, 0, num);
- in.close();
- out.close();
- assertTrue(Arrays.equals(data, out.toByteArray()));
- }
- }
-
- public byte[] retrieveChunk(String id, long offset, int length) {
- if (!id.equals("test"))
- throw new IllegalArgumentException("Unknown id " + id);
- if (offset < 0 || offset > 4096 || length < 0 ||
- (offset + length) > 4096 || (offset + length) < 0)
- throw new IllegalArgumentException("Bad offset and/or length");
-
- int index = (int) offset;
- byte[] sub = new byte[length];
- System.arraycopy(data, index, sub, 0, length);
- return sub;
- }
-
- private static byte toByte(int b) {
- return (byte) (b & 0xff);
- }
-
- public void close(String id) {}
-
- /** Test data. */
- private byte[] data;
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/test/org/apache/oodt/xmlquery/LargeResultTest.java
----------------------------------------------------------------------
diff --git a/product/src/test/org/apache/oodt/xmlquery/LargeResultTest.java b/product/src/test/org/apache/oodt/xmlquery/LargeResultTest.java
deleted file mode 100644
index ff3679b..0000000
--- a/product/src/test/org/apache/oodt/xmlquery/LargeResultTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.xmlquery;
-
-import junit.framework.TestCase;
-import java.util.Collections;
-
-/**
- * Unit test for {@link LargeResult}.
- *
- * @author Kelly
- * @version $Revision: 1.2 $
- */
-public class LargeResultTest extends TestCase {
- public LargeResultTest(String id) {
- super(id);
- }
-
- public void testLargeResults() {
- LargeResult lr1 = new LargeResult("1.2.3", "text/plain", "JPL.Profile", "JPL.Resource", Collections.EMPTY_LIST, 1);
- assertEquals("1.2.3", lr1.getID());
- assertEquals("text/plain", lr1.getMimeType());
- assertEquals("JPL.Profile", lr1.getProfileID());
- assertEquals("JPL.Resource", lr1.getResourceID());
- assertEquals(1, lr1.getSize());
- assertTrue(lr1.getHeaders().isEmpty());
-
- Result r = new Result("2.3.4", "application/vnd.jpl.large-product", "JPL.Profile", "JPL.Resource",
- Collections.EMPTY_LIST, "text/plain 2");
- LargeResult lr2 = new LargeResult(r);
- assertEquals("text/plain", lr2.getMimeType());
- assertEquals(2, lr2.getSize());
-
- LargeResult lr3 = new LargeResult(lr2);
- assertEquals("text/plain", lr2.getMimeType());
- assertEquals(2, lr3.getSize());
- }
-}
[08/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/DirStructXmlParser.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/DirStructXmlParser.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/DirStructXmlParser.java
deleted file mode 100644
index d89936e..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/DirStructXmlParser.java
+++ /dev/null
@@ -1,346 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.filerestrictions.parsers;
-
-import org.apache.oodt.cas.metadata.Metadata;
-import org.apache.oodt.cas.metadata.exceptions.CasMetadataException;
-import org.apache.oodt.cas.metadata.util.PathUtils;
-import org.apache.oodt.cas.pushpull.exceptions.ParserException;
-import org.apache.oodt.cas.pushpull.expressions.GlobalVariables;
-import org.apache.oodt.cas.pushpull.expressions.Method;
-import org.apache.oodt.cas.pushpull.expressions.Variable;
-import org.apache.oodt.cas.pushpull.filerestrictions.Parser;
-import org.apache.oodt.cas.pushpull.filerestrictions.VirtualFile;
-import org.apache.oodt.cas.pushpull.filerestrictions.VirtualFileStructure;
-import org.apache.oodt.commons.exceptions.CommonsException;
-import org.apache.oodt.commons.xml.XMLUtils;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource;
-
-import java.io.FileInputStream;
-import java.text.ParseException;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.StringTokenizer;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.xml.parsers.DocumentBuilderFactory;
-
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class DirStructXmlParser implements Parser {
-
- private static final Logger LOG = Logger.getLogger(DirStructXmlParser.class
- .getName());
-
- private static final ConcurrentHashMap<String, Method> methodRepo = new ConcurrentHashMap<String, Method>();
-
- public DirStructXmlParser() {}
-
- public VirtualFileStructure parse(FileInputStream xmlFile, Metadata metadata)
- throws ParserException {
- try {
- String initialCdDir = "/";
- VirtualFile root = null;
- NodeList list = (DocumentBuilderFactory.newInstance()
- .newDocumentBuilder().parse(new InputSource(xmlFile)))
- .getDocumentElement().getChildNodes();
- VirtualFile currentFile;
- for (int i = 0; i < list.getLength(); i++) {
- Node node = list.item(i);
- if (node.getNodeName().equals("dirstruct")) {
-
- // parse out starting path
- String startingPath = ((Element) node)
- .getAttribute("starting_path");
- root = (currentFile = new VirtualFile(
- initialCdDir = startingPath, true))
- .getRootDir();
- VirtualFile temp = currentFile.getParentFile();
- while (temp != null) {
- temp.setNoDirs(true);
- temp.setNoFiles(true);
- temp = temp.getParentFile();
- }
- // parse the directory structure
- parseDirstructXML(node.getChildNodes(), currentFile);
-
- } else if (node.getNodeName().equals("variables")) {
- parseVariablesXML(node.getChildNodes());
- } else if (node.getNodeName().equals("methods")) {
- parseMethodsXML(node.getChildNodes());
- }
- }
- return new VirtualFileStructure(initialCdDir, root);
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- throw new ParserException("Failed to parse XML file : "
- + e.getMessage());
- }
- }
-
- private void parseDirstructXML(NodeList list, VirtualFile currentLoadFile) {
- for (int i = 0; i < list.getLength(); i++) {
- Node dir = list.item(i);
- if (dir.getNodeName().equals("dir")) {
- String dirName = replaceVariablesAndMethods(((Element) dir)
- .getAttribute("name"));
- currentLoadFile.addChild(new VirtualFile(dirName, true));
- NodeList children;
- if ((children = dir.getChildNodes()).getLength() > 0) {
- parseDirstructXML(children, currentLoadFile.getChild(
- dirName, true));
- }
- } else if (dir.getNodeName().equals("nodirs")) {
- currentLoadFile.setNoDirs(true);
- } else if (dir.getNodeName().equals("nofiles")) {
- currentLoadFile.setNoFiles(true);
- } else if (dir.getNodeName().equals("file")) {
- VirtualFile vf = new VirtualFile(
- replaceVariablesAndMethods(((Element) dir)
- .getAttribute("name")), false);
- vf.setNoDirs(true);
- currentLoadFile.addChild(vf);
- }
- }
- }
-
- private String replaceVariablesAndMethods(String input) {
- for (int i = 0; i < input.length(); i++) {
- char c = input.charAt(i);
- switch (c) {
- case '$':
- try {
- if (input.charAt(i + 1) == '{') {
- StringBuilder variable = new StringBuilder("");
- for (int j = i + 2; j < input.length(); j++) {
- char ch = input.charAt(j);
- if ((ch <= 'Z' && ch >= 'A')
- || (ch <= 'z' && ch >= 'a')
- || (ch <= '9' && ch >= '0')
- || ch == '_') {
- variable.append(ch);
- } else {
- break;
- }
- }
- Variable v = GlobalVariables.ConcurrentHashMap.get(variable
- .toString());
- if (v == null) {
- throw new Exception("No variable defined with name '" + variable.toString() + "'");
- }
- input = input.replaceFirst("\\$\\{" + variable + "\\}", v.toString());
- i = i + v.toString().length();
- }
- } catch (Exception e) {
- LOG.log(Level.WARNING, "Failed to replace variable in '" + input + " for i = '" + i + "' : " + e.getMessage(), e);
- }
- break;
- case '%':
- try {
- StringBuilder method = new StringBuilder("");
- int j = i + 1;
- for (; j < input.length(); j++) {
- char ch = input.substring(j, j + 1).charAt(0);
- if ((ch <= 'Z' && ch >= 'A')
- || (ch <= 'z' && ch >= 'a')
- || (ch <= '9' && ch >= '0') || ch == '_') {
- method.append(ch);
- } else {
- break;
- }
- }
-
- if (input.substring(j, j + 1).charAt(0) == '(') {
- Method m = methodRepo.get(method.toString());
- StringTokenizer st = new StringTokenizer(input
- .substring(j, input.substring(j).indexOf(")")
- + j), "#\", ()");
- while (st.hasMoreTokens()) {
- String arg = st.nextToken();
- m.addArg(null, arg);
- }
- String returnValue = m.execute().toString();
- input = input.substring(0, i)
- + returnValue
- + input.substring(input.substring(i).indexOf(
- ")")
- + 1 + i);
- i = i + returnValue.length();
- } else {
- LOG.log(Level.SEVERE, "Invalid method signature in "
- + input + " near " + method);
- break;
- }
- } catch (Exception ignored) {
- }
- break;
- }
- }
- return input;
- }
-
- private void parseVariablesXML(NodeList list) throws ParseException, CommonsException, CasMetadataException {
-
- // loop through all variable elements
- for (int i = 0; i < list.getLength(); i++) {
- Node node = list.item(i);
-
- // parse variable element
- if (node.getNodeName().equals("variable")) {
- NodeList children = node.getChildNodes();
-
- // create Variable Object
- String variableName = ((Element) node).getAttribute("name");
- Variable variable = new Variable(variableName);
-
- // loop through to fill Variable
- String type = null, value = null;
- for (int j = 0; j < children.getLength(); j++) {
- Node child = children.item(j);
-
- // get the Variable's name
- if (child.getNodeName().equals("type")) {
- type = XMLUtils.getSimpleElementText((Element) child,
- true).toLowerCase();
-
- // get the Variable's value
- } else if (child.getNodeName().equals("value")) {
- value = PathUtils.doDynamicReplacement(XMLUtils
- .getSimpleElementText((Element) child, false));
-
- // get the Variable's value's precision infomation
- } else if (child.getNodeName().equals("precision")) {
- NodeList grandChildren = child.getChildNodes();
- for (int k = 0; k < grandChildren.getLength(); k++) {
- Node grandChild = grandChildren.item(k);
- // get the precision
- if (grandChild.getNodeName().equals("locations")) {
- variable.setPrecision(Integer.parseInt(XMLUtils
- .getSimpleElementText((Element) grandChild, true)));
- // get the fill character to meet the precision
- // [optional]
- } else if (grandChild.getNodeName().equals("fill")) {
- variable.setFillString(
- XMLUtils.getSimpleElementText((Element) grandChild, false));
- // get the side for which the fill character
- // will be applied [optional]
- } else if (grandChild.getNodeName().equals("side")) {
- variable.setFillSide(
- (XMLUtils.getSimpleElementText((Element) grandChild, true)
- .toLowerCase().equals("front"))
- ? variable.FILL_FRONT
- : variable.FILL_BACK);
- }
- }
- }
- }
- // determine if variable is an Integer or a String
- if (type.equals("int")) {
- variable.setValue(Integer.valueOf(value));
- } else {
- variable.setValue(value);
- }
-
- // store Variable in list of Variables
- GlobalVariables.ConcurrentHashMap.put(variable.getName(), variable);
- }
- }
- }
-
- private void parseMethodsXML(NodeList list) {
-
- // loop though all method elements
- for (int i = 0; i < list.getLength(); i++) {
- Node node = list.item(i);
- // parse method element
- if (node.getNodeName().equals("method")) {
- NodeList children = node.getChildNodes();
-
- // create Method Object
- String methodName = ((Element) node).getAttribute("name");
- Method method = new Method(methodName);
-
- // loop through to fill Method Object
- for (int j = 0; j < children.getLength(); j++) {
- Node child = children.item(j);
-
- // get the Method's behavoir
- if (child.getNodeName().equals("action")) {
- method.setBehavoir(XMLUtils.getSimpleElementText(
- (Element) child, false));
-
- // get the Method's arguments
- } else if (child.getNodeName().equals("args")) {
- String name, argType = null;
- NodeList grandChildren = child.getChildNodes();
-
- // loop for every arg element
- for (int k = 0; k < grandChildren.getLength(); k++) {
- Node grandChild = grandChildren.item(k);
-
- // parse arg element
- if (grandChild.getNodeName().equals("arg")) {
- name = ((Element) grandChild)
- .getAttribute("name");
-
- // get arg element properties
- NodeList greatGrandChildren = grandChild
- .getChildNodes();
- for (int l = 0; l < greatGrandChildren
- .getLength(); l++) {
- Node greatGrandChild = greatGrandChildren
- .item(l);
- if (greatGrandChild.getNodeName().equals(
- "type")) {
- argType = XMLUtils.getSimpleElementText(
- (Element) greatGrandChild,
- true);
- }
- }
-
- // create argument signature in Method
- method
- .addArgSignature(
- name,
- ((argType.toLowerCase()
- .equals("int")) ? method.INT
- : method.STRING));
- }
- }
- }
- }
-
- // store Method in list of Methods
- methodRepo.put(method.getName(), method);
- }
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/FileListParser.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/FileListParser.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/FileListParser.java
deleted file mode 100644
index d540cf0..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/FileListParser.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.filerestrictions.parsers;
-
-//JDK imports
-import java.io.FileInputStream;
-import java.util.Scanner;
-
-
-import org.apache.oodt.cas.metadata.Metadata;
-//OODT imports
-import org.apache.oodt.cas.pushpull.exceptions.ParserException;
-import org.apache.oodt.cas.pushpull.filerestrictions.Parser;
-import org.apache.oodt.cas.pushpull.filerestrictions.VirtualFile;
-import org.apache.oodt.cas.pushpull.filerestrictions.VirtualFileStructure;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>Describe your class here</p>.
- */
-public class FileListParser implements Parser {
-
- public FileListParser() {}
-
- public VirtualFileStructure parse(FileInputStream inputFile, Metadata metadata)
- throws ParserException {
- Scanner scanner = new Scanner(inputFile);
- VirtualFile root = VirtualFile.createRootDir();
- String initialCdDir = "/";
- if (scanner.hasNextLine()) {
- initialCdDir = scanner.nextLine();
- while (scanner.hasNextLine()) {
- new VirtualFile(root, initialCdDir + "/" + scanner.nextLine(),
- false);
- }
- }
- return new VirtualFileStructure(initialCdDir, root);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/GenericEmailParser.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/GenericEmailParser.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/GenericEmailParser.java
deleted file mode 100644
index 3f74407..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/GenericEmailParser.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.pushpull.filerestrictions.parsers;
-
-//OODT imports
-import org.apache.oodt.cas.metadata.Metadata;
-import org.apache.oodt.cas.pushpull.filerestrictions.Parser;
-import org.apache.oodt.cas.pushpull.filerestrictions.VirtualFile;
-import org.apache.oodt.cas.pushpull.filerestrictions.VirtualFileStructure;
-import org.apache.oodt.cas.pushpull.exceptions.ParserException;
-
-//Google imports
-import com.google.common.base.Splitter;
-import com.google.common.base.Strings;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-
-//JDK imports
-import java.io.FileInputStream;
-import java.util.List;
-import java.util.Scanner;
-import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * A generic email parser which generates file paths to be downloaded by using a defined java
- * Pattern. The pattern should specify pattern groups for file paths in the matching pattern.
- * These groups will then be extracted and added to the file structure.
- *
- * @author bfoster@apache.org (Brian Foster)
- */
-public class GenericEmailParser implements Parser {
-
- private static final Logger log = Logger.getLogger(GenericEmailParser.class.getCanonicalName());
-
- public static final String FILE_PATTERNS_PROPERTY_NAME =
- "org.apache.oodt.cas.pushpull.generic.email.parser.file.pattern";
- public static final String CHECK_FOR_PATTERN_PROPERTY_NAME =
- "org.apache.oodt.cas.pushpull.generic.email.parser.check.for.pattern";
- public static final String PATH_TO_ROOT_PROPERTY_NAME =
- "org.apache.oodt.cas.pushpull.generic.email.parser.path.to.root";
- public static final String METADATA_KEYS =
- "org.apache.oodt.cas.pushpull.generic.email.parser.metadata.keys";
- public static final String METADATA_KEY_PREFIX =
- "org.apache.oodt.cas.pushpull.generic.email.parser.metadata.";
-
- private final String filePattern;
- private final String checkForPattern;
- private final String pathToRoot;
-
- public GenericEmailParser() {
- filePattern = loadFilePattern();
- checkForPattern = loadCheckForPattern();
- pathToRoot = loadPathToRoot();
- }
-
- public GenericEmailParser(String filePattern, String checkForPattern, String pathToRoot) {
- this.filePattern = filePattern;
- this.checkForPattern = checkForPattern;
- this.pathToRoot = Strings.nullToEmpty(pathToRoot);
- }
-
- @Override
- public VirtualFileStructure parse(FileInputStream emailFile, Metadata metadata)
- throws ParserException {
- log.info("GenericEmailParser is parsing email: " + emailFile);
-
- VirtualFile root = VirtualFile.createRootDir();
-
- String emailText = readEmail(emailFile);
- if (!isValidEmail(emailText)) {
- throw new ParserException("Failed to find check for pattern in email: " + checkForPattern);
- }
- List<String> filePaths = generateFilePaths(emailText);
- readMetadata(emailText, metadata);
-
- for (String filePath : filePaths) {
- new VirtualFile(root, pathToRoot + filePath, false);
- }
-
- return new VirtualFileStructure("/", root);
- }
-
- private String readEmail(FileInputStream emailFile) {
- StringBuilder emailText = new StringBuilder("");
- Scanner scanner = new Scanner(emailFile);
- while (scanner.hasNextLine()) {
- emailText.append(scanner.nextLine()).append("\n");
- }
- scanner.close();
- return emailText.toString();
- }
-
- private List<String> generateFilePaths(String emailText) {
- List<String> filePaths = Lists.newArrayList();
- Pattern pattern = Pattern.compile(filePattern);
- Matcher m = pattern.matcher(emailText);
- if (m.find()) {
- // Ignore index 0, as that is the matching string for pattern.
- for (int i = 1; i <= m.groupCount(); i++) {
- filePaths.add(m.group(i));
- }
- }
- return filePaths;
- }
-
- private void readMetadata(String emailText, Metadata metadata) {
- Set<String> metadataKeys = loadMetadataKeys();
- for (String metadataKey : metadataKeys) {
- String metadataPattern = loadMetadataKey(metadataKey);
- if (metadataPattern == null) {
- log.log(Level.SEVERE, "Failed to load metadata pattern for key: " + metadataKey);
- } else {
- Pattern pattern = Pattern.compile(metadataPattern);
- Matcher m = pattern.matcher(emailText);
- if (m.find()) {
- // Ignore index 0, as that is the matching string for pattern.
- String metadatValue = m.group(1);
- metadata.replaceMetadata(metadataKey, metadatValue);
- }
- }
- }
- }
-
- private boolean isValidEmail(String emailText) {
- Pattern pattern = Pattern.compile(checkForPattern);
- Matcher m = pattern.matcher(emailText.replaceAll("\n", " "));
- return m.find();
- }
-
- private String loadFilePattern() {
- return System.getProperty(FILE_PATTERNS_PROPERTY_NAME);
- }
-
- private String loadCheckForPattern() {
- return System.getProperty(CHECK_FOR_PATTERN_PROPERTY_NAME);
- }
-
- private String loadPathToRoot() {
- return Strings.nullToEmpty(System.getProperty(PATH_TO_ROOT_PROPERTY_NAME));
- }
-
- private Set<String> loadMetadataKeys() {
- return Sets.newHashSet(Splitter.on(",").omitEmptyStrings().split(
- Strings.nullToEmpty(System.getProperty(METADATA_KEYS))));
- }
-
- private String loadMetadataKey(String key) {
- return System.getProperty(METADATA_KEY_PREFIX + key);
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/renamingconventions/RenamingConvention.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/renamingconventions/RenamingConvention.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/renamingconventions/RenamingConvention.java
deleted file mode 100644
index 753e09c..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/renamingconventions/RenamingConvention.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.pushpull.filerestrictions.renamingconventions;
-
-//JDK imports
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-//OODT imports
-import org.apache.oodt.cas.metadata.util.PathUtils;
-import org.apache.oodt.cas.pushpull.retrievalsystem.RemoteFile;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class RenamingConvention {
-
- private static Logger LOG = Logger.getLogger(RenamingConvention.class.getName());
-
- private RenamingConvention() throws InstantiationException {
- throw new InstantiationException("Don't construct RenamingConventions!");
- }
-
- /**
- * Generates a unique file name for the given ProtocolFile
- *
- * @param fileToGenNewNameFor
- * The file for which a unique name will be generated
- * @return The unique file name (just the name).
- */
- public static String rename(RemoteFile fileToGenNewNameFor,
- String renamingString) {
- try {
- renamingString = grepReplace(renamingString, fileToGenNewNameFor);
- renamingString = grepRemoveReplace(renamingString, fileToGenNewNameFor);
- renamingString = replace(renamingString, "[FILENAME]",
- fileToGenNewNameFor.getProtocolFile().getName());
- renamingString = replace(renamingString, "[PATH_NO_FILENAME]",
- getParentPath(fileToGenNewNameFor));
- renamingString = replace(renamingString, "[HOST]", fileToGenNewNameFor
- .getProtocolFile().getSite().getURL().getHost());
- renamingString = replace(renamingString, "[PARENT_FILENAME]",
- getParentFileName(fileToGenNewNameFor));
- renamingString = replace(renamingString, "[PARENT_PATH_NO_FILENAME]",
- getGrandParentPath(fileToGenNewNameFor));
- renamingString = replace(renamingString, "[URL]", fileToGenNewNameFor
- .getProtocolFile().getSite().getURL().toExternalForm());
- renamingString = replace(renamingString, "[IS_DIR]", String
- .valueOf(fileToGenNewNameFor.getProtocolFile().isDir()));
- renamingString = PathUtils.doDynamicReplacement(
- renamingString, fileToGenNewNameFor.getAllMetadata());
- }catch (Exception e) {
- LOG.log(Level.WARNING, "Failed to rename " + fileToGenNewNameFor
- + " : " + e.getMessage());
- }
- return renamingString;
- }
-
- private static String grepReplace(String theString, RemoteFile fileToGenNewNameFor) {
- Pattern grepPattern = Pattern.compile("\\[GREP\\(.*\\,.*\\)\\]");
- Matcher grepMatcher = grepPattern.matcher(theString);
- while (grepMatcher.find()) {
- String origGrepString = theString.substring(grepMatcher.start(),
- grepMatcher.end()).trim();
- String grepString = origGrepString.replace("[GREP('", "").replace(
- "')]", "").trim();
- String[] grepStringSplit = grepString.split("','");
- String pattern = grepStringSplit[0];
- String string = rename(fileToGenNewNameFor, grepStringSplit[1]);
- Pattern p = Pattern.compile(pattern);
- Matcher m = p.matcher(string);
- if (m.find()) {
- theString = theString.replace(origGrepString, string.substring(
- m.start(), m.end()));
- } else {
- theString = theString.replace(origGrepString, "null");
- }
- }
- return theString;
- }
-
- private static String grepRemoveReplace(String theString, RemoteFile fileToGenNewNameFor) {
- Pattern grepPattern = Pattern.compile("\\[GREP_RM\\(.*,.*\\)\\]");
- Matcher grepMatcher = grepPattern.matcher(theString);
- while (grepMatcher.find()) {
- String origGrepString = theString.substring(grepMatcher.start(),
- grepMatcher.end()).trim();
- String grepString = origGrepString.replace("[GREP_RM('", "")
- .replace("')]", "").trim();
- String[] grepStringSplit = grepString.split("','");
- String pattern = grepStringSplit[0];
- String string = rename(fileToGenNewNameFor, grepStringSplit[1]);
- System.out.println("PAT_STR: " + pattern + " " + string);
- Pattern p = Pattern.compile(pattern);
- Matcher m = p.matcher(string);
- if (m.find()) {
- theString = theString.replace(origGrepString, string.replace(
- string.substring(m.start(), m.end()), ""));
- } else {
- theString = theString.replace(origGrepString, "null");
- }
- }
- return theString;
- }
-
- private static String replace(String theString,
- String theValueToBeReplaced, String whatToReplaceWith) {
- if (theValueToBeReplaced == null || theValueToBeReplaced.equals("")) {
- return theString;
- }
- if (whatToReplaceWith == null) {
- whatToReplaceWith = "";
- }
- return theString.replace(theValueToBeReplaced, whatToReplaceWith);
- }
-
- private static String getParentPath(RemoteFile fileToGenNewNameFor) {
- String parentPath = "";
- try {
- parentPath = fileToGenNewNameFor.getProtocolFile().getParent().getPath();
- } catch (Exception ignored) {
- }
- return parentPath;
- }
-
- private static String getParentFileName(RemoteFile fileToGenNewNameFor) {
- String parentFileName = "";
- try {
- parentFileName = fileToGenNewNameFor.getProtocolFile().getParent().getName();
- } catch (Exception ignored) {
- }
- return parentFileName;
- }
-
- private static String getGrandParentPath(RemoteFile fileToGenNewNameFor) {
- String grandParentPath = "";
- try {
- grandParentPath = fileToGenNewNameFor.getProtocolFile().getParent()
- .getParent().getPath();
- } catch (Exception ignored) {
- }
- return grandParentPath;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/objectfactory/PushPullObjectFactory.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/objectfactory/PushPullObjectFactory.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/objectfactory/PushPullObjectFactory.java
deleted file mode 100644
index 2e9d9af..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/objectfactory/PushPullObjectFactory.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.objectfactory;
-
-//OODT imports
-import org.apache.oodt.cas.filemgr.ingest.Cache;
-import org.apache.oodt.cas.filemgr.ingest.CacheFactory;
-import org.apache.oodt.cas.filemgr.ingest.Ingester;
-
-//JDK imports
-import java.lang.reflect.InvocationTargetException;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class PushPullObjectFactory {
-
- private PushPullObjectFactory() throws InstantiationException {
- throw new InstantiationException("Don't construct factory classes!");
- }
-
- public static <T> T createNewInstance(Class<T> clazz) throws InstantiationException {
- try {
- return clazz.newInstance();
- } catch (Exception e) {
- throw new InstantiationException(
- "Failed to create new object : "
- + e.getMessage());
- }
- }
-
- public static Ingester createIngester(String ingesterClass,
- String cacheFactoryClass) throws InstantiationException,
- IllegalAccessException, ClassNotFoundException,
- IllegalArgumentException, SecurityException,
- InvocationTargetException, NoSuchMethodException {
- String dataTransferFactory = System
- .getProperty("org.apache.oodt.cas.filemgr.datatransfer.factory");
- System.out.println("TRANSFER: " + dataTransferFactory);
- if (cacheFactoryClass == null || cacheFactoryClass.equals("")) {
- return (Ingester) Class.forName(ingesterClass).getConstructor(
- dataTransferFactory.getClass()).newInstance(
- dataTransferFactory);
- } else {
- Class<CacheFactory> cacheFactory = (Class<CacheFactory>) Class
- .forName(cacheFactoryClass);
- Cache cache = cacheFactory.newInstance().createCache();
- return (Ingester) Class.forName(ingesterClass).getConstructor(
- dataTransferFactory.getClass(), cache.getClass())
- .newInstance(dataTransferFactory, cache);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/ProtocolHandler.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/ProtocolHandler.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/ProtocolHandler.java
deleted file mode 100644
index ccafbbf..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/ProtocolHandler.java
+++ /dev/null
@@ -1,603 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.pushpull.protocol;
-
-//OODT imports
-
-import org.apache.oodt.cas.protocol.Protocol;
-import org.apache.oodt.cas.protocol.ProtocolFactory;
-import org.apache.oodt.cas.protocol.ProtocolFile;
-import org.apache.oodt.cas.protocol.auth.BasicAuthentication;
-import org.apache.oodt.cas.protocol.exceptions.ProtocolException;
-import org.apache.oodt.cas.protocol.util.ProtocolFileFilter;
-import org.apache.oodt.cas.pushpull.config.ProtocolInfo;
-import org.apache.oodt.cas.pushpull.exceptions.RemoteConnectionException;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.Vector;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-//JDK imports
-
-
-/**
- * This class is responsible for creating the appropriate Protocol for the given
- * RemoteSites. The boolean argument 'allowReuse' allows for one unique protocol
- * for each URL. That is, if allowReuse is set to true, then if no Protocol has
- * been created for the current site, the Protocol created will be saved and
- * then returned for any later called with allowReuse equals true. This is to
- * allow for the same Protocol object to be used by several classes. The
- * Protocol class has been synchronized so this is thread-safe. If you set
- * 'allowReuse' to false then a new Protocol object will be created and
- * returned.<br>
- * <br>
- *
- * @author bfoster
- */
-public class ProtocolHandler {
-
- private final ConcurrentHashMap<URI, ProtocolFactory> urlAndProtocolFactory;
-
- private final ConcurrentHashMap<URI, Protocol> reuseProtocols;
-
- private final ConcurrentHashMap<RemoteSiteFile, PagingInfo> pageInfos;
-
- private final ConcurrentHashMap<RemoteSiteFile, List<RemoteSiteFile>> pathAndFileListMap;
-
- private final ProtocolInfo pi;
-
- private static final Logger LOG = Logger.getLogger(ProtocolHandler.class
- .getName());
-
- /**
- * Creates a new ProtocolHandler for the given Config object
- *
- * @param pi
- * The Config object that guides this ProtocolHandler in making class
- * instanciations
- */
- public ProtocolHandler(ProtocolInfo pi) {
- this.pi = pi;
- urlAndProtocolFactory = new ConcurrentHashMap<URI, ProtocolFactory>();
- reuseProtocols = new ConcurrentHashMap<URI, Protocol>();
- pageInfos = new ConcurrentHashMap<RemoteSiteFile, PagingInfo>();
- pathAndFileListMap = new ConcurrentHashMap<RemoteSiteFile, List<RemoteSiteFile>>();
- }
-
- /**
- * Returns the appropriate protocol for the given Path
- *
- * @param pFile
- * Used to determine the appropriate Protocol to be returned and the
- * path to navigate on if navigateToPathLoc is set to true.
- * @param allowReuse
- * Set to true if you would like ProtocolHandler to take care of the
- * protocol returned (i.e. reuseable protocols may be returned by
- * this method again, if it is the appropriate protocol type for a
- * given Path. Also ProtocolHandler will take care of disconnecting
- * the reuseable protocols)
- * @param navigateToPathLoc
- * If true, will navigate the to the end of the Path location
- * specified
- * @return Protocol for the given Path
- * @throws RemoteConnectionException
- * If there is an error creating the protocol
- */
- public Protocol getAppropriateProtocol(RemoteSiteFile pFile,
- boolean allowReuse, boolean navigateToPathLoc)
- throws RemoteConnectionException {
- try {
- Protocol protocol = getAppropriateProtocol(pFile, allowReuse);
- if (protocol != null && navigateToPathLoc) {
- if (pFile.isDir()) {
- this.cd(protocol, pFile);
- } else if (pFile.getParent() != null) {
- this.cd(protocol, new RemoteSiteFile(pFile.getParent(), pFile.getSite()));
- }
- }
- return protocol;
- } catch (Exception e) {
- throw new RemoteConnectionException(
- "Failed to get appropriate protocol for " + pFile + " : "
- + e.getMessage(), e);
- }
- }
-
- private Protocol getAppropriateProtocol(RemoteSiteFile pFile,
- boolean allowReuse) throws ProtocolException {
- return this.getAppropriateProtocolBySite(pFile.getSite(), allowReuse);
- }
-
- public Protocol getAppropriateProtocolBySite(RemoteSite remoteSite,
- boolean allowReuse) throws ProtocolException {
- Protocol protocol = null;
- try {
- if ((allowReuse && ((protocol = reuseProtocols.get(remoteSite.getURL().toURI())) == null))
- || !allowReuse) {
- ProtocolFactory protocolFactory = null;
- try {
- protocolFactory = this.urlAndProtocolFactory
- .get(remoteSite.getURL().toURI());
- } catch (URISyntaxException e) {
- LOG.log(Level.SEVERE, "could not convert url to uri: Message: " + e.getMessage());
- }
- if (protocolFactory == null) {
- LinkedList<Class<ProtocolFactory>> protocolClasses = pi
- .getProtocolClassesForProtocolType(remoteSite.getURL()
- .getProtocol());
- for (Class<ProtocolFactory> clazz : protocolClasses) {
- try {
- if ((protocol = (protocolFactory = clazz.newInstance())
- .newInstance()) != null) {
- if (!connect(protocol, remoteSite, true)) {
- LOG.log(
- Level.WARNING,
- "ProtocolFactory "
- + protocolFactory.getClass().getCanonicalName()
- + " is not compatible with server at "
- + remoteSite.getURL());
- protocol = null;
- } else {
- this.urlAndProtocolFactory.put(remoteSite.getURL().toURI(),
- protocolFactory);
- break;
- }
- }
- } catch (Exception e) {
- LOG.log(Level.WARNING, "Failed to instanciate protocol " + clazz
- + " for " + remoteSite.getURL());
- }
- }
- if (protocol == null) {
- throw new ProtocolException("Failed to get appropriate protocol for "
- + remoteSite);
- }
- } else {
- connect(protocol = protocolFactory.newInstance(), remoteSite, false);
- }
- if (allowReuse) {
- try {
- this.reuseProtocols.put(remoteSite.getURL().toURI(), protocol);
- } catch (URISyntaxException e) {
- LOG.log(Level.SEVERE, "Couildn't covert URL to URI Mesage: " + e.getMessage());
- }
- }
- }
- } catch (URISyntaxException e) {
- LOG.log(Level.SEVERE, "could not convert url to uri: Message: "+e.getMessage());
- }
- return protocol;
- }
-
- public synchronized List<RemoteSiteFile> nextPage(RemoteSite site, Protocol protocol)
- throws RemoteConnectionException, ProtocolException {
- return nextPage(site, protocol, null);
- }
-
- /**
- * @param protocol
- * @return
- * @throws RemoteConnectionException
- * @throws ProtocolException
- */
- public synchronized List<RemoteSiteFile> nextPage(RemoteSite site, Protocol protocol,
- ProtocolFileFilter filter) throws RemoteConnectionException,
- ProtocolException {
-
- PagingInfo pgInfo = this.getPagingInfo(this.pwd(site, protocol));
- try {
- System.out.println("PageSize: " + pi.getPageSize() + " PageLoc: "
- + pgInfo.getPageLoc());
- List<RemoteSiteFile> fileList = this.ls(site, protocol);
- System.out.println("FileList size: " + fileList.size());
-
- if (this.getDynamicFileList(site, protocol) == null
- && !this.passesDynamicDetection(pgInfo, fileList)) {
- LOG.log(
- Level.SEVERE,
- "Remote directory '"
- + this.pwd(site, protocol)
- + "' file list size has changed -- setting directory as dynamic and resetting page location");
- this.putDynamicFileList(site, protocol, fileList);
- pgInfo.updatePageInfo(0, fileList);
- }
-
- List<RemoteSiteFile> page = new LinkedList<RemoteSiteFile>();
- int curLoc = pgInfo.getPageLoc();
- for (; page.size() < pi.getPageSize() && curLoc < fileList.size(); curLoc++) {
- if (filter == null || filter.accept(fileList.get(curLoc))) {
- page.add(fileList.get(curLoc));
- }
- }
- pgInfo.updatePageInfo(curLoc, fileList);
-
- return page;
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- throw new RemoteConnectionException(
- "Failed getting next page for protocol " + protocol + "-- pgStart = "
- + pgInfo.getPageLoc() + " pgSize = " + pi.getPageSize() + " : "
- + e.getMessage());
- }
-
- }
-
- private boolean passesDynamicDetection(PagingInfo pgInfo,
- List<RemoteSiteFile> newLS) {
- return !(pgInfo.getSizeOfLastLS() != -1
- && (pgInfo.getSizeOfLastLS() != newLS.size() || (newLS.size() != 0
- && pgInfo.getPageLoc() < newLS.size() && (newLS.get(pgInfo
- .getPageLoc()) == null || !newLS.get(pgInfo.getPageLoc()).equals(
- pgInfo.getRemoteSiteFileAtPageLoc())))));
- }
-
- public void download(Protocol protocol, RemoteSiteFile fromFile, File toFile,
- boolean delete) throws RemoteConnectionException {
-
- // rename file for download
- File downloadFile = new File(
- String.format("%s/Downloading_%s", toFile.getParent(), toFile.getName()));
- toFile.renameTo(downloadFile);
-
- LOG.log(Level.INFO, "Starting to download " + fromFile);
- try {
- // try to download the file
- protocol.get(fromFile, downloadFile);
-
- // rename file back to original name
- if (!downloadFile.renameTo(toFile)) {
- throw new IOException(
- String.format("Failed to rename file %s to %s", downloadFile, toFile));
- }
-
- // delete file is specified
- if (delete) {
- if (!this.delete(protocol, fromFile)) {
- LOG.log(Level.WARNING, "Failed to delete file '" + fromFile
- + "' from server '" + fromFile.getSite() + "'");
- } else {
- LOG.log(Level.INFO, "Successfully deleted file '" + fromFile
- + "' from server '" + fromFile.getSite() + "'");
- }
- }
-
- LOG.log(Level.INFO, "Finished downloading " + fromFile + " to " + toFile);
-
- } catch (Exception e) {
- downloadFile.delete();
- throw new RemoteConnectionException("Failed to download file " + fromFile
- + " : " + e.getMessage(), e);
- }
- }
-
- /**
- * Connects the given Protocol to the given URL
- *
- * @param protocol
- * The Protocol that will be connected
- * @param remoteSite
- * The server to which the Protocol will connect
- * @param test
- */
- public boolean connect(Protocol protocol, RemoteSite remoteSite, boolean test) {
- for (int tries = 0; tries < 3; tries++) {
-
- // wait for 5 secs before next retry
- if (tries > 0) {
- LOG.log(Level.INFO, "Will retry connecting to " + remoteSite
- + " in 5 seconds");
- synchronized (this) {
- try {
- System.out.print("Waiting");
- for (int i = 0; i < 5; i++) {
- System.out.print(" .");
- wait(1000);
- }
- System.out.println();
- } catch (Exception ignored) {
- }
- }
- }
-
- try {
- // make sure protocol is disconnected
- try {
- protocol.close();
- } catch (Exception ignored) {
- }
-
- // try connecting Protocol
- protocol.connect(
- remoteSite.getURL().getHost(),
- new BasicAuthentication(remoteSite.getUsername(), remoteSite
- .getPassword()));
-
- // check connection
- if (protocol.connected()
- && (!test || isOkProtocol(protocol, remoteSite))) {
- LOG.log(Level.INFO,
- "Successfully connected to " + remoteSite.getURL()
- + " with protocol '" + protocol.getClass().getCanonicalName()
- + "' and username '" + remoteSite.getUsername() + "'");
- return true;
- } else {
- return false;
- }
-
- } catch (Exception e) {
- LOG.log(Level.WARNING, "Error occurred while connecting to "
- + remoteSite + " : " + e.getMessage(), e);
- }
-
- }
- return false;
- }
-
- private boolean isOkProtocol(Protocol protocol, RemoteSite remoteSite) {
- try {
- LOG.log(Level.INFO, "Testing protocol "
- + protocol.getClass().getCanonicalName()
- + " . . . this may take a few minutes . . .");
- // test ls, cd, and pwd
- this.cdToHOME(protocol);
- RemoteSiteFile home = this.pwd(remoteSite, protocol);
- this.ls(remoteSite, protocol);
- if (remoteSite.getCdTestDir() != null) {
- this.cd(protocol, new RemoteSiteFile(home, remoteSite.getCdTestDir(),
- true, remoteSite));
- } else {
- this.cdToROOT(protocol);
- }
- this.cdToHOME(protocol);
- if (home == null || !home.equals(this.pwd(remoteSite, protocol))) {
- throw new ProtocolException("Home directory not the same after cd");
- }
- } catch (Exception e) {
- LOG.log(Level.SEVERE, "Protocol "
- + protocol.getClass().getCanonicalName()
- + " failed compatibility test : " + e.getMessage(), e);
- return false;
- }
- return true;
- }
-
- public void cdToROOT(Protocol protocol) throws ProtocolException {
- protocol.cdRoot();
- }
-
- public void cdToHOME(Protocol protocol) throws ProtocolException {
- protocol.cdHome();
- }
-
- public boolean isProtocolConnected(Protocol protocol) {
- return protocol.connected();
- }
-
- public void cd(Protocol protocol, RemoteSiteFile file)
- throws ProtocolException {
- protocol.cd(file);
- }
-
- public RemoteSiteFile getProtocolFileFor(RemoteSite site, Protocol protocol, String file,
- boolean isDir) throws ProtocolException {
- return this.getProtocolFileByProtocol(site, protocol, file, isDir);
- }
-
- public synchronized boolean delete(Protocol protocol, RemoteSiteFile file) {
- try {
- PagingInfo pgInfo = this.getPagingInfo(file.getRemoteParent());
- List<RemoteSiteFile> fileList = this.ls(protocol, file.getRemoteParent());
- int indexOfFile = fileList.indexOf(file);
- if (indexOfFile != -1) {
- protocol.delete(file);
- fileList.remove(indexOfFile);
- System.out.println("IndexOfFile: " + indexOfFile + " PageIndex: "
- + pgInfo.getPageLoc());
- if (indexOfFile < pgInfo.getPageLoc()
- || indexOfFile == fileList.size() - 1) {
- pgInfo.updatePageInfo(pgInfo.getPageLoc() - 1, fileList);
- } else {
- pgInfo.updatePageInfo(pgInfo.getPageLoc(), fileList);
- }
- return true;
- } else {
- return false;
- }
- } catch (Exception e) {
- LOG.log(Level.SEVERE, "Failed to delete file", e);
- return false;
- }
- }
-
- private synchronized void putPgInfo(PagingInfo pgInfo, RemoteSiteFile pFile) {
- this.pageInfos.put(pFile, pgInfo);
- }
-
- private synchronized PagingInfo getPagingInfo(RemoteSiteFile pFile) {
- PagingInfo pgInfo = this.pageInfos.get(pFile);
- if (pgInfo == null) {
- this.putPgInfo(pgInfo = new PagingInfo(), pFile);
- }
- return pgInfo;
- }
-
- public RemoteSiteFile pwd(RemoteSite site, Protocol protocol) throws ProtocolException {
- return new RemoteSiteFile(protocol.pwd(), site);
- }
-
- public List<RemoteSiteFile> ls(Protocol protocol, RemoteSiteFile dir)
- throws ProtocolException {
- List<RemoteSiteFile> fileList = this.getDynamicFileList(dir.getSite(), protocol);
- if (fileList == null) {
- protocol.cd(dir);
- fileList = toRemoteSiteFiles(protocol.ls(), dir.getSite());
- }
- return fileList;
- }
-
- public List<RemoteSiteFile> ls(RemoteSite site, Protocol protocol) throws ProtocolException {
- List<RemoteSiteFile> fileList = this.getDynamicFileList(site, protocol);
- if (fileList == null) {
- fileList = toRemoteSiteFiles(protocol.ls(), site);
- }
- return fileList;
- }
-
- public List<RemoteSiteFile> ls(RemoteSite site, Protocol protocol, ProtocolFileFilter filter)
- throws ProtocolException {
- List<RemoteSiteFile> fileList = this.getDynamicFileList(site, protocol);
- if (fileList == null) {
- fileList = toRemoteSiteFiles(protocol.ls(filter), site);
- }
- return fileList;
- }
-
- private synchronized List<RemoteSiteFile> getDynamicFileList(RemoteSite site, Protocol protocol)
- throws ProtocolException {
- return (List<RemoteSiteFile>) (List<?>) this.pathAndFileListMap.get(this
- .pwd(site, protocol));
- }
-
- private synchronized void putDynamicFileList(RemoteSite site, Protocol protocol,
- List<RemoteSiteFile> fileList) throws ProtocolException {
- this.pathAndFileListMap.put(this.pwd(site, protocol), fileList);
- }
-
- public synchronized RemoteSiteFile getHomeDir(RemoteSite site, Protocol protocol) {
- try {
- protocol.cdHome();
- return new RemoteSiteFile(protocol.pwd(), site);
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- return null;
- }
- }
-
- public String getAbsPathFor(Protocol protocol, String path, boolean isDir) {
- try {
- protocol.cd(new ProtocolFile(path, isDir));
- return protocol.pwd().getAbsoluteFile().getPath();
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- return null;
- }
- }
-
- /**
- * Disconnects and logs out the given Protocol
- *
- * @param protocol
- * The Protocol to be logout out and disconnected
- * @throws RemoteConnectionException
- */
- public void disconnect(Protocol protocol) throws RemoteConnectionException {
- try {
- LOG.log(Level.INFO, "Disconnecting protocol " + protocol.getClass().getName());
- protocol.close();
- } catch (Exception e) {
- throw new RemoteConnectionException("Error disconnecting " + protocol.getClass().getName()
- + " : " + e.getMessage());
- }
- }
-
- /**
- * Disconnects all waiting Protocols and clears the waiting lists. Also clears
- * the current Protocol
- *
- * @throws RemoteConnectionException
- */
- public void close() throws RemoteConnectionException {
- Set<Entry<URI, Protocol>> entries = reuseProtocols.entrySet();
- for (Entry<URI, Protocol> entry : entries) {
- disconnect(entry.getValue());
- }
- this.reuseProtocols.clear();
- this.urlAndProtocolFactory.clear();
- this.pageInfos.clear();
- this.pathAndFileListMap.clear();
- }
-
- private synchronized RemoteSiteFile getProtocolFileByProtocol(
- RemoteSite site, Protocol protocol, String file, boolean isDir) throws ProtocolException {
- try {
- if (!file.startsWith("/")) {
- protocol.cdHome();
- file = protocol.pwd().getPath() + "/" + file;
- }
- return new RemoteSiteFile(file, isDir, site);
- } catch (Exception e) {
- throw new ProtocolException("Failed to create protocol for " + file
- + " : " + e.getMessage());
- }
- }
-
- private List<RemoteSiteFile> toRemoteSiteFiles(List<ProtocolFile> files, RemoteSite site) {
- List<RemoteSiteFile> newFiles = new Vector<RemoteSiteFile>();
- if (files != null) {
- for (ProtocolFile file : files) {
- newFiles.add(new RemoteSiteFile(file, site));
- }
- }
- return newFiles;
- }
-
- class PagingInfo {
-
- private int pageLoc;
-
- private int sizeOfLastLS;
-
- private RemoteSiteFile pFileAtPageLoc;
-
- PagingInfo() {
- this.pageLoc = 0;
- this.sizeOfLastLS = -1;
- this.pFileAtPageLoc = null;
- }
-
- synchronized void updatePageInfo(int newPageLoc, List<RemoteSiteFile> ls) {
- this.sizeOfLastLS = ls.size();
- this.pageLoc = newPageLoc < 0 ? 0 : newPageLoc;
- this.pFileAtPageLoc = (this.sizeOfLastLS > 0 && newPageLoc < ls.size()) ? ls
- .get(newPageLoc) : null;
- }
-
- synchronized int getPageLoc() {
- return this.pageLoc;
- }
-
- synchronized int getSizeOfLastLS() {
- return this.sizeOfLastLS;
- }
-
- synchronized RemoteSiteFile getRemoteSiteFileAtPageLoc() {
- return this.pFileAtPageLoc;
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/ProtocolPath.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/ProtocolPath.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/ProtocolPath.java
deleted file mode 100644
index 9da66db..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/ProtocolPath.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.protocol;
-
-//JDK imports
-import java.io.Serializable;
-
-/**
- * This class wraps up a URL for a given path, and whether the path specified by
- * the URL is a dirctory or not
- *
- * @author bfoster
- */
-public class ProtocolPath implements Serializable {
-
- private static final long serialVersionUID = 807275248811949120L;
-
- /**
- * The string verion of the path in the URL
- */
- protected String path;
-
- protected String remotePath;
-
- protected boolean relativeToHOME;
-
- /**
- * Specifies whether this path is a path to a directory or file
- */
- protected boolean isDir;
-
- public ProtocolPath() {
- super();
- }
-
- public ProtocolPath(String path, boolean isDir) {
- this.isDir = isDir;
- this.path = this.checkForDelimiters(path);
- }
-
- protected String checkForDelimiters(String path) {
- if (path.endsWith("/") && path.length() > 1) {
- path = path.substring(0, path.length() - 1);
- }
- relativeToHOME = !path.startsWith("/");
- return path;
- }
-
- public boolean isRelativeToHOME() {
- return relativeToHOME;
- }
-
- public String getPathString() {
- return path;
- }
-
- /**
- * Return the name of the file for which this path belongs
- *
- * @return The Path file name.
- */
- public String getFileName() {
- return path.substring(path.lastIndexOf("/") + 1);
- }
-
- /**
- * Returns the path that is used when downloading the file
- *
- * @return The downloading path
- */
- public String getDownloadPath() {
- return (isDirectory()) ? path : path
- .substring(0, path.lastIndexOf("/"))
- + "/" + getDownloadFileName();
- }
-
- /**
- * Returns the file name that is used when downloading the file
- *
- * @return The name used during downloading.
- */
- public String getDownloadFileName() {
- return "Downloading_" + getFileName();
- }
-
- /**
- * Tells whether this path is a path to a directory or not
- *
- * @return True if this Path is a directory
- */
- public boolean isDirectory() {
- return isDir;
- }
-
- public boolean equals(Object path) {
- if (path instanceof ProtocolPath) {
- ProtocolPath p = (ProtocolPath) path;
- return (p.getPathString().equals(this.getPathString()));
- }
- return false;
- }
-
- public String getParentDirPath() {
- if (path.length() <= 1) {
- return null;
- }
- return path.substring(0, path.lastIndexOf("/"));
- }
-
- public String toString() {
- return (path + " isDir=" + this.isDir);
- }
-
- public ProtocolPath getParentPath() {
- return new ProtocolPath(path.substring(0, path.lastIndexOf("/")), true);
- }
-
- @Override
- public int hashCode() {
- int result = path != null ? path.hashCode() : 0;
- result = 31 * result + (remotePath != null ? remotePath.hashCode() : 0);
- result = 31 * result + (relativeToHOME ? 1 : 0);
- result = 31 * result + (isDir ? 1 : 0);
- return result;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/RemoteSite.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/RemoteSite.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/RemoteSite.java
deleted file mode 100644
index 15f5e9a..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/RemoteSite.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.protocol;
-
-//JDK imports
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class RemoteSite {
-
- /* our log stream */
- private final static Logger LOG = Logger.getLogger(RemoteSite.class
- .getName());
-
- private String alias, username, password, cdTestDir;
- private int maxConnections;
- private URL url;
-
- public RemoteSite(String alias, URL url, String username, String password) {
- this.alias = alias;
- this.username = username;
- this.password = password;
- this.url = url;
- this.maxConnections = -1;
- }
-
- public RemoteSite(String alias, URL url, String username, String password, String cdTestDir) {
- this(alias, url, username, password);
- this.cdTestDir = cdTestDir;
- }
-
- public RemoteSite(String alias, URL url, String username, String password, String cdTestDir, int maxConnections) {
- this(alias, url, username, password, cdTestDir);
- this.maxConnections = maxConnections;
- }
-
- public String getAlias() {
- return this.alias;
- }
-
- public URL getURL() {
- return this.url;
- }
-
- public String getUsername() {
- return this.username;
- }
-
- public String getPassword() {
- return this.password;
- }
-
- public String getCdTestDir() {
- return this.cdTestDir;
- }
-
- public int getMaxConnections() {
- return this.maxConnections;
- }
-
- public void copy(RemoteSite rs) {
- this.alias = rs.alias;
- this.url = rs.url;
- this.username = rs.username;
- this.password = rs.password;
- this.cdTestDir = rs.cdTestDir;
- this.maxConnections = rs.maxConnections;
- }
-
- public boolean equals(Object obj) {
- if (obj instanceof RemoteSite) {
- RemoteSite rs = (RemoteSite) obj;
- try {
- return (rs.alias.equals(this.alias) && rs.url.toURI().equals(this.url.toURI())
- && rs.username.equals(this.username) && rs.password
- .equals(this.password) && rs.maxConnections == this.maxConnections);
- } catch (URISyntaxException e) {
- LOG.log(Level.SEVERE, "Could not convert URL to URL: Message: "+e.getMessage());
- }
- } else {
- return false;
- }
- return false;
- }
-
- public String toString() {
- return "RemoteSite: alias = '" + this.alias + "' url = '" + this.url
- + "' username = '" + this.username + "' cdTestDir = '"
- + this.cdTestDir + "' maxConnections = '" + this.maxConnections + "'";
- }
-
- @Override
- public int hashCode() {
- int result = alias != null ? alias.hashCode() : 0;
- result = 31 * result + (username != null ? username.hashCode() : 0);
- result = 31 * result + (password != null ? password.hashCode() : 0);
- result = 31 * result + (cdTestDir != null ? cdTestDir.hashCode() : 0);
- result = 31 * result + maxConnections;
- try {
- result = 31 * result + (url != null ? url.toURI().hashCode() : 0);
- } catch (URISyntaxException e) {
- e.printStackTrace();
- }
- return result;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/RemoteSiteFile.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/RemoteSiteFile.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/RemoteSiteFile.java
deleted file mode 100644
index 89bfdbd..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/RemoteSiteFile.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.cas.pushpull.protocol;
-
-//OODT imports
-import org.apache.oodt.cas.protocol.ProtocolFile;
-
-/**
- *
- * Extends {@link ProtocolFile} and links it to a {@link RemoteSite}.
- *
- * @author mattmann
- * @version $Revision$
- *
- */
-public class RemoteSiteFile extends ProtocolFile {
-
- private RemoteSite site;
-
- public RemoteSiteFile(ProtocolFile file, RemoteSite site){
- this(file.getPath(), file.isDir(), site);
- }
-
- /**
- * @param parent
- * @param path
- * @param isDir
- * @param site
- */
- public RemoteSiteFile(ProtocolFile parent, String path, boolean isDir,
- RemoteSite site) {
- super(parent, path, isDir);
- this.site = site;
- }
-
- /**
- * @param path
- * @param isDir
- * @param site
- */
- public RemoteSiteFile(String path, boolean isDir, RemoteSite site) {
- super(path, isDir);
- this.site = site;
- }
-
- /**
- * @return the site
- */
- public RemoteSite getSite() {
- return site;
- }
-
- /**
- * @param site
- * the site to set
- */
- public void setSite(RemoteSite site) {
- this.site = site;
- }
-
- public RemoteSiteFile getRemoteParent() {
- ProtocolFile parent = super.getParent();
- return new RemoteSiteFile(parent.getPath(), parent.isDir(), this.site);
- }
-
- @Override
-public RemoteSiteFile getAbsoluteFile() {
- ProtocolFile parent = super.getAbsoluteFile();
- return new RemoteSiteFile(parent.getPath(), parent.isDir(), this.site);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalmethod/ListRetriever.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalmethod/ListRetriever.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalmethod/ListRetriever.java
deleted file mode 100644
index dbfa94f..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalmethod/ListRetriever.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.retrievalmethod;
-
-//OODT imports
-import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException;
-import org.apache.oodt.cas.metadata.Metadata;
-import org.apache.oodt.cas.pushpull.config.DataFilesInfo;
-import org.apache.oodt.cas.pushpull.config.DownloadInfo;
-import org.apache.oodt.cas.pushpull.exceptions.AlreadyInDatabaseException;
-import org.apache.oodt.cas.pushpull.exceptions.ParserException;
-import org.apache.oodt.cas.pushpull.exceptions.RetrievalMethodException;
-import org.apache.oodt.cas.pushpull.exceptions.ToManyFailedDownloadsException;
-import org.apache.oodt.cas.pushpull.exceptions.UndefinedTypeException;
-import org.apache.oodt.cas.pushpull.filerestrictions.FileRestrictions;
-import org.apache.oodt.cas.pushpull.filerestrictions.Parser;
-import org.apache.oodt.cas.pushpull.filerestrictions.VirtualFileStructure;
-import org.apache.oodt.cas.pushpull.protocol.RemoteSite;
-import org.apache.oodt.cas.pushpull.retrievalsystem.DataFileToPropFileLinker;
-import org.apache.oodt.cas.pushpull.retrievalsystem.FileRetrievalSystem;
-
-
-//JDK imports
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.util.LinkedList;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class ListRetriever implements RetrievalMethod {
-
- /* our log stream */
- private static final Logger LOG = Logger.getLogger(ListRetriever.class
- .getName());
-
- public void processPropFile(FileRetrievalSystem frs, Parser propFileParser,
- File propFile, DataFilesInfo dfi, DataFileToPropFileLinker linker)
- throws FileNotFoundException, ParserException, RetrievalMethodException {
- RemoteSite remoteSite;
-
- // parse property file
- Metadata fileMetadata = new Metadata();
- VirtualFileStructure vfs = propFileParser.parse(new FileInputStream(
- propFile), fileMetadata);
- DownloadInfo di = dfi.getDownloadInfo();
- if (!di.isAllowAliasOverride()
- || (remoteSite = vfs.getRemoteSite()) == null) {
- remoteSite = di.getRemoteSite();
- }
- LinkedList<String> fileList = FileRestrictions.toStringList(vfs
- .getRootVirtualFile());
-
- // download data files specified in property file
- for (String file : fileList) {
- try {
- linker.addPropFileToDataFileLink(propFile, file);
- if (!frs.addToDownloadQueue(remoteSite, file, di
- .getRenamingConv(), di.getStagingArea(), dfi
- .getQueryMetadataElementName(), di.deleteFromServer(), fileMetadata)) {
- linker.eraseLinks(propFile);
- }
- } catch (ToManyFailedDownloadsException e) {
- throw new RetrievalMethodException(
- "Connection appears to be down. . .unusual number of download failures. . .stopping : "
- + e.getMessage());
- } catch (CatalogException e) {
- throw new RetrievalMethodException(
- "Failed to communicate with database : "
- + e.getMessage());
- } catch (AlreadyInDatabaseException e) {
- LOG.log(Level.WARNING, "Skipping file : " + e.getMessage());
- } catch (UndefinedTypeException e) {
- LOG.log(Level.WARNING, "Skipping file : " + e.getMessage());
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- linker.markAsFailed(propFile, "Failed to download " + file
- + " from " + remoteSite + " : " + e.getMessage());
- throw new RetrievalMethodException("Uknown error accured while downloading "
- + file + " from " + remoteSite + " -- bailing out : "
- + e.getMessage());
- }
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalmethod/RemoteCrawler.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalmethod/RemoteCrawler.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalmethod/RemoteCrawler.java
deleted file mode 100644
index d3030e3..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalmethod/RemoteCrawler.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.retrievalmethod;
-
-//OODT imports
-import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException;
-import org.apache.oodt.cas.metadata.Metadata;
-import org.apache.oodt.cas.protocol.exceptions.ProtocolException;
-import org.apache.oodt.cas.pushpull.config.DataFilesInfo;
-import org.apache.oodt.cas.pushpull.config.DownloadInfo;
-import org.apache.oodt.cas.pushpull.exceptions.AlreadyInDatabaseException;
-import org.apache.oodt.cas.pushpull.exceptions.ParserException;
-import org.apache.oodt.cas.pushpull.exceptions.RetrievalMethodException;
-import org.apache.oodt.cas.pushpull.exceptions.ToManyFailedDownloadsException;
-import org.apache.oodt.cas.pushpull.exceptions.UndefinedTypeException;
-import org.apache.oodt.cas.pushpull.filerestrictions.FileRestrictions;
-import org.apache.oodt.cas.pushpull.filerestrictions.Parser;
-import org.apache.oodt.cas.pushpull.filerestrictions.VirtualFile;
-import org.apache.oodt.cas.pushpull.filerestrictions.VirtualFileStructure;
-import org.apache.oodt.cas.protocol.ProtocolFile;
-import org.apache.oodt.cas.protocol.util.ProtocolFileFilter;
-import org.apache.oodt.cas.pushpull.protocol.ProtocolPath;
-import org.apache.oodt.cas.pushpull.protocol.RemoteSite;
-import org.apache.oodt.cas.pushpull.protocol.RemoteSiteFile;
-import org.apache.oodt.cas.pushpull.retrievalsystem.DataFileToPropFileLinker;
-import org.apache.oodt.cas.pushpull.retrievalsystem.FileRetrievalSystem;
-
-
-//JDK imports
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.net.MalformedURLException;
-import java.util.List;
-import java.util.Stack;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class RemoteCrawler implements RetrievalMethod {
-
- private static final Logger LOG = Logger.getLogger(RemoteCrawler.class
- .getName());
-
- /**
- * Starts the crawler and creates a default DirStruct if null was supplied
- * in constructor
- *
- * @throws java.net.MalformedURLException
- * @throws org.apache.oodt.cas.pushpull.exceptions.ProtocolException
- * @throws org.apache.oodt.cas.pushpull.exceptions.ProtocolFileException
- */
- @Override
- public void processPropFile(FileRetrievalSystem frs, Parser propFileParser,
- File propFile, DataFilesInfo dfi, DataFileToPropFileLinker linker)
- throws FileNotFoundException, ParserException, ProtocolException, MalformedURLException,
- RetrievalMethodException {
- RemoteSite remoteSite;
-
- // parse property file
- Metadata fileMetadata = new Metadata();
- VirtualFileStructure vfs = propFileParser.parse(new FileInputStream(
- propFile), fileMetadata);
-
- // determine RemoteSite
- DownloadInfo di = dfi.getDownloadInfo();
- if (!di.isAllowAliasOverride()
- || (remoteSite = vfs.getRemoteSite()) == null) {
- remoteSite = di.getRemoteSite();
- }
-
- // modify vfs to be root based if HOME directory based
- if (!vfs.isRootBased()) {
- String homeDirPath = frs.getHomeDir(remoteSite).getPath();
- VirtualFile root = new VirtualFile(homeDirPath, true);
- root.addChild(vfs.getRootVirtualFile());
- vfs = new VirtualFileStructure(homeDirPath + "/"
- + vfs.getPathToRoot(), root.getRootDir());
- frs.changeToHOME(remoteSite);
- }
-
- // initialize variables
- final String initialCdPath = vfs.getPathToRoot();
- final VirtualFile vf = vfs.getRootVirtualFile();
-
- // change to initial directory (takes care of Linux auto-mounting)
- frs.changeToDir(initialCdPath, remoteSite);
-
- // add starting directory to stack
- Stack<RemoteSiteFile> files = new Stack<RemoteSiteFile>();
- files.add(new RemoteSiteFile(frs.getCurrentFile(remoteSite), remoteSite));
-
- // start crawling
- while (!files.isEmpty()) {
- RemoteSiteFile file = files.peek();
- try {
- // if directory, then add its children to the crawl list
- if (file.isDir()) {
-
- // get next page worth of children
- List<RemoteSiteFile> children = frs.getNextPage(file,
- new ProtocolFileFilter() {
- @Override
- public boolean accept(ProtocolFile pFile) {
- return FileRestrictions.isAllowed(new
- ProtocolPath(pFile
- .getPath(), pFile.isDir()), vf);
- }
- });
-
- // if directory had more children then add them
- if (children.size() > 0) {
- files.addAll(children);
- }// otherwise remove the directory from the crawl list
- else {
- files.pop();
- }
-
- // if file, then download it
- } else {
- linker.addPropFileToDataFileLink(propFile, file);
- if (!frs.addToDownloadQueue(files.pop(), di
- .getRenamingConv(), di.getStagingArea(), dfi
- .getQueryMetadataElementName(), di
- .deleteFromServer(), fileMetadata)) {
- linker.eraseLinks(propFile);
- }
- }
-
- } catch (ToManyFailedDownloadsException e) {
- throw new RetrievalMethodException(
- "Connection appears to be down. . .unusual number of download failures. . .stopping : "
- + e.getMessage());
- } catch (CatalogException e) {
- throw new RetrievalMethodException(
- "Failed to communicate with database : "
- + e.getMessage());
- } catch (AlreadyInDatabaseException e) {
- LOG.log(Level.WARNING, "Skipping file : " + e.getMessage());
- } catch (UndefinedTypeException e) {
- LOG.log(Level.WARNING, "Skipping file : " + e.getMessage());
- } catch (Exception e) {
- linker.markAsFailed(propFile, e.getMessage());
- throw new RetrievalMethodException("Uknown error accured while downloading "
- + file + " from " + remoteSite + " -- bailing out : "
- + e.getMessage(), e);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalmethod/RetrievalMethod.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalmethod/RetrievalMethod.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalmethod/RetrievalMethod.java
deleted file mode 100644
index d34874b..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalmethod/RetrievalMethod.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.retrievalmethod;
-
-//JDK imports
-import java.io.File;
-
-//OODT imports
-import org.apache.oodt.cas.pushpull.config.DataFilesInfo;
-import org.apache.oodt.cas.pushpull.filerestrictions.Parser;
-import org.apache.oodt.cas.pushpull.retrievalsystem.DataFileToPropFileLinker;
-import org.apache.oodt.cas.pushpull.retrievalsystem.FileRetrievalSystem;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public interface RetrievalMethod {
-
- void processPropFile(FileRetrievalSystem frs,
- Parser propFileParser, File propFile, DataFilesInfo dfi,
- DataFileToPropFileLinker linker) throws Exception;
-
-}
[42/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/static/js/jquery-1.4.2-min.js
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/static/js/jquery-1.4.2-min.js b/balance/modules/cas-browser/static/js/jquery-1.4.2-min.js
deleted file mode 100644
index 7c24308..0000000
--- a/balance/modules/cas-browser/static/js/jquery-1.4.2-min.js
+++ /dev/null
@@ -1,154 +0,0 @@
-/*!
- * jQuery JavaScript Library v1.4.2
- * http://jquery.com/
- *
- * Copyright 2010, John Resig
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * Includes Sizzle.js
- * http://sizzlejs.com/
- * Copyright 2010, The Dojo Foundation
- * Released under the MIT, BSD, and GPL Licenses.
- *
- * Date: Sat Feb 13 22:33:48 2010 -0500
- */
-(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o<i;o++)e(a[o],b,f?d.call(a[o],o,e(a[o],b)):d,j);return a}return i?
-e(a[0],b):w}function J(){return(new Date).getTime()}function Y(){return false}function Z(){return true}function na(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function oa(a){var b,d=[],f=[],e=arguments,j,i,o,k,n,r;i=c.data(this,"events");if(!(a.liveFired===this||!i||!i.live||a.button&&a.type==="click")){a.liveFired=this;var u=i.live.slice(0);for(k=0;k<u.length;k++){i=u[k];i.origType.replace(O,"")===a.type?f.push(i.selector):u.splice(k--,1)}j=c(a.target).closest(f,a.currentTarget);n=0;for(r=
-j.length;n<r;n++)for(k=0;k<u.length;k++){i=u[k];if(j[n].selector===i.selector){o=j[n].elem;f=null;if(i.preType==="mouseenter"||i.preType==="mouseleave")f=c(a.relatedTarget).closest(i.selector)[0];if(!f||f!==o)d.push({elem:o,handleObj:i})}}n=0;for(r=d.length;n<r;n++){j=d[n];a.currentTarget=j.elem;a.data=j.handleObj.data;a.handleObj=j.handleObj;if(j.handleObj.origHandler.apply(j.elem,e)===false){b=false;break}}return b}}function pa(a,b){return"live."+(a&&a!=="*"?a+".":"")+b.replace(/\./g,"`").replace(/ /g,
-"&")}function qa(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function ra(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var f=c.data(a[d++]),e=c.data(this,f);if(f=f&&f.events){delete e.handle;e.events={};for(var j in f)for(var i in f[j])c.event.add(this,j,f[j][i],f[j][i].data)}}})}function sa(a,b,d){var f,e,j;b=b&&b[0]?b[0].ownerDocument||b[0]:s;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===s&&!ta.test(a[0])&&(c.support.checkClone||!ua.test(a[0]))){e=
-true;if(j=c.fragments[a[0]])if(j!==1)f=j}if(!f){f=b.createDocumentFragment();c.clean(a,b,f,d)}if(e)c.fragments[a[0]]=j?f:1;return{fragment:f,cacheable:e}}function K(a,b){var d={};c.each(va.concat.apply([],va.slice(0,b)),function(){d[this]=a});return d}function wa(a){return"scrollTo"in a&&a.document?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var c=function(a,b){return new c.fn.init(a,b)},Ra=A.jQuery,Sa=A.$,s=A.document,T,Ta=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/,
-Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&&
-(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this,
-a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b===
-"find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this,
-function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b<d;b++)if((e=arguments[b])!=null)for(j in e){i=a[j];o=e[j];if(a!==o)if(f&&o&&(c.isPlainObject(o)||c.isArray(o))){i=i&&(c.isPlainObject(i)||
-c.isArray(i))?i:c.isArray(o)?[]:{};a[j]=c.extend(f,i,o)}else if(o!==w)a[j]=o}return a};c.extend({noConflict:function(a){A.$=Sa;if(a)A.jQuery=Ra;return c},isReady:false,ready:function(){if(!c.isReady){if(!s.body)return setTimeout(c.ready,13);c.isReady=true;if(Q){for(var a,b=0;a=Q[b++];)a.call(s,c);Q=null}c.fn.triggerHandler&&c(s).triggerHandler("ready")}},bindReady:function(){if(!xa){xa=true;if(s.readyState==="complete")return c.ready();if(s.addEventListener){s.addEventListener("DOMContentLoaded",
-L,false);A.addEventListener("load",c.ready,false)}else if(s.attachEvent){s.attachEvent("onreadystatechange",L);A.attachEvent("onload",c.ready);var a=false;try{a=A.frameElement==null}catch(b){}s.documentElement.doScroll&&a&&ma()}}},isFunction:function(a){return $.call(a)==="[object Function]"},isArray:function(a){return $.call(a)==="[object Array]"},isPlainObject:function(a){if(!a||$.call(a)!=="[object Object]"||a.nodeType||a.setInterval)return false;if(a.constructor&&!aa.call(a,"constructor")&&!aa.call(a.constructor.prototype,
-"isPrototypeOf"))return false;var b;for(b in a);return b===w||aa.call(a,b)},isEmptyObject:function(a){for(var b in a)return false;return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;a=c.trim(a);if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return A.JSON&&A.JSON.parse?A.JSON.parse(a):(new Function("return "+
-a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Va.test(a)){var b=s.getElementsByTagName("head")[0]||s.documentElement,d=s.createElement("script");d.type="text/javascript";if(c.support.scriptEval)d.appendChild(s.createTextNode(a));else d.text=a;b.insertBefore(d,b.firstChild);b.removeChild(d)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,d){var f,e=0,j=a.length,i=j===w||c.isFunction(a);if(d)if(i)for(f in a){if(b.apply(a[f],
-d)===false)break}else for(;e<j;){if(b.apply(a[e++],d)===false)break}else if(i)for(f in a){if(b.call(a[f],f,a[f])===false)break}else for(d=a[0];e<j&&b.call(d,e,d)!==false;d=a[++e]);return a},trim:function(a){return(a||"").replace(Wa,"")},makeArray:function(a,b){b=b||[];if(a!=null)a.length==null||typeof a==="string"||c.isFunction(a)||typeof a!=="function"&&a.setInterval?ba.call(b,a):c.merge(b,a);return b},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var d=0,f=b.length;d<f;d++)if(b[d]===
-a)return d;return-1},merge:function(a,b){var d=a.length,f=0;if(typeof b.length==="number")for(var e=b.length;f<e;f++)a[d++]=b[f];else for(;b[f]!==w;)a[d++]=b[f++];a.length=d;return a},grep:function(a,b,d){for(var f=[],e=0,j=a.length;e<j;e++)!d!==!b(a[e],e)&&f.push(a[e]);return f},map:function(a,b,d){for(var f=[],e,j=0,i=a.length;j<i;j++){e=b(a[j],j,d);if(e!=null)f[f.length]=e}return f.concat.apply([],f)},guid:1,proxy:function(a,b,d){if(arguments.length===2)if(typeof b==="string"){d=a;a=d[b];b=w}else if(b&&
-!c.isFunction(b)){d=b;b=w}if(!b&&a)b=function(){return a.apply(d||this,arguments)};if(a)b.guid=a.guid=a.guid||b.guid||c.guid++;return b},uaMatch:function(a){a=a.toLowerCase();a=/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||!/compatible/.test(a)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}},browser:{}});P=c.uaMatch(P);if(P.browser){c.browser[P.browser]=true;c.browser.version=P.version}if(c.browser.webkit)c.browser.safari=
-true;if(ya)c.inArray=function(a,b){return ya.call(b,a)};T=c(s);if(s.addEventListener)L=function(){s.removeEventListener("DOMContentLoaded",L,false);c.ready()};else if(s.attachEvent)L=function(){if(s.readyState==="complete"){s.detachEvent("onreadystatechange",L);c.ready()}};(function(){c.support={};var a=s.documentElement,b=s.createElement("script"),d=s.createElement("div"),f="script"+J();d.style.display="none";d.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
-var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected,
-parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent=
-false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n=
-s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true,
-applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando];
-else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this,
-a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===
-w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i,
-cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1)if(e.className){for(var j=" "+e.className+" ",
-i=e.className,o=0,k=b.length;o<k;o++)if(j.indexOf(" "+b[o]+" ")<0)i+=" "+b[o];e.className=c.trim(i)}else e.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(k){var n=c(this);n.removeClass(a.call(this,k,n.attr("class")))});if(a&&typeof a==="string"||a===w)for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1&&e.className)if(a){for(var j=(" "+e.className+" ").replace(Aa," "),i=0,o=b.length;i<o;i++)j=j.replace(" "+b[i]+" ",
-" ");e.className=c.trim(j)}else e.className=""}return this},toggleClass:function(a,b){var d=typeof a,f=typeof b==="boolean";if(c.isFunction(a))return this.each(function(e){var j=c(this);j.toggleClass(a.call(this,e,j.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var e,j=0,i=c(this),o=b,k=a.split(ca);e=k[j++];){o=f?o:!i.hasClass(e);i[o?"addClass":"removeClass"](e)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,"__className__",this.className);this.className=
-this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(Aa," ").indexOf(a)>-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j<d;j++){var i=
-e[j];if(i.selected){a=c(i).val();if(b)return a;f.push(a)}}return f}if(Ba.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Za,"")}return w}var o=c.isFunction(a);return this.each(function(k){var n=c(this),r=a;if(this.nodeType===1){if(o)r=a.call(this,k,n.val());if(typeof r==="number")r+="";if(c.isArray(r)&&Ba.test(this.type))this.checked=c.inArray(n.val(),r)>=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected=
-c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");
-a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g,
-function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split(".");
-k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a),
-C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B<r.length;B++){u=r[B];if(d.guid===u.guid){if(i||k.test(u.namespace)){f==null&&r.splice(B--,1);n.remove&&n.remove.call(a,u)}if(f!=
-null)break}}if(r.length===0||f!=null&&r.length===1){if(!n.teardown||n.teardown.call(a,o)===false)Ca(a,e,z.handle);delete C[e]}}else for(var B=0;B<r.length;B++){u=r[B];if(i||k.test(u.namespace)){c.event.remove(a,n,u.handler,B);r.splice(B--,1)}}}if(c.isEmptyObject(C)){if(b=z.handle)b.elem=null;delete z.events;delete z.handle;c.isEmptyObject(z)&&c.removeData(a)}}}}},trigger:function(a,b,d,f){var e=a.type||a;if(!f){a=typeof a==="object"?a[G]?a:c.extend(c.Event(e),a):c.Event(e);if(e.indexOf("!")>=0){a.type=
-e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&&
-f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;
-if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e<j;e++){var i=d[e];if(b||f.test(i.namespace)){a.handler=i.handler;a.data=i.data;a.handleObj=i;i=i.handler.apply(this,arguments);if(i!==w){a.result=i;if(i===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
-fix:function(a){if(a[G])return a;var b=a;a=c.Event(b);for(var d=this.props.length,f;d;){f=this.props[--d];a[f]=b[f]}if(!a.target)a.target=a.srcElement||s;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=s.documentElement;d=s.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop||
-d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(!a.which&&(a.charCode||a.charCode===0?a.charCode:a.keyCode))a.which=a.charCode||a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==w)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a){c.event.add(this,a.origType,c.extend({},a,{handler:oa}))},remove:function(a){var b=true,d=a.origType.replace(O,"");c.each(c.data(this,
-"events").live||[],function(){if(d===this.origType.replace(O,""))return b=false});b&&c.event.remove(this,a.origType,oa)}},beforeunload:{setup:function(a,b,d){if(this.setInterval)this.onbeforeunload=d;return false},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};var Ca=s.removeEventListener?function(a,b,d){a.removeEventListener(b,d,false)}:function(a,b,d){a.detachEvent("on"+b,d)};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=
-a;this.type=a.type}else this.type=a;this.timeStamp=J();this[G]=true};c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=Z;var a=this.originalEvent;if(a){a.preventDefault&&a.preventDefault();a.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=Z;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Z;this.stopPropagation()},isDefaultPrevented:Y,isPropagationStopped:Y,
-isImmediatePropagationStopped:Y};var Da=function(a){var b=a.relatedTarget;try{for(;b&&b!==this;)b=b.parentNode;if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}}catch(d){}},Ea=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?Ea:Da,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?Ea:Da)}}});if(!c.support.submitBubbles)c.event.special.submit=
-{setup:function(){if(this.nodeName.toLowerCase()!=="form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length)return na("submit",this,arguments)});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13)return na("submit",this,arguments)})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}};
-if(!c.support.changeBubbles){var da=/textarea|input|select/i,ea,Fa=function(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",
-e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,
-"_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a,
-d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j<o;j++)c.event.add(this[j],d,i,f)}return this}});c.fn.extend({unbind:function(a,b){if(typeof a==="object"&&
-!a.preventDefault)for(var d in a)this.unbind(d,a[d]);else{d=0;for(var f=this.length;d<f;d++)c.event.remove(this[d],a,b)}return this},delegate:function(a,b,d,f){return this.live(b,d,f,a)},undelegate:function(a,b,d){return arguments.length===0?this.unbind("live"):this.die(b,null,d,a)},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){a=c.Event(a);a.preventDefault();a.stopPropagation();c.event.trigger(a,b,this[0]);return a.result}},
-toggle:function(a){for(var b=arguments,d=1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(f){var e=(c.data(this,"lastToggle"+a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,e+1);f.preventDefault();return b[e].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var Ga={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};c.each(["live","die"],function(a,b){c.fn[b]=function(d,f,e,j){var i,o=0,k,n,r=j||this.selector,
-u=j?this:c(this.context);if(c.isFunction(f)){e=f;f=w}for(d=(d||"").split(" ");(i=d[o++])!=null;){j=O.exec(i);k="";if(j){k=j[0];i=i.replace(O,"")}if(i==="hover")d.push("mouseenter"+k,"mouseleave"+k);else{n=i;if(i==="focus"||i==="blur"){d.push(Ga[i]+k);i+=k}else i=(Ga[i]||i)+k;b==="live"?u.each(function(){c.event.add(this,pa(i,r),{data:f,selector:r,handler:e,origType:i,origHandler:e,preType:n})}):u.unbind(pa(i,r),e)}}return this}});c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),
-function(a,b){c.fn[b]=function(d){return d?this.bind(b,d):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});A.attachEvent&&!A.addEventListener&&A.attachEvent("onunload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});(function(){function a(g){for(var h="",l,m=0;g[m];m++){l=g[m];if(l.nodeType===3||l.nodeType===4)h+=l.nodeValue;else if(l.nodeType!==8)h+=a(l.childNodes)}return h}function b(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];
-if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1&&!p){t.sizcache=l;t.sizset=q}if(t.nodeName.toLowerCase()===h){y=t;break}t=t[g]}m[q]=y}}}function d(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1){if(!p){t.sizcache=l;t.sizset=q}if(typeof h!=="string"){if(t===h){y=true;break}}else if(k.filter(h,[t]).length>0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
-e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift();
-t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D||
-g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h<g.length;h++)g[h]===g[h-1]&&g.splice(h--,1)}return g};k.matches=function(g,h){return k(g,null,null,h)};k.find=function(g,h,l){var m,q;if(!g)return[];
-for(var p=0,v=n.order.length;p<v;p++){var t=n.order[p];if(q=n.leftMatch[t].exec(g)){var y=q[1];q.splice(1,1);if(y.substr(y.length-1)!=="\\"){q[1]=(q[1]||"").replace(/\\/g,"");m=n.find[t](q,h,l);if(m!=null){g=g.replace(n.match[t],"");break}}}}m||(m=h.getElementsByTagName("*"));return{set:m,expr:g}};k.filter=function(g,h,l,m){for(var q=g,p=[],v=h,t,y,S=h&&h[0]&&x(h[0]);g&&h.length;){for(var H in n.filter)if((t=n.leftMatch[H].exec(g))!=null&&t[2]){var M=n.filter[H],I,D;D=t[1];y=false;t.splice(1,1);if(D.substr(D.length-
-1)!=="\\"){if(v===p)p=[];if(n.preFilter[H])if(t=n.preFilter[H](t,v,l,p,m,S)){if(t===true)continue}else y=I=true;if(t)for(var U=0;(D=v[U])!=null;U++)if(D){I=M(D,t,U,v);var Ha=m^!!I;if(l&&I!=null)if(Ha)y=true;else v[U]=false;else if(Ha){p.push(D);y=true}}if(I!==w){l||(v=p);g=g.replace(n.match[H],"");if(!y)return[];break}}}if(g===q)if(y==null)k.error(g);else break;q=g}return v};k.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var n=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,
-CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}},
-relative:{"+":function(g,h){var l=typeof h==="string",m=l&&!/\W/.test(h);l=l&&!m;if(m)h=h.toLowerCase();m=0;for(var q=g.length,p;m<q;m++)if(p=g[m]){for(;(p=p.previousSibling)&&p.nodeType!==1;);g[m]=l||p&&p.nodeName.toLowerCase()===h?p||false:p===h}l&&k.filter(h,g,true)},">":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m<q;m++){var p=g[m];if(p){l=p.parentNode;g[m]=l.nodeName.toLowerCase()===h?l:false}}}else{m=0;for(q=g.length;m<q;m++)if(p=g[m])g[m]=
-l?p.parentNode:p.parentNode===h;l&&k.filter(h,g,true)}},"":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("parentNode",h,m,g,p,l)},"~":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("previousSibling",h,m,g,p,l)}},find:{ID:function(g,h,l){if(typeof h.getElementById!=="undefined"&&!l)return(g=h.getElementById(g[1]))?[g]:[]},NAME:function(g,h){if(typeof h.getElementsByName!=="undefined"){var l=[];
-h=h.getElementsByName(g[1]);for(var m=0,q=h.length;m<q;m++)h[m].getAttribute("name")===g[1]&&l.push(h[m]);return l.length===0?null:l}},TAG:function(g,h){return h.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,h,l,m,q,p){g=" "+g[1].replace(/\\/g,"")+" ";if(p)return g;p=0;for(var v;(v=h[p])!=null;p++)if(v)if(q^(v.className&&(" "+v.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},
-CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m,
-g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},
-text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},
-setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return h<l[3]-0},gt:function(g,h,l){return h>l[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h=
-h[3];l=0;for(m=h.length;l<m;l++)if(h[l]===g)return false;return true}else k.error("Syntax error, unrecognized expression: "+q)},CHILD:function(g,h){var l=h[1],m=g;switch(l){case "only":case "first":for(;m=m.previousSibling;)if(m.nodeType===1)return false;if(l==="first")return true;m=g;case "last":for(;m=m.nextSibling;)if(m.nodeType===1)return false;return true;case "nth":l=h[2];var q=h[3];if(l===1&&q===0)return true;h=h[0];var p=g.parentNode;if(p&&(p.sizcache!==h||!g.nodeIndex)){var v=0;for(m=p.firstChild;m;m=
-m.nextSibling)if(m.nodeType===1)m.nodeIndex=++v;p.sizcache=h}g=g.nodeIndex-q;return l===0?g===0:g%l===0&&g/l>=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m===
-"="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g,
-h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l<m;l++)h.push(g[l]);else for(l=0;g[l];l++)h.push(g[l]);return h}}var B;if(s.documentElement.compareDocumentPosition)B=function(g,h){if(!g.compareDocumentPosition||
-!h.compareDocumentPosition){if(g==h)i=true;return g.compareDocumentPosition?-1:1}g=g.compareDocumentPosition(h)&4?-1:g===h?0:1;if(g===0)i=true;return g};else if("sourceIndex"in s.documentElement)B=function(g,h){if(!g.sourceIndex||!h.sourceIndex){if(g==h)i=true;return g.sourceIndex?-1:1}g=g.sourceIndex-h.sourceIndex;if(g===0)i=true;return g};else if(s.createRange)B=function(g,h){if(!g.ownerDocument||!h.ownerDocument){if(g==h)i=true;return g.ownerDocument?-1:1}var l=g.ownerDocument.createRange(),m=
-h.ownerDocument.createRange();l.setStart(g,0);l.setEnd(g,0);m.setStart(h,0);m.setEnd(h,0);g=l.compareBoundaryPoints(Range.START_TO_END,m);if(g===0)i=true;return g};(function(){var g=s.createElement("div"),h="script"+(new Date).getTime();g.innerHTML="<a name='"+h+"'/>";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&&
-q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML="<a href='#'></a>";
-if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="<p class='TEST'></p>";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}();
-(function(){var g=s.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}:
-function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q<p;q++)k(g,h[q],l);return k.filter(m,l)};c.find=k;c.expr=k.selectors;c.expr[":"]=c.expr.filters;c.unique=k.uniqueSort;c.text=a;c.isXMLDoc=x;c.contains=E})();var eb=/Until$/,fb=/^(?:parents|prevUntil|prevAll)/,
-gb=/,/;R=Array.prototype.slice;var Ia=function(a,b,d){if(c.isFunction(b))return c.grep(a,function(e,j){return!!b.call(e,j,e)===d});else if(b.nodeType)return c.grep(a,function(e){return e===b===d});else if(typeof b==="string"){var f=c.grep(a,function(e){return e.nodeType===1});if(Ua.test(b))return c.filter(b,f,!d);else b=c.filter(b,f)}return c.grep(a,function(e){return c.inArray(e,b)>=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f<e;f++){d=b.length;
-c.find(a,this[f],b);if(f>0)for(var j=d;j<b.length;j++)for(var i=0;i<d;i++)if(b[i]===b[j]){b.splice(j--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=0,f=b.length;d<f;d++)if(c.contains(this,b[d]))return true})},not:function(a){return this.pushStack(Ia(this,a,false),"not",a)},filter:function(a){return this.pushStack(Ia(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j=
-{},i;if(f&&a.length){e=0;for(var o=a.length;e<o;e++){i=a[e];j[i]||(j[i]=c.expr.match.POS.test(i)?c(i,b||this.context):i)}for(;f&&f.ownerDocument&&f!==b;){for(i in j){e=j[i];if(e.jquery?e.index(f)>-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a===
-"string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",
-d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?
-a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType===
-1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/<tbody/i,jb=/<|&#?\w+;/,ta=/<script|<object|<embed|<option|<style/i,ua=/checked\s*(?:[^=]|=\s*.checked.)/i,Ma=function(a,b,d){return hb.test(d)?
-a:b+"></"+d+">"},F={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=
-c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},
-wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},
-prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,
-this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild);
-return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja,
-""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){c.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(f){this.empty().append(a)}}else c.isFunction(a)?this.each(function(e){var j=c(this),i=j.html();j.empty().append(function(){return a.call(this,e,i)})}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&
-this[0].parentNode){if(c.isFunction(a))return this.each(function(b){var d=c(this),f=d.html();d.replaceWith(a.call(this,b,f))});if(typeof a!=="string")a=c(a).detach();return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,d){function f(u){return c.nodeName(u,"table")?u.getElementsByTagName("tbody")[0]||
-u.appendChild(u.ownerDocument.createElement("tbody")):u}var e,j,i=a[0],o=[],k;if(!c.support.checkClone&&arguments.length===3&&typeof i==="string"&&ua.test(i))return this.each(function(){c(this).domManip(a,b,d,true)});if(c.isFunction(i))return this.each(function(u){var z=c(this);a[0]=i.call(this,u,b?z.html():w);z.domManip(a,b,d)});if(this[0]){e=i&&i.parentNode;e=c.support.parentNode&&e&&e.nodeType===11&&e.childNodes.length===this.length?{fragment:e}:sa(a,this,o);k=e.fragment;if(j=k.childNodes.length===
-1?(k=k.firstChild):k.firstChild){b=b&&c.nodeName(j,"tr");for(var n=0,r=this.length;n<r;n++)d.call(b?f(this[n],j):this[n],n>0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]);
-return this}else{e=0;for(var j=d.length;e<j;e++){var i=(e>0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["",
-""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]==="<table>"&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e=
-c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]?
-c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja=
-function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter=
-Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a,
-"border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f=
-a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=
-a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=/<script(.|\s)*?\/script>/gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!==
-"string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("<div />").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this},
-serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),
-function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,
-global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&&
-e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)?
-"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache===
-false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B=
-false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since",
-c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E||
-d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x);
-g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===
-1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b===
-"json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional;
-if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");
-this[a].style.display=d||"";if(c.css(this[a],"display")==="none"){d=this[a].nodeName;var f;if(la[d])f=la[d];else{var e=c("<"+d+" />").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a<b;a++)this[a].style.display=c.data(this[a],"olddisplay")||"";return this}},hide:function(a,b){if(a||a===0)return this.animate(K("hide",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");!d&&d!=="none"&&c.data(this[a],
-"olddisplay",c.css(this[a],"display"))}a=0;for(b=this.length;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b){var d=typeof a==="boolean";if(c.isFunction(a)&&c.isFunction(b))this._toggle.apply(this,arguments);else a==null||d?this.each(function(){var f=d?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(K("toggle",3),a,b);return this},fadeTo:function(a,b,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d)},
-animate:function(a,b,d,f){var e=c.speed(b,d,f);if(c.isEmptyObject(a))return this.each(e.complete);return this[e.queue===false?"each":"queue"](function(){var j=c.extend({},e),i,o=this.nodeType===1&&c(this).is(":hidden"),k=this;for(i in a){var n=i.replace(ia,ja);if(i!==n){a[n]=a[i];delete a[i];i=n}if(a[i]==="hide"&&o||a[i]==="show"&&!o)return j.complete.call(this);if((i==="height"||i==="width")&&this.style){j.display=c.css(this,"display");j.overflow=this.style.overflow}if(c.isArray(a[i])){(j.specialEasing=
-j.specialEasing||{})[i]=a[i][1];a[i]=a[i][0]}}if(j.overflow!=null)this.style.overflow="hidden";j.curAnim=c.extend({},a);c.each(a,function(r,u){var z=new c.fx(k,j,r);if(Ab.test(u))z[u==="toggle"?o?"show":"hide":u](a);else{var C=Bb.exec(u),B=z.cur(true)||0;if(C){u=parseFloat(C[2]);var E=C[3]||"px";if(E!=="px"){k.style[r]=(u||1)+E;B=(u||1)/z.cur(true)*B;k.style[r]=B+E}if(C[1])u=(C[1]==="-="?-1:1)*u+B;z.custom(B,u,E)}else z.custom(B,u,"")}});return true})},stop:function(a,b){var d=c.timers;a&&this.queue([]);
-this.each(function(){for(var f=d.length-1;f>=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration===
-"number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||
-c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;
-this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=
-this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem,
-e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||
-c.fx.stop()},stop:function(){clearInterval(W);W=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===b.elem}).length};c.fn.offset="getBoundingClientRect"in s.documentElement?
-function(a){var b=this[0];if(a)return this.each(function(e){c.offset.setOffset(this,a,e)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);var d=b.getBoundingClientRect(),f=b.ownerDocument;b=f.body;f=f.documentElement;return{top:d.top+(self.pageYOffset||c.support.boxModel&&f.scrollTop||b.scrollTop)-(f.clientTop||b.clientTop||0),left:d.left+(self.pageXOffset||c.support.boxModel&&f.scrollLeft||b.scrollLeft)-(f.clientLeft||b.clientLeft||0)}}:function(a){var b=
-this[0];if(a)return this.each(function(r){c.offset.setOffset(this,a,r)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d=b.offsetParent,f=b,e=b.ownerDocument,j,i=e.documentElement,o=e.body;f=(e=e.defaultView)?e.getComputedStyle(b,null):b.currentStyle;for(var k=b.offsetTop,n=b.offsetLeft;(b=b.parentNode)&&b!==o&&b!==i;){if(c.offset.supportsFixedPosition&&f.position==="fixed")break;j=e?e.getComputedStyle(b,null):b.currentStyle;
-k-=b.scrollTop;n-=b.scrollLeft;if(b===d){k+=b.offsetTop;n+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(b.nodeName))){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=d;d=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&j.overflow!=="visible"){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=j}if(f.position==="relative"||f.position==="static"){k+=o.offsetTop;n+=o.offsetLeft}if(c.offset.supportsFixedPosition&&
-f.position==="fixed"){k+=Math.max(i.scrollTop,o.scrollTop);n+=Math.max(i.scrollLeft,o.scrollLeft)}return{top:k,left:n}};c.offset={initialize:function(){var a=s.body,b=s.createElement("div"),d,f,e,j=parseFloat(c.curCSS(a,"marginTop",true))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";
-a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b);
-c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a,
-d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top-
-f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset":
-"pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in
-e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window);
[18/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/UnspecifiedProfileElement.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/UnspecifiedProfileElement.java b/profile/src/main/java/org/apache/oodt/profile/UnspecifiedProfileElement.java
deleted file mode 100644
index 6c1a358..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/UnspecifiedProfileElement.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile;
-
-import java.io.Serializable;
-import java.util.Collections;
-import java.util.List;
-import org.w3c.dom.Node;
-import org.apache.jena.rdf.model.Model;
-import org.apache.jena.rdf.model.Resource;
-import java.net.URI;
-
-/**
- * A profile element with unspecified values.
-
- * This is a profile element that is not enumerated (it doesn't have listed values, and so
- * <code><elemEnumFlag></code> is false), nor does it have minimum or maximum
- * values. As such, it always matches any query in which it's involved in an expression.
- *
- * @author Kelly
- */
-public class UnspecifiedProfileElement extends ProfileElement implements Serializable, Cloneable {
- /**
- * Creates a profile element.
- *
- * @param profile a <code>Profile</code> value.
- */
- public UnspecifiedProfileElement(Profile profile) {
- super(profile);
- }
-
- /**
- * Create a profile element from constituent attributes.
- *
- * @param profile Profile to which this element belongs.
- * @param name Required name of the element.
- * @param id ID of the element.
- * @param desc Long description of the element.
- * @param type Data type of the element.
- * @param unit Units.
- * @param synonyms Collection of element IDs ({@link String}) that are synonyms for this element.
- * @param obligation True if this is a required element
- * @param maxOccurrence Maximum number of occurrences of this element.
- * @param comment Any comments about this element.
- */
- public UnspecifiedProfileElement(Profile profile, String name, String id, String desc, String type, String unit,
- List synonyms, boolean obligation, int maxOccurrence, String comment) {
- super(profile, name, id, desc, type, unit, synonyms, obligation, maxOccurrence, comment);
- }
-
- public List getValues() {
- return Collections.EMPTY_LIST;
- }
-
- public String getMinValue() {
- return "";
- }
-
- public String getMaxValue() {
- return "";
- }
-
- protected boolean isEnumerated() {
- return false;
- }
-
- protected void addValues(Node node) {}
-
- protected void addElementSpecificProperties(Model model, Resource element, ProfileAttributes profAttr, URI uri) {}
-
- /** Serial version unique ID. */
- static final long serialVersionUID = -3717582969125927629L;
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/Utility.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/Utility.java b/profile/src/main/java/org/apache/oodt/profile/Utility.java
deleted file mode 100644
index 86ac062..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/Utility.java
+++ /dev/null
@@ -1,254 +0,0 @@
-// 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.
-
-package org.apache.oodt.profile;
-
-import org.apache.oodt.commons.Configuration;
-
-import java.io.IOException;
-
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-import org.apache.jena.rdf.model.Model;
-import org.apache.jena.rdf.model.ModelFactory;
-import org.apache.jena.rdf.model.Resource;
-import org.apache.jena.rdf.model.Property;
-
-import java.util.Collection;
-
-import org.apache.jena.rdf.model.Bag;
-import org.apache.jena.rdf.model.Seq;
-
-import java.util.List;
-import java.net.URI;
-
-/**
- * Profile utilities.
- *
- * Utility methods for profiles.
- *
- * @author Kelly
- */
-class Utility {
- /**
- * Don't call because this is a utiliy class.
- */
- private Utility() {
- throw new IllegalStateException("Utility class");
- }
-
- static void addProperty(Model model, Resource resource, Property property, Object value, ProfileAttributes profAttr,
- URI uri) {
-
- if (value == null || value.toString().length() == 0) {
- return;
- }
-
- Object obj;
- if (value instanceof Collection) {
- Collection<?> collection = (Collection<?>) value;
- if (collection.isEmpty()) {
- return;
- }
- Bag bag = model.createBag(uri + "_" + property.getLocalName() + "_bag");
- for (Object aCollection : collection) {
- bag.add(aCollection);
- }
- resource.addProperty(property, bag);
- obj = bag;
- } else {
- resource.addProperty(property, value.toString());
- obj = value;
- }
-
- Resource reification = model.createResource(uri + "_" + property.getLocalName() + "_reification");
-
- reification.addProperty(rdfSubject, resource);
- reification.addProperty(rdfPredicate, property);
- reification.addProperty(rdfObject, obj.toString());
- reification.addProperty(rdfType, rdfStatement);
-
- addPotentiallyNullReifiedStatement(reification, edmID, profAttr.getVersion());
- addPotentiallyNullReifiedStatement(reification, edmVersion, profAttr.getVersion());
- addPotentiallyNullReifiedStatement(reification, edmType, profAttr.getType());
- addPotentiallyNullReifiedStatement(reification, edmStatus, profAttr.getStatusID());
- addPotentiallyNullReifiedStatement(reification, edmSecurity, profAttr.getSecurityType());
- addPotentiallyNullReifiedStatement(reification, edmParent, profAttr.getParent());
- addPotentiallyNullReifiedStatement(reification, edmRegAuth, profAttr.getRegAuthority());
-
- List<?> children = profAttr.getChildren();
- if (!children.isEmpty()) {
- Bag bag = model.createBag(uri + "_" + property.getLocalName() + "_childrenBag");
- for (Object aChildren : children) {
- bag.add(aChildren);
- }
- reification.addProperty(edmChild, bag);
- }
-
- List<?> revNotes = profAttr.getRevisionNotes();
- if (!revNotes.isEmpty()) {
- Seq seq = model.createSeq(uri + "_" + property.getLocalName() + "_revNotesSeq");
- for (Object revNote : revNotes) {
- seq.add(revNote);
- }
- reification.addProperty(edmRevNote, seq);
- }
- }
-
- private static void addPotentiallyNullReifiedStatement(Resource reification, Property property, Object value) {
- if (value == null || value.toString().length() == 0) {
- return;
- }
- reification.addProperty(property, value.toString());
- }
-
-
- /** Dublin core's title */
- static Property dcTitle;
- static Property dcSubject;
- static Property dcDescription;
- static Property dcPublisher;
- static Property dcContributor;
- static Property dcCreator;
- static Property dcDate;
- static Property dcType;
- static Property dcFormat;
- static Property dcSource;
- static Property dcLanguage;
- static Property dcRelation;
- static Property dcCoverage;
- static Property dcRights;
-
- /** A resource that is an RDF statement. */
- static Resource rdfStatement;
-
- /** A property that is an RDF subject of a statement. */
- static Property rdfSubject;
-
- /** A property that is an RDF predicate of a statement. */
- static Property rdfPredicate;
-
- /** A property that is an object of a statement. */
- static Property rdfObject;
-
- /** A property that names the type of an RDF resource. */
- static Property rdfType;
-
- private static final String RDF_SYNTAX_NS = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
-
- private static final String DC_NS = "http://purl.org/dc/elements/1.1/";
-
- private static Property edmID;
- private static Property edmVersion;
- private static Property edmType;
- private static Property edmStatus;
- private static Property edmSecurity;
- private static Property edmParent;
- private static Property edmChild;
- private static Property edmRegAuth;
- private static Property edmRevNote;
-
- static Property edmElement;
- static Property edmContext;
- static Property edmAggregation;
- static Property edmClass;
- static Property edmLocation;
- static Property edmElemID;
- static Property edmDescription;
- static Property edmElemType;
- static Property edmUnit;
- static Property edmSynonym;
- static Property edmObligation;
- static Property edmMaxOccurrence;
- static Property edmComment;
- static Property edmMinValue;
- static Property edmMaxValue;
- static Property edmValue;
-
- /**
- * Initialize this class.
- */
- static {
- try {
- @SuppressWarnings("unused")
- Configuration config = Configuration.getConfiguration();
- String profNS = System.getProperty("jpl.rdf.ns", "http://oodt.jpl.nasa.gov/grid-profile/rdfs/prof.rdf");
- Model model = ModelFactory.createDefaultModel();
-
- rdfStatement = model.createResource(RDF_SYNTAX_NS + "Statement");
-
- rdfSubject = model.createProperty(RDF_SYNTAX_NS, "subject");
- rdfPredicate = model.createProperty(RDF_SYNTAX_NS, "predicate");
- rdfObject = model.createProperty(RDF_SYNTAX_NS, "object");
- rdfType = model.createProperty(RDF_SYNTAX_NS, "type");
-
- dcTitle = model.createProperty(DC_NS, "title");
- dcCreator = model.createProperty(DC_NS, "creator");
- dcSubject = model.createProperty(DC_NS, "subject");
- dcDescription = model.createProperty(DC_NS, "description");
- dcPublisher = model.createProperty(DC_NS, "publisher");
- dcContributor = model.createProperty(DC_NS, "contributor");
- dcDate = model.createProperty(DC_NS, "date");
- dcType = model.createProperty(DC_NS, "type");
- dcFormat = model.createProperty(DC_NS, "format");
- dcSource = model.createProperty(DC_NS, "source");
- dcLanguage = model.createProperty(DC_NS, "language");
- dcRelation = model.createProperty(DC_NS, "relation");
- dcCoverage = model.createProperty(DC_NS, "coverage");
- dcRights = model.createProperty(DC_NS, "rights");
-
- edmID = model.createProperty(profNS, "id");
- edmVersion = model.createProperty(profNS, "version");
- edmType = model.createProperty(profNS, "type");
- edmStatus = model.createProperty(profNS, "status");
- edmSecurity = model.createProperty(profNS, "security");
- edmParent = model.createProperty(profNS, "parent");
- edmChild = model.createProperty(profNS, "child");
- edmRegAuth = model.createProperty(profNS, "regAuth");
- edmRevNote = model.createProperty(profNS, "revNote");
- edmElement = model.createProperty(profNS, "element");
- edmContext = model.createProperty(profNS, "context");
- edmClass = model.createProperty(profNS, "class");
- edmAggregation = model.createProperty(profNS, "aggregation");
- edmLocation = model.createProperty(profNS, "location");
-
- edmElemID = model.createProperty(profNS, "edmElemID");
- edmDescription = model.createProperty(profNS, "edmDescription");
- edmElemType = model.createProperty(profNS, "edmElemType");
- edmUnit = model.createProperty(profNS, "edmUnit");
- edmSynonym = model.createProperty(profNS, "edmSynonym");
- edmObligation = model.createProperty(profNS, "edmObligation");
- edmMaxOccurrence = model.createProperty(profNS, "edmMaxOccurrence");
- edmComment = model.createProperty(profNS, "edmComment");
- edmMinValue = model.createProperty(profNS, "edmMinValue");
- edmMaxValue = model.createProperty(profNS, "edmMaxValue");
- edmValue = model.createProperty(profNS, "edmValue");
-
- } catch (IOException ex) {
- System.err.println("Fatal I/O error prevents reading of configuration: " + ex.getMessage());
- System.exit(1);
- } catch (SAXParseException ex) {
- System.err.println("Fatal error parsing file (public ID \"" + ex.getPublicId() + "\", system ID \""
- + ex.getSystemId() + "\"), line " + ex.getLineNumber() + " column " + ex.getColumnNumber()
- + ": " + ex.getMessage());
- System.exit(1);
- } catch (SAXException ex) {
- System.err.println("Fatal SAX exception: " + ex.getMessage() + (ex.getException() == null? ""
- : " (embedded exception " + ex.getException().getClass().getName() + ": "
- + ex.getException().getMessage() + ")"));
- System.exit(1);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/activity/ConnectedToServer.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/activity/ConnectedToServer.java b/profile/src/main/java/org/apache/oodt/profile/activity/ConnectedToServer.java
deleted file mode 100644
index 3b0fa6a..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/activity/ConnectedToServer.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile.activity;
-
-import org.apache.oodt.commons.activity.Incident;
-
-public class ConnectedToServer extends Incident {
- /** Serial version unique ID */
- static final long serialVersionUID = 11593677192131322L;
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/activity/ProfileClientConstructed.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/activity/ProfileClientConstructed.java b/profile/src/main/java/org/apache/oodt/profile/activity/ProfileClientConstructed.java
deleted file mode 100644
index 52a00fc..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/activity/ProfileClientConstructed.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile.activity;
-
-import org.apache.oodt.commons.activity.Incident;
-
-public class ProfileClientConstructed extends Incident {
- /** Serial version unique ID. */
- static final long serialVersionUID = 6229028649808262392L;
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/activity/QueriedHandlers.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/activity/QueriedHandlers.java b/profile/src/main/java/org/apache/oodt/profile/activity/QueriedHandlers.java
deleted file mode 100644
index d155a17..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/activity/QueriedHandlers.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile.activity;
-
-import org.apache.oodt.commons.activity.Incident;
-
-public class QueriedHandlers extends Incident {
- /** Serial version unique ID. */
- static final long serialVersionUID = -3845963004602982264L;
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/activity/ReceivedQuery.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/activity/ReceivedQuery.java b/profile/src/main/java/org/apache/oodt/profile/activity/ReceivedQuery.java
deleted file mode 100644
index a2bd723..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/activity/ReceivedQuery.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.profile.activity;
-
-import org.apache.oodt.commons.activity.Incident;
-
-public class ReceivedQuery extends Incident {
- /** Serial version unique ID. */
- static final long serialVersionUID = 3646406525260246714L;
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/gui/LeafListener.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/gui/LeafListener.java b/profile/src/main/java/org/apache/oodt/profile/gui/LeafListener.java
deleted file mode 100755
index b3dd729..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/gui/LeafListener.java
+++ /dev/null
@@ -1,288 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.profile.gui;
-
-import org.apache.oodt.profile.EnumeratedProfileElement;
-import org.apache.oodt.profile.Profile;
-import org.apache.oodt.profile.ProfileElement;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-
-import javax.swing.JMenuItem;
-import javax.swing.JOptionPane;
-import javax.swing.JPopupMenu;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.DefaultTreeModel;
-import javax.swing.tree.TreePath;
-
-
-
-public class LeafListener extends MouseAdapter{
- profileTree tree;
-
- public LeafListener(profileTree jtr){
-
- tree = jtr;
-
- }
-
- private boolean isValidMultiTerm(String t){
- if(t==null){return false;}
-
- if(t.equals("Children")){
- return true;
- }
- else if(t.equals("Revision Notes")){
- return true;
- }
- else if(t.equals("Contexts")){
- return true;
- }
- else if(t.equals("Contributors")){
- return true;
- }
- else if(t.equals("Coverages")){
- return true;
- }
- else if(t.equals("Creators")){
- return true;
- }
- else if(t.equals("Dates")){
- return true;
- }
- else if(t.equals("Formats")){
- return true;
- }
- else if(t.equals("Languages")){
- return true;
- }
- else if(t.equals("Resource Locations")){
- return true;
- }
- else if(t.equals("Publishers")){
- return true;
- }
- else if(t.equals("Relations")){
- return true;
- }
- else if(t.equals("Rights")){
- return true;
- }
- else if(t.equals("Sources")){
- return true;
- }
- else if(t.equals("Subjects")){
- return true;
- }
- else if(t.equals("Types")){
- return true;
- }
- else if(t.equals("Profile Elements")){
- return true;
- }
- else if(t.equals("Synonyms")){
- return true;
- }
-
- return false;
-
- }
-
- public DefaultMutableTreeNode generateNewProfileElementTree(String peName){
- DefaultMutableTreeNode peRoot;
-
- ProfileElement theProfileElement = new EnumeratedProfileElement(new Profile());
-
-
- peRoot = new DefaultMutableTreeNode(peName);
- DefaultMutableTreeNode theCommentsRoot = new DefaultMutableTreeNode("Comments");
- DefaultMutableTreeNode theComments = new DefaultMutableTreeNode(theProfileElement.getComments());
-
- theCommentsRoot.add(theComments);
-
- DefaultMutableTreeNode theDesc = new DefaultMutableTreeNode(theProfileElement.getDescription());
- DefaultMutableTreeNode theDescRoot = new DefaultMutableTreeNode("Description");
-
- theDescRoot.add(theDesc);
-
-
-
- DefaultMutableTreeNode theID = new DefaultMutableTreeNode(theProfileElement.getID());
- DefaultMutableTreeNode theIDRoot = new DefaultMutableTreeNode("ID");
-
- theIDRoot.add(theID);
-
- DefaultMutableTreeNode theMO = new DefaultMutableTreeNode(
- Integer.toString(theProfileElement.getMaxOccurrence()));
- DefaultMutableTreeNode theMORoot = new DefaultMutableTreeNode("Max Occurence");
- theMORoot.add(theMO);
-
- DefaultMutableTreeNode theSynonyms = new DefaultMutableTreeNode("Synonyms");
-
- for (Object o : theProfileElement.getSynonyms()) {
- String theSynonym = (String) o;
- DefaultMutableTreeNode sNode = new DefaultMutableTreeNode(theSynonym);
- theSynonyms.add(sNode);
- }
-
- DefaultMutableTreeNode theType = new DefaultMutableTreeNode(theProfileElement.getType());
- DefaultMutableTreeNode theTypeRoot = new DefaultMutableTreeNode("Type");
- theTypeRoot.add(theType);
-
-
- DefaultMutableTreeNode theUnit = new DefaultMutableTreeNode(theProfileElement.getUnit());
- DefaultMutableTreeNode theUnitRoot = new DefaultMutableTreeNode("Unit");
- theUnitRoot.add(theUnit);
-
- peRoot.add(theCommentsRoot);
- peRoot.add(theDescRoot);
- peRoot.add(theIDRoot);
- peRoot.add(theMORoot);
- peRoot.add(theSynonyms);
- peRoot.add(theTypeRoot);
- peRoot.add(theUnitRoot);
-
-
- return peRoot;
-
- }
-
- protected void menuItem2ActionPerformed(ActionEvent evt,DefaultMutableTreeNode theTreeNode,DefaultTreeModel theModel){
-
- //only add child if it's one of the things that should have children
- String treeNodeName = (String)theTreeNode.getUserObject();
-
- if(isValidMultiTerm(treeNodeName)){
- return; //only edit non multi-term fields
- }
-
-
- String newNodeName = (String)JOptionPane.showInputDialog(null,"Edit","Enter New Node Value", JOptionPane.PLAIN_MESSAGE,null,null,"New Value");
-
- if(newNodeName == null){return; } //they didn't specify name or hit cancel
- theTreeNode.setUserObject(newNodeName);
- theModel.reload();
- }
-
-
- protected void menuItem1ActionPerformed(ActionEvent evt,DefaultMutableTreeNode theTreeNode,DefaultTreeModel theModel){
-
- //only add child if it's one of the things that should have children
- String treeNodeName = (String)theTreeNode.getUserObject();
-
- if(!isValidMultiTerm(treeNodeName)){
- return;
- }
-
- DefaultMutableTreeNode theAddNode;
- String childNodeName = (String)JOptionPane.showInputDialog(null,"Add","Enter Node Name", JOptionPane.PLAIN_MESSAGE,null,null,"Child Value");
-
- if(childNodeName == null){return; } //they didn't specify name or hit cancel
-
- if(treeNodeName.equals("Profile Elements")){
- theAddNode = generateNewProfileElementTree(childNodeName);
- }
- else{
- theAddNode = new DefaultMutableTreeNode(childNodeName);
- }
-
-
-
- theTreeNode.add(theAddNode);
- theModel.reload();
- }
-
-
- public void mousePressed(MouseEvent e) {
-
- int selectedRow = tree.getRowForLocation(e.getX(), e.getY());
- TreePath selectedPath = tree.getPathForLocation(e.getX(), e.getY());
-
- if(selectedRow != -1) {
- DefaultMutableTreeNode tn //get end of current path
- = (DefaultMutableTreeNode)(selectedPath.getLastPathComponent());
-
- JMenuItem menuItem1 = new JMenuItem("Add");
- JMenuItem menuItem2 = new JMenuItem("Edit");
-
- menuItem2.addActionListener(new TreeNodeActionListener(tn,this,(DefaultTreeModel)tree.getModel(),"EDIT"));
- menuItem1.addActionListener(new TreeNodeActionListener(tn,this,(DefaultTreeModel)tree.getModel(),"ADD"));
- JPopupMenu popup = new JPopupMenu();
- popup.add(menuItem1);
- popup.add(menuItem2);
-
- if(e.isPopupTrigger()){
- popup.show(tree,e.getX(),e.getY());
- }
-
- }
- }
-
- public void mouseReleased(MouseEvent e) {
-
- int selectedRow = tree.getRowForLocation(e.getX(), e.getY());
- TreePath selectedPath = tree.getPathForLocation(e.getX(), e.getY());
-
- if(selectedRow != -1) {
- DefaultMutableTreeNode tn //get end of current path
- = (DefaultMutableTreeNode)(selectedPath.getLastPathComponent());
-
- JMenuItem menuItem1 = new JMenuItem("Add");
- JMenuItem menuItem2 = new JMenuItem("Edit");
-
- menuItem2.addActionListener(new TreeNodeActionListener(tn,this,(DefaultTreeModel)tree.getModel(),"EDIT"));
- menuItem1.addActionListener(new TreeNodeActionListener(tn,this,(DefaultTreeModel)tree.getModel(),"ADD"));
- JPopupMenu popup = new JPopupMenu();
- popup.add(menuItem1);
- popup.add(menuItem2);
-
- if(e.isPopupTrigger()){
- popup.show(tree,e.getX(),e.getY());
- }
-
- }
- }
-
- public class TreeNodeActionListener implements ActionListener{
- private DefaultMutableTreeNode myTreeNode = null;
- private DefaultTreeModel myTreeModel = null;
- private LeafListener theLeafListener=null;
- private String type=null;
-
- public TreeNodeActionListener(DefaultMutableTreeNode t,LeafListener l,DefaultTreeModel tm,String theType){
- myTreeNode = t;
- theLeafListener = l;
- myTreeModel = tm;
- type = theType;
- }
-
- public void actionPerformed(ActionEvent evt) {
- if(type.equals("ADD")){
- theLeafListener.menuItem1ActionPerformed(evt,myTreeNode,myTreeModel);
- }
- else if(type.equals("EDIT")){
- theLeafListener.menuItem2ActionPerformed(evt,myTreeNode,myTreeModel);
- }
- }
-
- }
-
- }
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/gui/ProfileBuilderGUI.form
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/gui/ProfileBuilderGUI.form b/profile/src/main/java/org/apache/oodt/profile/gui/ProfileBuilderGUI.form
deleted file mode 100755
index c0b9ff0..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/gui/ProfileBuilderGUI.form
+++ /dev/null
@@ -1,435 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<Form style="Swing" ide="eclipse" builder="jigloo" laf="com.sun.java.swing.plaf.windows.WindowsLookAndFeel" version="2.7.2">
-<ExtraComponents>
- <Component class="javax.swing.JMenuBar" name="jMenuBar1">
- <Constraints>
- <LayoutConstraint/>
- </Constraints>
- <Layout class="Box">
- <Property name="axis" value="null"/>
- </Layout>
- <Events>
- </Events>
- <Properties>
- <Property name="bounds" type="Rectangle">
- <Rectangle value="[0, 0, 675, 21]"/>
- </Property>
- </Properties>
- <SubComponents>
- <Component class="javax.swing.JMenu" name="jMenu3">
- <Constraints>
- <LayoutConstraint/>
- </Constraints>
- <Layout class="Absolute">
- </Layout>
- <Events>
- </Events>
- <Properties>
- <Property name="text" type="String" value="File"/>
- <Property name="visible" type="boolean" value="true"/>
- </Properties>
- <SubComponents>
- <Component class="javax.swing.JMenuItem" name="newFileMenuItem">
- <Constraints>
- <LayoutConstraint/>
- </Constraints>
- <Layout class="Absolute">
- </Layout>
- <Events>
- <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" handler="newFileMenuItemActionPerformed"/>
- </Events>
- <Properties>
- <Property name="text" type="String" value="New Profile"/>
- <Property name="visible" type="boolean" value="true"/>
- <Property name="preferredSize" type="Dimension">
- <Dimension value="[28, 16]"/>
- </Property>
- <Property name="bounds" type="Rectangle">
- <Rectangle value="[5, 5, 28, 16]"/>
- </Property>
- </Properties>
- </Component>
- <Component class="javax.swing.JMenuItem" name="openFileMenuItem">
- <Constraints>
- <LayoutConstraint/>
- </Constraints>
- <Layout class="Absolute">
- </Layout>
- <Events>
- <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" handler="openFileMenuItemActionPerformed"/>
- </Events>
- <Properties>
- <Property name="text" type="String" value="Open Profile"/>
- <Property name="visible" type="boolean" value="true"/>
- <Property name="bounds" type="Rectangle">
- <Rectangle value="[5, 5, 60, 30]"/>
- </Property>
- </Properties>
- </Component>
- <Component class="javax.swing.JMenuItem" name="saveMenuItem">
- <Constraints>
- <LayoutConstraint/>
- </Constraints>
- <Layout class="Absolute">
- </Layout>
- <Events>
- <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" handler="saveMenuItemActionPerformed"/>
- </Events>
- <Properties>
- <Property name="text" type="String" value="Save Profile"/>
- <Property name="visible" type="boolean" value="true"/>
- <Property name="verifyInputWhenFocusTarget" type="boolean" value="false"/>
- <Property name="bounds" type="Rectangle">
- <Rectangle value="[5, 5, 60, 30]"/>
- </Property>
- </Properties>
- </Component>
- <Component class="javax.swing.JMenuItem" name="closeFileMenuItem">
- <Constraints>
- <LayoutConstraint/>
- </Constraints>
- <Layout class="Absolute">
- </Layout>
- <Events>
- </Events>
- <Properties>
- <Property name="text" type="String" value="Close"/>
- <Property name="visible" type="boolean" value="true"/>
- <Property name="bounds" type="Rectangle">
- <Rectangle value="[5, 5, 60, 30]"/>
- </Property>
- </Properties>
- </Component>
- <Component class="javax.swing.JSeparator" name="jSeparator2">
- <Constraints>
- <LayoutConstraint/>
- </Constraints>
- <Layout class="Absolute">
- </Layout>
- <Events>
- </Events>
- <Properties>
- <Property name="visible" type="boolean" value="true"/>
- <Property name="bounds" type="Rectangle">
- <Rectangle value="[5, 5, 60, 30]"/>
- </Property>
- </Properties>
- </Component>
- <Component class="javax.swing.JMenuItem" name="exitMenuItem">
- <Constraints>
- <LayoutConstraint/>
- </Constraints>
- <Layout class="Absolute">
- </Layout>
- <Events>
- <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" handler="exitMenuItemActionPerformed"/>
- </Events>
- <Properties>
- <Property name="text" type="String" value="Exit"/>
- <Property name="visible" type="boolean" value="true"/>
- <Property name="bounds" type="Rectangle">
- <Rectangle value="[5, 5, 60, 30]"/>
- </Property>
- </Properties>
- </Component>
- </SubComponents>
- </Component>
- <Component class="javax.swing.JMenu" name="jMenu4">
- <Constraints>
- <LayoutConstraint/>
- </Constraints>
- <Layout class="Absolute">
- </Layout>
- <Events>
- </Events>
- <Properties>
- <Property name="text" type="String" value="Edit"/>
- <Property name="visible" type="boolean" value="true"/>
- </Properties>
- <SubComponents>
- <Component class="javax.swing.JMenuItem" name="cutMenuItem">
- <Constraints>
- <LayoutConstraint/>
- </Constraints>
- <Layout class="Absolute">
- </Layout>
- <Events>
- </Events>
- <Properties>
- <Property name="text" type="String" value="Cut"/>
- <Property name="visible" type="boolean" value="true"/>
- <Property name="preferredSize" type="Dimension">
- <Dimension value="[27, 16]"/>
- </Property>
- <Property name="bounds" type="Rectangle">
- <Rectangle value="[5, 5, 27, 16]"/>
- </Property>
- </Properties>
- </Component>
- <Component class="javax.swing.JMenuItem" name="copyMenuItem">
- <Constraints>
- <LayoutConstraint/>
- </Constraints>
- <Layout class="Absolute">
- </Layout>
- <Events>
- </Events>
- <Properties>
- <Property name="text" type="String" value="Copy"/>
- <Property name="visible" type="boolean" value="true"/>
- <Property name="bounds" type="Rectangle">
- <Rectangle value="[5, 5, 60, 30]"/>
- </Property>
- </Properties>
- </Component>
- <Component class="javax.swing.JMenuItem" name="pasteMenuItem">
- <Constraints>
- <LayoutConstraint/>
- </Constraints>
- <Layout class="Absolute">
- </Layout>
- <Events>
- </Events>
- <Properties>
- <Property name="text" type="String" value="Paste"/>
- <Property name="visible" type="boolean" value="true"/>
- <Property name="bounds" type="Rectangle">
- <Rectangle value="[5, 5, 60, 30]"/>
- </Property>
- </Properties>
- </Component>
- <Component class="javax.swing.JSeparator" name="jSeparator1">
- <Constraints>
- <LayoutConstraint/>
- </Constraints>
- <Layout class="Absolute">
- </Layout>
- <Events>
- </Events>
- <Properties>
- <Property name="visible" type="boolean" value="true"/>
- <Property name="bounds" type="Rectangle">
- <Rectangle value="[5, 5, 60, 30]"/>
- </Property>
- </Properties>
- </Component>
- <Component class="javax.swing.JMenuItem" name="deleteMenuItem">
- <Constraints>
- <LayoutConstraint/>
- </Constraints>
- <Layout class="Absolute">
- </Layout>
- <Events>
- </Events>
- <Properties>
- <Property name="text" type="String" value="Delete"/>
- <Property name="visible" type="boolean" value="true"/>
- <Property name="bounds" type="Rectangle">
- <Rectangle value="[5, 5, 60, 30]"/>
- </Property>
- </Properties>
- </Component>
- </SubComponents>
- </Component>
- <Component class="javax.swing.JMenu" name="jMenu5">
- <Constraints>
- <LayoutConstraint/>
- </Constraints>
- <Layout class="Absolute">
- </Layout>
- <Events>
- </Events>
- <Properties>
- <Property name="text" type="String" value="Help"/>
- <Property name="visible" type="boolean" value="true"/>
- </Properties>
- <SubComponents>
- <Component class="javax.swing.JMenuItem" name="helpMenuItem">
- <Constraints>
- <LayoutConstraint/>
- </Constraints>
- <Layout class="Absolute">
- </Layout>
- <Events>
- </Events>
- <Properties>
- <Property name="text" type="String" value="Help"/>
- <Property name="visible" type="boolean" value="true"/>
- <Property name="preferredSize" type="Dimension">
- <Dimension value="[31, 16]"/>
- </Property>
- <Property name="bounds" type="Rectangle">
- <Rectangle value="[5, 5, 31, 16]"/>
- </Property>
- </Properties>
- </Component>
- </SubComponents>
- </Component>
- </SubComponents>
- </Component></ExtraComponents>
-<NonVisualComponents>
- <Component class="java.lang.Object" name="object1">
- <Constraints>
- <LayoutConstraint/>
- </Constraints>
- <Properties>
- </Properties>
- </Component></NonVisualComponents>
- <Component class="javax.swing.JFrame" name="ProfileBuilderGUI">
- <Constraints>
- <LayoutConstraint/>
- </Constraints>
- <Layout class="Border">
- <Property name="hgap" type="int" value="0"/>
- <Property name="vgap" type="int" value="0"/>
- </Layout>
- <Events>
- </Events>
- <Properties>
- <Property name="title" type="String" value="OODT Profile Builder"/>
- <Property name="size" type="Dimension">
- <Dimension value="[675, 360]"/>
- </Property>
- <Property name="bounds" type="Rectangle">
- <Rectangle value="[0, 0, 675, 360]"/>
- </Property>
- </Properties>
- <SubComponents>
- <Component class="javax.swing.JPanel" name="jPanel1">
- <Constraints>
- <Constraint direction="Center"/>
- <LayoutConstraint>
- <Property name="direction" type="String" value="Center"/>
- </LayoutConstraint>
- </Constraints>
- <Layout class="Border">
- <Property name="hgap" type="int" value="0"/>
- <Property name="vgap" type="int" value="0"/>
- </Layout>
- <Events>
- </Events>
- <Properties>
- <Property name="bounds" type="Rectangle">
- <Rectangle value="[0, 0, 675, 316]"/>
- </Property>
- </Properties>
- <SubComponents>
- <Component class="javax.swing.JScrollPane" name="jPanel2">
- <Constraints>
- <Constraint direction="West"/>
- <LayoutConstraint>
- <Property name="direction" type="String" value="West"/>
- </LayoutConstraint>
- </Constraints>
- <Events>
- </Events>
- <Properties>
- <Property name="preferredSize" type="Dimension">
- <Dimension value="[231, 339]"/>
- </Property>
- <Property name="autoscrolls" type="boolean" value="true"/>
- <Property name="bounds" type="Rectangle">
- <Rectangle value="[0, 0, 231, 316]"/>
- </Property>
- </Properties>
- <SubComponents>
- <Component class="jpl.eda.profile.gui.profileTree" name="jTree1">
- <Constraints>
- <LayoutConstraint/>
- </Constraints>
- <Events>
- </Events>
- <Properties>
- <Property name="editable" type="boolean" value="true"/>
- <Property name="preferredSize" type="Dimension">
- <Dimension value="[426, 800]"/>
- </Property>
- <Property name="autoscrolls" type="boolean" value="true"/>
- <Property name="maximumSize" type="Dimension">
- <Dimension value="[426, 800]"/>
- </Property>
- <Property name="opaque" type="boolean" value="true"/>
- <Property name="size" type="Dimension">
- <Dimension value="[426, 800]"/>
- </Property>
- <Property name="bounds" type="Rectangle">
- <Rectangle value="[0, 0, 426, 800]"/>
- </Property>
- </Properties>
- </Component>
- </SubComponents>
- </Component>
- <Component class="javax.swing.JScrollPane" name="jPanel3">
- <Constraints>
- <Constraint direction="East"/>
- <LayoutConstraint>
- <Property name="direction" type="String" value="East"/>
- </LayoutConstraint>
- </Constraints>
- <Events>
- </Events>
- <Properties>
- <Property name="preferredSize" type="Dimension">
- <Dimension value="[444, 339]"/>
- </Property>
- <Property name="autoscrolls" type="boolean" value="true"/>
- <Property name="bounds" type="Rectangle">
- <Rectangle value="[231, 0, 444, 316]"/>
- </Property>
- </Properties>
- <SubComponents>
- <Component class="javax.swing.JEditorPane" name="jEditorPane1">
- <Constraints>
- <LayoutConstraint/>
- </Constraints>
- <Events>
- </Events>
- <Properties>
- <Property name="text" type="String" value=""/>
- <Property name="editable" type="boolean" value="false"/>
- <Property name="preferredSize" type="Dimension">
- <Dimension value="[414, 320]"/>
- </Property>
- <Property name="autoscrolls" type="boolean" value="true"/>
- <Property name="bounds" type="Rectangle">
- <Rectangle value="[0, 0, 442, 314]"/>
- </Property>
- </Properties>
- </Component>
- </SubComponents>
- </Component>
- </SubComponents>
- </Component>
- <Component class="javax.swing.JButton" name="jButton1">
- <Constraints>
- <Constraint direction="South"/>
- <LayoutConstraint>
- <Property name="direction" type="String" value="South"/>
- </LayoutConstraint>
- </Constraints>
- <Events>
- <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" handler="jButton1ActionPerformed"/>
- </Events>
- <Properties>
- <Property name="text" type="String" value="Show XML"/>
- </Properties>
- </Component>
- </SubComponents>
- </Component>
-</Form>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/gui/ProfileBuilderGUI.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/gui/ProfileBuilderGUI.java b/profile/src/main/java/org/apache/oodt/profile/gui/ProfileBuilderGUI.java
deleted file mode 100755
index 381d8a3..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/gui/ProfileBuilderGUI.java
+++ /dev/null
@@ -1,962 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.profile.gui;
-
-import org.apache.oodt.profile.Profile;
-import org.apache.oodt.profile.ProfileElement;
-import org.apache.oodt.profile.RangedProfileElement;
-import org.apache.oodt.profile.gui.pstructs.ProfilePrinter;
-
-import org.xml.sax.SAXException;
-
-import java.awt.BorderLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.swing.JButton;
-import javax.swing.JEditorPane;
-import javax.swing.JFileChooser;
-import javax.swing.JMenu;
-import javax.swing.JMenuBar;
-import javax.swing.JMenuItem;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JSeparator;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.DefaultTreeModel;
-import javax.swing.tree.TreeModel;
-import javax.swing.tree.TreeNode;
-
-/**
-* This code was generated using CloudGarden's Jigloo
-* SWT/Swing GUI Builder, which is free for non-commercial
-* use. If Jigloo is being used commercially (ie, by a
-* for-profit company or business) then you should purchase
-* a license - please visit www.cloudgarden.com for details.
-*/
-public class ProfileBuilderGUI extends javax.swing.JFrame {
- private static Logger LOG = Logger.getLogger(ProfileBuilderGUI.class.getName());
- private JButton jButton1;
- private JEditorPane jEditorPane1;
- private JScrollPane jPanel3;
- private profileTree jTree1;
- private JScrollPane jPanel2;
- private JPanel jPanel1;
- private JMenuItem helpMenuItem;
- private JMenu jMenu5;
- private JMenuItem deleteMenuItem;
- private JSeparator jSeparator1;
- private JMenuItem pasteMenuItem;
- private JMenuItem copyMenuItem;
- private JMenuItem cutMenuItem;
- private JMenu jMenu4;
- private JMenuItem exitMenuItem;
- private JSeparator jSeparator2;
- private JMenuItem closeFileMenuItem;
- private JMenuItem saveMenuItem;
- private JMenuItem openFileMenuItem;
- private JMenuItem newFileMenuItem;
- private JMenu jMenu3;
- private JMenuBar jMenuBar1;
-
- private Profile createdProfile=null;
-
-
- public ProfileBuilderGUI() {
- initGUI();
- }
-
- /**
- * Initializes the GUI.
- * Auto-generated code - any changes you make will disappear.
- */
- public void initGUI(){
- try {
- preInitGUI();
-
- try {
- javax.swing.UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
- } catch(Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- }
- jPanel1 = new JPanel();
- jPanel2 = new JScrollPane();
- jTree1 = new profileTree();
- jPanel3 = new JScrollPane();
- jEditorPane1 = new JEditorPane();
- jButton1 = new JButton();
-
- BorderLayout thisLayout = new BorderLayout();
- this.getContentPane().setLayout(thisLayout);
- thisLayout.setHgap(0);
- thisLayout.setVgap(0);
- this.setTitle("OODT Profile Builder");
- this.setSize(new java.awt.Dimension(682,387));
-
- BorderLayout jPanel1Layout = new BorderLayout();
- jPanel1.setLayout(jPanel1Layout);
- jPanel1Layout.setHgap(0);
- jPanel1Layout.setVgap(0);
- this.getContentPane().add(jPanel1, BorderLayout.CENTER);
-
- jPanel2.setPreferredSize(new java.awt.Dimension(231,339));
- jPanel2.setAutoscrolls(true);
- jPanel1.add(jPanel2, BorderLayout.WEST);
-
- jTree1.setEditable(true);
- jTree1.setPreferredSize(new java.awt.Dimension(426,800));
- jTree1.setAutoscrolls(true);
- jTree1.setMaximumSize(new java.awt.Dimension(426,800));
- jTree1.setOpaque(true);
- jTree1.setSize(new java.awt.Dimension(426,800));
- jPanel2.add(jTree1);
- jPanel2.setViewportView(jTree1);
-
- jPanel3.setPreferredSize(new java.awt.Dimension(444,339));
- jPanel3.setAutoscrolls(true);
- jPanel1.add(jPanel3, BorderLayout.EAST);
-
- jEditorPane1.setEditable(false);
- jEditorPane1.setPreferredSize(new java.awt.Dimension(414,320));
- jEditorPane1.setAutoscrolls(true);
- jPanel3.add(jEditorPane1);
- jPanel3.setViewportView(jEditorPane1);
-
- jButton1.setText("Show XML");
- this.getContentPane().add(jButton1, BorderLayout.SOUTH);
- jButton1.addActionListener( new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- jButton1ActionPerformed(evt);
- }
- });
- jMenuBar1 = new JMenuBar();
- jMenu3 = new JMenu();
- newFileMenuItem = new JMenuItem();
- openFileMenuItem = new JMenuItem();
- saveMenuItem = new JMenuItem();
- closeFileMenuItem = new JMenuItem();
- jSeparator2 = new JSeparator();
- exitMenuItem = new JMenuItem();
- jMenu4 = new JMenu();
- cutMenuItem = new JMenuItem();
- copyMenuItem = new JMenuItem();
- pasteMenuItem = new JMenuItem();
- jSeparator1 = new JSeparator();
- deleteMenuItem = new JMenuItem();
- jMenu5 = new JMenu();
- helpMenuItem = new JMenuItem();
-
- setJMenuBar(jMenuBar1);
-
- jMenu3.setText("File");
- jMenu3.setVisible(true);
- jMenuBar1.add(jMenu3);
-
- newFileMenuItem.setText("New Profile");
- newFileMenuItem.setVisible(true);
- newFileMenuItem.setPreferredSize(new java.awt.Dimension(28,16));
- newFileMenuItem.setBounds(new java.awt.Rectangle(5,5,28,16));
- jMenu3.add(newFileMenuItem);
- newFileMenuItem.addActionListener( new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- newFileMenuItemActionPerformed(evt);
- }
- });
-
- openFileMenuItem.setText("Open Profile");
- openFileMenuItem.setVisible(true);
- openFileMenuItem.setBounds(new java.awt.Rectangle(5,5,60,30));
- jMenu3.add(openFileMenuItem);
- openFileMenuItem.addActionListener( new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- openFileMenuItemActionPerformed(evt);
- }
- });
-
- saveMenuItem.setText("Save Profile");
- saveMenuItem.setVisible(true);
- saveMenuItem.setVerifyInputWhenFocusTarget(false);
- saveMenuItem.setBounds(new java.awt.Rectangle(5,5,60,30));
- jMenu3.add(saveMenuItem);
- saveMenuItem.addActionListener( new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- saveMenuItemActionPerformed(evt);
- }
- });
-
- closeFileMenuItem.setText("Close");
- closeFileMenuItem.setVisible(true);
- closeFileMenuItem.setBounds(new java.awt.Rectangle(5,5,60,30));
- jMenu3.add(closeFileMenuItem);
-
- jSeparator2.setVisible(true);
- jSeparator2.setBounds(new java.awt.Rectangle(5,5,60,30));
- jMenu3.add(jSeparator2);
-
- exitMenuItem.setText("Exit");
- exitMenuItem.setVisible(true);
- exitMenuItem.setBounds(new java.awt.Rectangle(5,5,60,30));
- jMenu3.add(exitMenuItem);
- exitMenuItem.addActionListener( new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- exitMenuItemActionPerformed(evt);
- }
- });
-
- jMenu4.setText("Edit");
- jMenu4.setVisible(true);
- jMenuBar1.add(jMenu4);
-
- cutMenuItem.setText("Cut");
- cutMenuItem.setVisible(true);
- cutMenuItem.setPreferredSize(new java.awt.Dimension(27,16));
- cutMenuItem.setBounds(new java.awt.Rectangle(5,5,27,16));
- jMenu4.add(cutMenuItem);
-
- copyMenuItem.setText("Copy");
- copyMenuItem.setVisible(true);
- copyMenuItem.setBounds(new java.awt.Rectangle(5,5,60,30));
- jMenu4.add(copyMenuItem);
-
- pasteMenuItem.setText("Paste");
- pasteMenuItem.setVisible(true);
- pasteMenuItem.setBounds(new java.awt.Rectangle(5,5,60,30));
- jMenu4.add(pasteMenuItem);
-
- jSeparator1.setVisible(true);
- jSeparator1.setBounds(new java.awt.Rectangle(5,5,60,30));
- jMenu4.add(jSeparator1);
-
- deleteMenuItem.setText("Delete");
- deleteMenuItem.setVisible(true);
- deleteMenuItem.setBounds(new java.awt.Rectangle(5,5,60,30));
- jMenu4.add(deleteMenuItem);
-
- jMenu5.setText("Help");
- jMenu5.setVisible(true);
- jMenuBar1.add(jMenu5);
-
- helpMenuItem.setText("Help");
- helpMenuItem.setVisible(true);
- helpMenuItem.setPreferredSize(new java.awt.Dimension(31,16));
- helpMenuItem.setBounds(new java.awt.Rectangle(5,5,31,16));
- jMenu5.add(helpMenuItem);
-
- postInitGUI();
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- }
- }
- /** Add your pre-init code in here */
- public void preInitGUI(){
- }
-
- /** Add your post-init code in here */
- public void postInitGUI(){
- }
-
- /** Auto-generated main method */
- public static void main(String[] args){
- //showGUI();
- showMainGUI();
- }
-
- public static void showMainGUI(){
- try {
- ProfileBuilderGUI inst = new ProfileBuilderGUI();
- inst.setVisible(true);
- inst.getJTree1().addMouseListener(new LeafListener(inst.getJTree1()));
- inst.getJTree1().setExpandsSelectedPaths(true);
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- }
- }
-
-
-
-
-
-
- /**
- * This static method creates a new instance of this class and shows
- * it inside a new JFrame, (unless it is already a JFrame).
- *
- * It is a convenience method for showing the GUI, but it can be
- * copied and used as a basis for your own code. *
- * It is auto-generated code - the body of this method will be
- * re-generated after any changes are made to the GUI.
- * However, if you delete this method it will not be re-created. */
- public static void showGUI(){
- try {
- ProfileBuilderGUI inst = new ProfileBuilderGUI();
- inst.setVisible(true);
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- }
- }
-/**
-* Auto-generated method
-*/public JPanel getJPanel1(){
-return jPanel1; }
-/**
-* Auto-generated method
-*/public JScrollPane getJPanel2(){
-return jPanel2; }
-/**
-* Auto-generated method
-*/public profileTree getJTree1(){
-return jTree1; }
-
-public void setJTree1(profileTree jt){
- jTree1 = jt;
- repaint();
-}
-/**
-* Auto-generated method
-*/public JScrollPane getJPanel3(){
-return jPanel3; }
-/**
-* Auto-generated method
-*/public JEditorPane getJEditorPane1(){
-return jEditorPane1; }
-
-
-
- /** Auto-generated event handler method */
- protected void newFileMenuItemActionPerformed(ActionEvent evt){
- //TODO add your handler code here
-
- createdProfile = new Profile();
- jEditorPane1.setText(new ProfilePrinter(createdProfile,"http://oodt.jpl.nasa.gov/dtd/prof.dtd").toXMLString());
-
- getJTree1().setModel(generateModelFromProfile(createdProfile));
- //getJTree1().addMouseListener(new LeafListener(getJTree1()));
- }
-
- /** Auto-generated event handler method */
- protected void exitMenuItemActionPerformed(ActionEvent evt){
- //TODO add your handler code here
- System.exit(1);
- }
-
- private void addElementsFromTreeNode(TreeNode t, List multiValueElem){
- for(Enumeration i = t.children(); i.hasMoreElements(); ){
- DefaultMutableTreeNode theNode = (DefaultMutableTreeNode)i.nextElement();
-
- String theStr = (String)theNode.getUserObject();
- multiValueElem.add(theStr);
- }
- }
-
-
-
- private Profile generateProfileFromModel(TreeModel dtm){
-
- Profile p = new Profile();
- DefaultMutableTreeNode theProfileRoot = (DefaultMutableTreeNode)dtm.getRoot();
-
- //get the profile attributes
- //children List
- //id String
- //parent String
- //regAuthority String
- //revisionNotes List
- //securityType String
- //statusID String
- //type String
- //version String
- TreeNode theProfAttrRoot = theProfileRoot.getChildAt(0);
-
- TreeNode theProfAttr_Children = theProfAttrRoot.getChildAt(0);
- addElementsFromTreeNode(theProfAttr_Children,p.getProfileAttributes().getChildren());
-
- TreeNode theProfAttr_IDRoot = theProfAttrRoot.getChildAt(1);
- DefaultMutableTreeNode theProfAttr_ID = (DefaultMutableTreeNode)theProfAttr_IDRoot.getChildAt(0);
- p.getProfileAttributes().setID((String)theProfAttr_ID.getUserObject());
-
- TreeNode theProfAttr_ParentRoot = theProfAttrRoot.getChildAt(2);
- DefaultMutableTreeNode theProfAttr_Parent = (DefaultMutableTreeNode)theProfAttr_ParentRoot.getChildAt(0);
- p.getProfileAttributes().setParent((String)theProfAttr_Parent.getUserObject());
-
-
- TreeNode theProfAttr_RegAuthorityRoot = theProfAttrRoot.getChildAt(3);
- DefaultMutableTreeNode theProfAttr_RegAuthority = (DefaultMutableTreeNode)theProfAttr_RegAuthorityRoot.getChildAt(0);
- p.getProfileAttributes().setRegAuthority((String)theProfAttr_RegAuthority.getUserObject());
-
- TreeNode theProfAttr_revNotes = theProfAttrRoot.getChildAt(4);
- addElementsFromTreeNode(theProfAttr_revNotes,p.getProfileAttributes().getRevisionNotes());
-
- TreeNode theProfAttr_SecurityTypeRoot = theProfAttrRoot.getChildAt(5);
- DefaultMutableTreeNode theProfAttr_SecurityType = (DefaultMutableTreeNode)theProfAttr_SecurityTypeRoot.getChildAt(0);
- p.getProfileAttributes().setSecurityType((String)theProfAttr_SecurityType.getUserObject());
-
- TreeNode theProfAttr_StatusIDRoot = theProfAttrRoot.getChildAt(6);
- DefaultMutableTreeNode theProfAttr_StatusID = (DefaultMutableTreeNode)theProfAttr_StatusIDRoot.getChildAt(0);
- p.getProfileAttributes().setStatusID((String)theProfAttr_StatusID.getUserObject());
-
- TreeNode theProfAttr_TypeRoot = theProfAttrRoot.getChildAt(7);
- DefaultMutableTreeNode theProfAttr_Type = (DefaultMutableTreeNode)theProfAttr_TypeRoot.getChildAt(0);
- p.getProfileAttributes().setType((String)theProfAttr_Type.getUserObject());
-
- TreeNode theProfAttr_VersionRoot = theProfAttrRoot.getChildAt(8);
- DefaultMutableTreeNode theProfAttr_Version = (DefaultMutableTreeNode)theProfAttr_VersionRoot.getChildAt(0);
- p.getProfileAttributes().setVersion((String)theProfAttr_Version.getUserObject());
-
-
- //resource attributes
- //aggregation - string
- //class - string
- //contexts - list
- //contributors - list
- //coverages - list
- //creators - list
- //dates - list
- //description - string
- //formats - list
- //identifier - string
- //languages - list
- //locations - list
- //publishers - list
- //relations - list
- //rights - list
- //sources - list
- //subjects - list
- //title - string
- //types - list
-
- TreeNode theResAttrRoot = theProfileRoot.getChildAt(1);
-
- TreeNode ra_aggRoot=theResAttrRoot.getChildAt(0);
- TreeNode ra_classRoot=theResAttrRoot.getChildAt(1);
- TreeNode ra_contextRoot=theResAttrRoot.getChildAt(2);
- TreeNode ra_contribRoot=theResAttrRoot.getChildAt(3);
- TreeNode ra_coverageRoot=theResAttrRoot.getChildAt(4);
- TreeNode ra_creatorRoot=theResAttrRoot.getChildAt(5);
- TreeNode ra_datesRoot=theResAttrRoot.getChildAt(6);
- TreeNode ra_descRoot=theResAttrRoot.getChildAt(7);
- TreeNode ra_formatsRoot=theResAttrRoot.getChildAt(8);
- TreeNode ra_identifierRoot=theResAttrRoot.getChildAt(9);
- TreeNode ra_langRoot=theResAttrRoot.getChildAt(10);
- TreeNode ra_locationRoot=theResAttrRoot.getChildAt(11);
- TreeNode ra_publishersRoot=theResAttrRoot.getChildAt(12);
- TreeNode ra_relationsRoot=theResAttrRoot.getChildAt(13);
- TreeNode ra_rightsRoot=theResAttrRoot.getChildAt(14);
- TreeNode ra_sourcesRoot=theResAttrRoot.getChildAt(15);
- TreeNode ra_subjectsRoot=theResAttrRoot.getChildAt(16);
- TreeNode ra_titleRoot=theResAttrRoot.getChildAt(17);
- TreeNode ra_typesRoot=theResAttrRoot.getChildAt(18);
-
- DefaultMutableTreeNode ra_agg = (DefaultMutableTreeNode)ra_aggRoot.getChildAt(0);
- DefaultMutableTreeNode ra_class = (DefaultMutableTreeNode)ra_classRoot.getChildAt(0);
-
-
- p.getResourceAttributes().setResAggregation((String)ra_agg.getUserObject());
- p.getResourceAttributes().setResClass((String)ra_class.getUserObject());
- addElementsFromTreeNode(ra_contextRoot,p.getResourceAttributes().getResContexts());
- addElementsFromTreeNode(ra_contribRoot,p.getResourceAttributes().getContributors());
- addElementsFromTreeNode(ra_coverageRoot,p.getResourceAttributes().getCoverages());
- addElementsFromTreeNode(ra_creatorRoot,p.getResourceAttributes().getCreators());
- addElementsFromTreeNode(ra_datesRoot,p.getResourceAttributes().getDates());
-
- DefaultMutableTreeNode ra_desc = (DefaultMutableTreeNode)ra_descRoot.getChildAt(0);
- DefaultMutableTreeNode ra_identifier = (DefaultMutableTreeNode)ra_identifierRoot.getChildAt(0);
-
- p.getResourceAttributes().setDescription((String)ra_desc.getUserObject());
- p.getResourceAttributes().setIdentifier((String)ra_identifier.getUserObject());
-
- addElementsFromTreeNode(ra_formatsRoot,p.getResourceAttributes().getFormats());
- addElementsFromTreeNode(ra_langRoot,p.getResourceAttributes().getLanguages());
- addElementsFromTreeNode(ra_locationRoot,p.getResourceAttributes().getResLocations());
- addElementsFromTreeNode(ra_publishersRoot,p.getResourceAttributes().getPublishers());
- addElementsFromTreeNode(ra_relationsRoot,p.getResourceAttributes().getRelations());
- addElementsFromTreeNode(ra_rightsRoot,p.getResourceAttributes().getRights());
- addElementsFromTreeNode(ra_sourcesRoot,p.getResourceAttributes().getSources());
- addElementsFromTreeNode(ra_subjectsRoot,p.getResourceAttributes().getSubjects());
- addElementsFromTreeNode(ra_typesRoot,p.getResourceAttributes().getTypes());
-
- DefaultMutableTreeNode ra_title = (DefaultMutableTreeNode)ra_titleRoot.getChildAt(0);
- p.getResourceAttributes().setTitle((String)ra_title.getUserObject());
-
- //handle profile elements here
- TreeNode theProfElemRoot = theProfileRoot.getChildAt(2);
-
- for(Enumeration e = theProfElemRoot.children(); e.hasMoreElements(); ){
- DefaultMutableTreeNode profElemN_Root = (DefaultMutableTreeNode)e.nextElement();
- System.out.println("Got Profile Element "+ profElemN_Root.getUserObject());
- ProfileElement profElem = makeProfileElementFromTreeNode(p,profElemN_Root);
-
- if(profElem != null){
- System.out.println("Making profile element");
- System.out.println(profElem.toString());
-
- p.getProfileElements().put((String)profElemN_Root.getUserObject(),profElem);
- }
-
-
- }
-
-
- return p;
- }
-
- private ProfileElement makeProfileElementFromTreeNode(Profile theProfile,DefaultMutableTreeNode tn){
-
- ProfileElement theProfileElement = new RangedProfileElement(theProfile);
-
- DefaultMutableTreeNode commentRoot = (DefaultMutableTreeNode)tn.getChildAt(0);
- DefaultMutableTreeNode descRoot = (DefaultMutableTreeNode)tn.getChildAt(1);
- DefaultMutableTreeNode idRoot = (DefaultMutableTreeNode)tn.getChildAt(2);
- DefaultMutableTreeNode moRoot = (DefaultMutableTreeNode)tn.getChildAt(3);
- DefaultMutableTreeNode synRoot = (DefaultMutableTreeNode)tn.getChildAt(4);
- DefaultMutableTreeNode typeRoot = (DefaultMutableTreeNode)tn.getChildAt(5);
- DefaultMutableTreeNode unitRoot = (DefaultMutableTreeNode)tn.getChildAt(6);
-
- DefaultMutableTreeNode pe_Comments = (DefaultMutableTreeNode)commentRoot.getChildAt(0);
- DefaultMutableTreeNode pe_desc = (DefaultMutableTreeNode)descRoot.getChildAt(0);
- DefaultMutableTreeNode pe_id = (DefaultMutableTreeNode)idRoot.getChildAt(0);
- DefaultMutableTreeNode pe_mo = (DefaultMutableTreeNode)moRoot.getChildAt(0);
- DefaultMutableTreeNode pe_type = (DefaultMutableTreeNode)typeRoot.getChildAt(0);
- DefaultMutableTreeNode pe_unit = (DefaultMutableTreeNode)unitRoot.getChildAt(0);
-
- addElementsFromTreeNode(synRoot,theProfileElement.getSynonyms());
-
- theProfileElement.setName((String)tn.getUserObject());
- theProfileElement.setComments((String)pe_Comments.getUserObject());
- theProfileElement.setDescription((String)pe_desc.getUserObject());
- theProfileElement.setID((String)pe_id.getUserObject());
- theProfileElement.setMaxOccurrence(Integer.parseInt((String)pe_mo.getUserObject()));
- theProfileElement.setType((String)pe_type.getUserObject());
- theProfileElement.setUnit((String)pe_unit.getUserObject());
-
- return theProfileElement;
-
- //return new RangedProfileElement(new Profile());
- }
-
-
-
- private DefaultTreeModel generateModelFromProfile(Profile p){
- DefaultMutableTreeNode root = new DefaultMutableTreeNode("Profile");
- DefaultMutableTreeNode resAttrRoot = new DefaultMutableTreeNode("Resource Attributes");
- DefaultMutableTreeNode profAttrRoot = new DefaultMutableTreeNode("Profile Attributes");
- DefaultMutableTreeNode profElemRoot = new DefaultMutableTreeNode("Profile Elements");
-
- //do the Profile Attributes here
- //children List
- //id String
- //parent String
- //regAuthority String
- //revisionNotes List
- //securityType String
- //statusID String
- //type String
- //version String
-
- DefaultMutableTreeNode profAttr_children = new DefaultMutableTreeNode("Children");
-
- for (Object o : p.getProfileAttributes().getChildren()) {
- String theChild = (String) o;
-
- DefaultMutableTreeNode profAttr_childN = new DefaultMutableTreeNode(theChild);
- profAttr_children.add(profAttr_childN);
- }
-
-
- DefaultMutableTreeNode profAttr_id = new DefaultMutableTreeNode("Id");
- profAttr_id.add(new DefaultMutableTreeNode(p.getProfileAttributes().getID()));
-
- DefaultMutableTreeNode profAttr_parent = new DefaultMutableTreeNode("Parent");
- profAttr_parent.add(new DefaultMutableTreeNode(p.getProfileAttributes().getParent()));
-
- DefaultMutableTreeNode profAttr_regAuth = new DefaultMutableTreeNode("Registration Authority");
- profAttr_regAuth.add(new DefaultMutableTreeNode(p.getProfileAttributes().getRegAuthority()));
-
- DefaultMutableTreeNode profAttr_revNotes = new DefaultMutableTreeNode("Revision Notes");
-
- for (Object o : p.getProfileAttributes().getRevisionNotes()) {
- String revNoteString = (String) o;
-
- DefaultMutableTreeNode revNote_Child = new DefaultMutableTreeNode(revNoteString);
- profAttr_revNotes.add(revNote_Child);
- }
-
- DefaultMutableTreeNode profAttr_securityType = new DefaultMutableTreeNode("Security Type");
- profAttr_securityType.add(new DefaultMutableTreeNode(p.getProfileAttributes().getSecurityType()));
-
- DefaultMutableTreeNode profAttr_statusID = new DefaultMutableTreeNode("Status ID");
- profAttr_statusID.add(new DefaultMutableTreeNode(p.getProfileAttributes().getStatusID()));
-
- DefaultMutableTreeNode profAttr_type = new DefaultMutableTreeNode("Type");
- profAttr_type.add(new DefaultMutableTreeNode(p.getProfileAttributes().getType()));
-
- DefaultMutableTreeNode profAttr_version = new DefaultMutableTreeNode("Version");
- profAttr_version.add(new DefaultMutableTreeNode(p.getProfileAttributes().getVersion()));
-
- profAttrRoot.add(profAttr_children);
- profAttrRoot.add(profAttr_id);
- profAttrRoot.add(profAttr_parent);
- profAttrRoot.add(profAttr_regAuth);
- profAttrRoot.add(profAttr_revNotes);
- profAttrRoot.add(profAttr_securityType);
- profAttrRoot.add(profAttr_statusID);
- profAttrRoot.add(profAttr_type);
- profAttrRoot.add(profAttr_version);
-
- //resource attributes
- //aggregation - string
- //class - string
- //contexts - list
- //contributors - list
- //coverages - list
- //creators - list
- //dates - list
- //description - string
- //formats - list
- //identifier - string
- //languages - list
- //locations - list
- //publishers - list
- //relations - list
- //rights - list
- //sources - list
- //subjects - list
- //title - string
- //types - list
-
- DefaultMutableTreeNode resAttr_aggregation = new DefaultMutableTreeNode("Aggregation");
- resAttr_aggregation.add(new DefaultMutableTreeNode(p.getResourceAttributes().getResAggregation()));
-
- DefaultMutableTreeNode resAttr_class = new DefaultMutableTreeNode("Class");
- resAttr_class.add(new DefaultMutableTreeNode(p.getResourceAttributes().getResClass()));
-
-
- DefaultMutableTreeNode resAttr_contexts = new DefaultMutableTreeNode("Contexts");
-
- for (String theContext : p.getResourceAttributes().getResContexts()) {
- DefaultMutableTreeNode resAttr_contextN = new DefaultMutableTreeNode(theContext);
- resAttr_contexts.add(resAttr_contextN);
- }
-
- DefaultMutableTreeNode resAttr_contributors = new DefaultMutableTreeNode("Contributors");
-
- for (String theContributor : p.getResourceAttributes().getContributors()) {
- DefaultMutableTreeNode resAttr_contribN = new DefaultMutableTreeNode(theContributor);
- resAttr_contributors.add(resAttr_contribN);
- }
-
- DefaultMutableTreeNode resAttr_coverages = new DefaultMutableTreeNode("Coverages");
-
- for (String theCoverage : p.getResourceAttributes().getCoverages()) {
- DefaultMutableTreeNode resAttr_coverageN = new DefaultMutableTreeNode(theCoverage);
- resAttr_coverages.add(resAttr_coverageN);
- }
-
- DefaultMutableTreeNode resAttr_creators = new DefaultMutableTreeNode("Creators");
-
- for (String theCreator : p.getResourceAttributes().getCreators()) {
- DefaultMutableTreeNode resAttr_creatorN = new DefaultMutableTreeNode(theCreator);
- resAttr_creators.add(resAttr_creatorN);
- }
-
- DefaultMutableTreeNode resAttr_dates = new DefaultMutableTreeNode("Dates");
-
- for (String theDate : p.getResourceAttributes().getDates()) {
- DefaultMutableTreeNode resAttr_dateN = new DefaultMutableTreeNode(theDate);
- resAttr_dates.add(resAttr_dateN);
- }
-
- DefaultMutableTreeNode resAttr_description = new DefaultMutableTreeNode("Description");
- resAttr_description.add(new DefaultMutableTreeNode(p.getResourceAttributes().getDescription()));
-
- DefaultMutableTreeNode resAttr_formats = new DefaultMutableTreeNode("Formats");
-
- for (String theFormat : p.getResourceAttributes().getFormats()) {
- DefaultMutableTreeNode resAttr_formatN = new DefaultMutableTreeNode(theFormat);
- resAttr_formats.add(resAttr_formatN);
- }
-
- DefaultMutableTreeNode resAttr_identifier = new DefaultMutableTreeNode("Identifier");
- resAttr_identifier.add(new DefaultMutableTreeNode(p.getResourceAttributes().getIdentifier()));
-
- DefaultMutableTreeNode resAttr_languages = new DefaultMutableTreeNode("Languages");
-
- for (String theLanguage : p.getResourceAttributes().getLanguages()) {
- DefaultMutableTreeNode resAttr_langN = new DefaultMutableTreeNode(theLanguage);
- resAttr_languages.add(resAttr_langN);
- }
-
- DefaultMutableTreeNode resAttr_locations = new DefaultMutableTreeNode("Resource Locations");
-
- for (String theLoc : p.getResourceAttributes().getResLocations()) {
- DefaultMutableTreeNode resAttr_locN = new DefaultMutableTreeNode(theLoc);
- resAttr_locations.add(resAttr_locN);
- }
-
- DefaultMutableTreeNode resAttr_publishers = new DefaultMutableTreeNode("Publishers");
-
- for (String thePublisher : p.getResourceAttributes().getPublishers()) {
- DefaultMutableTreeNode resAttr_pubN = new DefaultMutableTreeNode(thePublisher);
- resAttr_publishers.add(resAttr_pubN);
- }
-
- DefaultMutableTreeNode resAttr_relations = new DefaultMutableTreeNode("Relations");
-
- for (String theRelation : p.getResourceAttributes().getRelations()) {
- DefaultMutableTreeNode resAttr_relationN = new DefaultMutableTreeNode(theRelation);
- resAttr_relations.add(resAttr_relationN);
- }
-
-
- DefaultMutableTreeNode resAttr_rights = new DefaultMutableTreeNode("Rights");
-
- for (String theRight : p.getResourceAttributes().getRights()) {
- DefaultMutableTreeNode resAttr_rightN = new DefaultMutableTreeNode(theRight);
- resAttr_rights.add(resAttr_rightN);
- }
-
- DefaultMutableTreeNode resAttr_sources = new DefaultMutableTreeNode("Sources");
-
- for (String theSource : p.getResourceAttributes().getSources()) {
- DefaultMutableTreeNode resAttr_sourceN = new DefaultMutableTreeNode(theSource);
- resAttr_sources.add(resAttr_sourceN);
- }
-
- DefaultMutableTreeNode resAttr_subjects = new DefaultMutableTreeNode("Subjects");
-
- for (String theSubject : p.getResourceAttributes().getSubjects()) {
- DefaultMutableTreeNode resAttr_subjectN = new DefaultMutableTreeNode(theSubject);
- resAttr_subjects.add(resAttr_subjectN);
- }
-
- DefaultMutableTreeNode resAttr_title = new DefaultMutableTreeNode("Title");
- resAttr_title.add(new DefaultMutableTreeNode(p.getResourceAttributes().getTitle()));
-
- DefaultMutableTreeNode resAttr_types = new DefaultMutableTreeNode("Types");
-
- for (String theType : p.getResourceAttributes().getTypes()) {
- DefaultMutableTreeNode resAttr_typeN = new DefaultMutableTreeNode(theType);
- resAttr_types.add(resAttr_typeN);
- }
-
-
- resAttrRoot.add(resAttr_aggregation);
- resAttrRoot.add(resAttr_class);
- resAttrRoot.add(resAttr_contexts);
- resAttrRoot.add(resAttr_contributors);
- resAttrRoot.add(resAttr_coverages);
- resAttrRoot.add(resAttr_creators);
- resAttrRoot.add(resAttr_dates);
- resAttrRoot.add(resAttr_description);
- resAttrRoot.add(resAttr_formats);
- resAttrRoot.add(resAttr_identifier);
- resAttrRoot.add(resAttr_languages);
- resAttrRoot.add(resAttr_locations);
- resAttrRoot.add(resAttr_publishers);
- resAttrRoot.add(resAttr_relations);
- resAttrRoot.add(resAttr_rights);
- resAttrRoot.add(resAttr_sources);
- resAttrRoot.add(resAttr_subjects);
- resAttrRoot.add(resAttr_title);
- resAttrRoot.add(resAttr_types);
-
- for (String peKey : p.getProfileElements().keySet()) {
- ProfileElement theProfileElement = p.getProfileElements().get(peKey);
- DefaultMutableTreeNode thePENode = new DefaultMutableTreeNode(theProfileElement.getName());
- DefaultMutableTreeNode theCommentsRoot = new DefaultMutableTreeNode("Comments");
- DefaultMutableTreeNode theComments = new DefaultMutableTreeNode(theProfileElement.getComments());
-
- theCommentsRoot.add(theComments);
-
- DefaultMutableTreeNode theDesc = new DefaultMutableTreeNode(theProfileElement.getDescription());
- DefaultMutableTreeNode theDescRoot = new DefaultMutableTreeNode("Description");
-
- theDescRoot.add(theDesc);
-
-
- DefaultMutableTreeNode theID = new DefaultMutableTreeNode(theProfileElement.getID());
- DefaultMutableTreeNode theIDRoot = new DefaultMutableTreeNode("ID");
-
- theIDRoot.add(theID);
-
- DefaultMutableTreeNode theMO =
- new DefaultMutableTreeNode(Integer.toString(theProfileElement.getMaxOccurrence()));
- DefaultMutableTreeNode theMORoot = new DefaultMutableTreeNode("Max Occurence");
- theMORoot.add(theMO);
-
- DefaultMutableTreeNode theSynonyms = new DefaultMutableTreeNode("Synonyms");
-
- for (Object o : theProfileElement.getSynonyms()) {
- String theSynonym = (String) o;
- DefaultMutableTreeNode sNode = new DefaultMutableTreeNode(theSynonym);
- theSynonyms.add(sNode);
- }
-
- DefaultMutableTreeNode theType = new DefaultMutableTreeNode(theProfileElement.getType());
- DefaultMutableTreeNode theTypeRoot = new DefaultMutableTreeNode("Type");
- theTypeRoot.add(theType);
-
-
- DefaultMutableTreeNode theUnit = new DefaultMutableTreeNode(theProfileElement.getUnit());
- DefaultMutableTreeNode theUnitRoot = new DefaultMutableTreeNode("Unit");
- theUnitRoot.add(theUnit);
-
- thePENode.add(theCommentsRoot);
- thePENode.add(theDescRoot);
- thePENode.add(theIDRoot);
- thePENode.add(theMORoot);
- thePENode.add(theSynonyms);
- thePENode.add(theTypeRoot);
- thePENode.add(theUnitRoot);
-
- profElemRoot.add(thePENode);
- }
-
- root.add(profAttrRoot);
- root.add(resAttrRoot);
- root.add(profElemRoot);
-
- return new DefaultTreeModel(root);
-
-
- }
-
- /** Auto-generated event handler method */
- protected void openFileMenuItemActionPerformed(ActionEvent evt){
- //TODO add your handler code here
-
- String filename = File.separator+"tmp";
- JFileChooser fc = new JFileChooser(new File(filename));
-
- // Show open dialog; this method does not return until the dialog is closed
- int decision = fc.showOpenDialog(this);
-
- if(decision != JFileChooser.APPROVE_OPTION){
- return;
- }
-
- File selFile = fc.getSelectedFile();
-
- //create a buffered reader, read it in, create a new profile from that file
- FileReader fr = null;
-
- try{
- fr = new FileReader(selFile);
- }
- catch(FileNotFoundException fne){
- LOG.log(Level.SEVERE, fne.getMessage());
- System.out.println(fne.getMessage());
- }
-
- char [] buf = new char[256];
- StringBuilder sb = new StringBuilder();
-
- int numRead;
-
- try{
- if (fr != null) {
- while((numRead = fr.read(buf,0,256)) != -1){
- sb.append(buf,0,numRead);
- buf = new char[256];
- }
- }
- }
- catch(IOException ioe){
- LOG.log(Level.SEVERE, ioe.getMessage());
- System.out.println(ioe.getMessage());
- }
-
- System.out.println("Read in "+sb.toString());
- try{
- createdProfile = new Profile(sb.toString());
- jEditorPane1.setText(new ProfilePrinter(createdProfile,"http://oodt.jpl.nasa.gov/dtd/prof.dtd").toXMLString());
-
- getJTree1().setModel(generateModelFromProfile(createdProfile));
- //getJTree1().addMouseListener(new LeafListener(getJTree1()));
- }catch(SAXException se){
- LOG.log(Level.SEVERE, se.getMessage());
- System.out.println(se.getMessage());
- }
-
-
- }
-
- /** Auto-generated event handler method */
- protected void jButton1ActionPerformed(ActionEvent evt){
- //TODO add your handler code here
-
- //basically we want to set the createdProfile to be generated from the current tree model
- //then we want to set the jeditor pane to have the createdProfileText
-
- createdProfile = generateProfileFromModel(getJTree1().getModel());
- //jEditorPane1.setText(createdProfile.toString());
- jEditorPane1.setText(new ProfilePrinter(createdProfile,"http://oodt.jpl.nasa.gov/dtd/prof.dtd").toXMLString());
-
- }
-
- /** Auto-generated event handler method */
- protected void saveMenuItemActionPerformed(ActionEvent evt){
- //TODO add your handler code here
-
-
- JFileChooser fc = new JFileChooser();
- int decision = fc.showSaveDialog(this);
-
- if(decision != JFileChooser.APPROVE_OPTION){
- return;
- }
-
- //first thing -- set the created profile to the current tree
- createdProfile = generateProfileFromModel(getJTree1().getModel());
-
- File file = fc.getSelectedFile();
- FileOutputStream fos = null;
-
- try{
- System.out.println("Trying to write to "+file.getAbsolutePath());
- fos = new FileOutputStream (file.getAbsolutePath());
- fos.write(new ProfilePrinter(createdProfile,"http://oodt.jpl.nasa.gov/dtd/prof.dtd").toXMLString().getBytes());
- }
- catch(FileNotFoundException fne){
- LOG.log(Level.SEVERE, fne.getMessage());
- System.out.println(fne.getMessage());
- }
- catch(IOException ioe){
- LOG.log(Level.SEVERE, ioe.getMessage());
- System.out.println(ioe.getMessage());
- }
- finally{
- try{
- if (fos != null) {
- fos.close();
- }
- }catch(Exception ignore){
- //ignore
- }
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/gui/profileTree.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/gui/profileTree.java b/profile/src/main/java/org/apache/oodt/profile/gui/profileTree.java
deleted file mode 100755
index 3c9cf92..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/gui/profileTree.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.profile.gui;
-
-import javax.swing.JTree;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.DefaultTreeModel;
-
-
-public class profileTree extends JTree{
-
- public profileTree(){
- setEditable(true);
- DefaultMutableTreeNode dtmRoot = new DefaultMutableTreeNode("Profile");
- DefaultMutableTreeNode resAttrRoot = new DefaultMutableTreeNode("Resource Attributes");
- DefaultMutableTreeNode profAttrRoot = new DefaultMutableTreeNode("Profile Attributes");
- DefaultMutableTreeNode profElemRoot = new DefaultMutableTreeNode("Profile Elements");
- dtmRoot.add(resAttrRoot);
- dtmRoot.add(profAttrRoot);
- dtmRoot.add(profElemRoot);
- DefaultTreeModel theModel = new DefaultTreeModel(dtmRoot);
- setModel(theModel);
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/profile/src/main/java/org/apache/oodt/profile/gui/pstructs/ProfileAttributesPrinter.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/gui/pstructs/ProfileAttributesPrinter.java b/profile/src/main/java/org/apache/oodt/profile/gui/pstructs/ProfileAttributesPrinter.java
deleted file mode 100755
index 8599cfe..0000000
--- a/profile/src/main/java/org/apache/oodt/profile/gui/pstructs/ProfileAttributesPrinter.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * Created on Jun 25, 2004
- *
- * TODO To change the template for this generated file go to
- * Window - Preferences - Java - Code Generation - Code and Comments
- */
-package org.apache.oodt.profile.gui.pstructs;
-
-
-import org.apache.oodt.profile.ProfileAttributes;
-
-/**
- * @author mattmann
- *
- * TODO To change the template for this generated type comment go to
- * Window - Preferences - Java - Code Generation - Code and Comments
- */
-public class ProfileAttributesPrinter {
-
- private ProfileAttributes myProfAttributes=null;
- /**
- *
- */
- public ProfileAttributesPrinter(ProfileAttributes pa) {
- super();
- // TODO Auto-generated constructor stub
- myProfAttributes = pa;
- }
-
- public String toXMLString(){
- StringBuilder rStr= new StringBuilder();
-
- rStr.append("<profAttributes>\n");
- rStr.append("\t<profId>").append(myProfAttributes.getID()).append("</profId>\n");
- rStr.append("\t<profType>").append(myProfAttributes.getType()).append("</profType>\n");
- rStr.append("\t<profVersion>").append(myProfAttributes.getVersion()).append("</profVersion>\n");
- rStr.append("\t<profStatusId>").append(myProfAttributes.getStatusID()).append("</profStatusId>\n");
- rStr.append("\t<profSecurityType>").append(myProfAttributes.getSecurityType()).append("</profSecurityType>\n");
- rStr.append("\t<profParentId>").append(myProfAttributes.getParent()).append("</profParentId>\n");
-
- for (Object o1 : myProfAttributes.getChildren()) {
- String theChild = (String) o1;
- rStr.append("\t<profChildId>").append(theChild).append("</profChildId>\n");
- }
-
- rStr.append("\t<profRegAuthority>").append(myProfAttributes.getRegAuthority()).append("</profRegAuthority>\n");
-
- for (Object o : myProfAttributes.getRevisionNotes()) {
- String theNote = (String) o;
- rStr.append("\t<profRevisionNote>").append(theNote).append("</profRevisionNote>\n");
- }
-
- rStr.append("</profAttributes>\n\n");
-
-
- return rStr.toString();
- }
-}
[30/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/AbstractCommunicationChannelServer.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/AbstractCommunicationChannelServer.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/AbstractCommunicationChannelServer.java
deleted file mode 100644
index 873d997..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/AbstractCommunicationChannelServer.java
+++ /dev/null
@@ -1,404 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.server.channel;
-
-//JDK imports
-import org.apache.oodt.cas.catalog.exception.CatalogServiceException;
-import org.apache.oodt.cas.catalog.metadata.TransactionalMetadata;
-import org.apache.oodt.cas.catalog.page.CatalogReceipt;
-import org.apache.oodt.cas.catalog.page.Page;
-import org.apache.oodt.cas.catalog.page.PageInfo;
-import org.apache.oodt.cas.catalog.page.QueryPager;
-import org.apache.oodt.cas.catalog.page.TransactionReceipt;
-import org.apache.oodt.cas.catalog.query.QueryExpression;
-import org.apache.oodt.cas.catalog.struct.Dictionary;
-import org.apache.oodt.cas.catalog.struct.Index;
-import org.apache.oodt.cas.catalog.struct.TransactionId;
-import org.apache.oodt.cas.catalog.system.Catalog;
-import org.apache.oodt.cas.catalog.system.CatalogService;
-import org.apache.oodt.cas.catalog.util.PluginURL;
-import org.apache.oodt.cas.catalog.util.Serializer;
-import org.apache.oodt.cas.metadata.Metadata;
-
-import java.net.URL;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-//OODT imports
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * An Abstract Communication Channel Server Interface that automatically handles throw exceptions
- * <p>
- */
-public abstract class AbstractCommunicationChannelServer implements CommunicationChannelServer {
-
- private static Logger LOG = Logger.getLogger(AbstractCommunicationChannelServer.class.getName());
-
- protected CatalogService catalogService;
- protected int port;
- protected Serializer serializer;
-
- public AbstractCommunicationChannelServer() {
- this.serializer = new Serializer();
- }
-
- public void setCatalogService(CatalogService catalogService) {
- this.catalogService = catalogService;
- }
-
- public void setPort(int port) {
- this.port = port;
- }
-
- public int getPort() {
- return this.port;
- }
-
- public void shutdown() throws CatalogServiceException {
- try {
- this.catalogService.shutdown();
- this.catalogService = null;
- System.gc(); // used to speed up shutdown process (gives java a boost-start at cleaning up everything so server will die)
- }catch (CatalogServiceException e) {
- LOG.log(Level.SEVERE, "Failed to shutdown server : " + e.getMessage(), e);
- throw e;
- }
- }
-
- public boolean isRestrictQueryPermissions() throws CatalogServiceException {
- try {
- return this.catalogService.isRestrictQueryPermissions();
- }catch (CatalogServiceException e) {
- LOG.log(Level.SEVERE, "Failed while checking server query permissions : " + e.getMessage(), e);
- throw e;
- }
- }
-
- public boolean isRestrictIngestPermissions() throws CatalogServiceException {
- try {
- return this.catalogService.isRestrictIngestPermissions();
- }catch (CatalogServiceException e) {
- LOG.log(Level.SEVERE, "Failed while checking server ingest permissions : " + e.getMessage(), e);
- throw e;
- }
- }
- public void addCatalog(Catalog catalog) throws CatalogServiceException {
- try {
- this.catalogService.addCatalog(catalog);
- }catch (CatalogServiceException e) {
- LOG.log(Level.SEVERE, "Failed while adding catalog '" + catalog + "' to server : " + e.getMessage(), e);
- throw e;
- }
- }
-
- public void replaceCatalog(Catalog catalog) throws CatalogServiceException {
- try {
- this.catalogService.replaceCatalog(catalog);
- }catch (CatalogServiceException e) {
- LOG.log(Level.SEVERE, "Failed while replacing catalog '" + catalog + "' to server : " + e.getMessage(), e);
- throw e;
- }
- }
-
- public void addCatalog(String catalogId, Index index) throws CatalogServiceException {
- try {
- this.catalogService.addCatalog(catalogId, index);
- }catch (CatalogServiceException e) {
- LOG.log(Level.SEVERE, "Failed while adding catalog '" + catalogId + "' with index '" + index + "' to server : " + e.getMessage(), e);
- throw e;
- }
- }
-
- public void addCatalog(String catalogId, Index index, List<Dictionary> dictionaries) throws CatalogServiceException {
- try {
- this.catalogService.addCatalog(catalogId, index, dictionaries);
- }catch (CatalogServiceException e) {
- LOG.log(Level.SEVERE, "Failed while adding catalog '" + catalogId + "' with index '" + index + "' and dictionaries '" + dictionaries + "' to server : " + e.getMessage(), e);
- throw e;
- }
- }
-
- public void addCatalog(String catalogId, Index index, List<Dictionary> dictionaries, boolean restrictQueryPermission, boolean restrictIngestPermission) throws CatalogServiceException {
- try {
- this.catalogService.addCatalog(catalogId, index, dictionaries, restrictQueryPermission, restrictIngestPermission);
- }catch (CatalogServiceException e) {
- LOG.log(Level.SEVERE, "Failed while adding catalog '" + catalogId + "' with index '" + index + "' and dictionaries '" + dictionaries + "' and restrictQueryPermission '" + restrictQueryPermission + "' and restrictIngestPermission '" + restrictIngestPermission + "' to server : " + e.getMessage(), e);
- throw e;
- }
- }
-
- public void addDictionary(String catalogId, Dictionary dictionary) throws CatalogServiceException {
- try {
- this.catalogService.addDictionary(catalogId, dictionary);
- }catch (CatalogServiceException e) {
- LOG.log(Level.SEVERE, "Failed while adding dictionary '" + dictionary + "' to catalog '" + catalogId + "' : " + e.getMessage(), e);
- throw e;
- }
- }
-
- public void replaceDictionaries(String catalogId, List<Dictionary> dictionaries) throws CatalogServiceException {
- try {
- this.catalogService.replaceDictionaries(catalogId, dictionaries);
- }catch (CatalogServiceException e) {
- LOG.log(Level.SEVERE, "Failed while replacing dictionaries '" + dictionaries + "' in catalog '" + catalogId + "' : " + e.getMessage(), e);
- throw e;
- }
- }
-
- public void replaceIndex(String catalogId, Index index) throws CatalogServiceException {
- try {
- this.catalogService.replaceIndex(catalogId, index);
- }catch (CatalogServiceException e) {
- LOG.log(Level.SEVERE, "Failed while replacing index '" + index + "' in catalog '" + catalogId + "' : " + e.getMessage(), e);
- throw e;
- }
- }
-
- public void modifyIngestPermission(String catalogId, boolean restrictIngestPermission) throws CatalogServiceException {
- try {
- this.catalogService.modifyIngestPermission(catalogId, restrictIngestPermission);
- }catch (CatalogServiceException e) {
- LOG.log(Level.SEVERE, "Failed while changing ingest permissions for catalog '" + catalogId + "' to '" + restrictIngestPermission + "' : " + e.getMessage(), e);
- throw e;
- }
- }
-
- public void modifyQueryPermission(String catalogId, boolean restrictQueryPermission) throws CatalogServiceException {
- try {
- this.catalogService.modifyQueryPermission(catalogId, restrictQueryPermission);
- }catch (CatalogServiceException e) {
- LOG.log(Level.SEVERE, "Failed while changing query permissions for catalog '" + catalogId + "' to '" + restrictQueryPermission + "' : " + e.getMessage(), e);
- throw e;
- }
- }
-
- public void removeCatalog(String catalogId) throws CatalogServiceException {
- try {
- this.catalogService.removeCatalog(catalogId);
- } catch (CatalogServiceException e) {
- LOG.log(Level.SEVERE, "Failed while removing catalog '" + catalogId + "' : " + e.getMessage(), e);
- throw e;
- }
- }
-
- public List<PluginURL> getPluginUrls() throws CatalogServiceException {
- try {
- return this.catalogService.getPluginUrls();
- }catch (CatalogServiceException e) {
- LOG.log(Level.SEVERE, "Failed while getting plugin URLs : " + e.getMessage(), e);
- throw e;
- }
- }
-
- public void addPluginUrls(List<PluginURL> pluginURLs) throws CatalogServiceException {
- try {
- this.catalogService.addPluginUrls(pluginURLs);
- this.serializer.refreshClassLoader();
- }catch (CatalogServiceException e) {
- LOG.log(Level.SEVERE, "Failed while adding plugin URLs '" + pluginURLs + "' : " + e.getMessage(), e);
- throw e;
- }
- }
-
- public URL getPluginStorageDir() throws CatalogServiceException {
- try {
- return this.catalogService.getPluginStorageDir();
- }catch (CatalogServiceException e) {
- LOG.log(Level.SEVERE, "Failed while getting plugin storage directory : " + e.getMessage(), e);
- throw e;
- }
- }
-
- public Set<String> getCurrentCatalogIds() throws CatalogServiceException {
- try {
- return this.catalogService.getCurrentCatalogIds();
- }catch (CatalogServiceException e) {
- LOG.log(Level.SEVERE, "Failed while getting current catalog ids : " + e.getMessage(), e);
- throw e;
- }
- }
-
- public TransactionReceipt ingest(Metadata metadata) throws CatalogServiceException {
- try {
- return this.catalogService.ingest(metadata);
- }catch (CatalogServiceException e) {
- LOG.log(Level.SEVERE, "Failed while performing ingest : " + e.getMessage(), e);
- throw e;
- }
- }
-
- public void delete(Metadata metadata) throws CatalogServiceException {
- try {
- this.catalogService.delete(metadata);
- }catch (CatalogServiceException e) {
- LOG.log(Level.SEVERE, "Failed while performing deletion : " + e.getMessage(), e);
- throw e;
- }
- }
-
- public List<String> getProperty(String key) throws CatalogServiceException {
- try {
- return this.catalogService.getProperty(key);
- }catch (CatalogServiceException e) {
- LOG.log(Level.SEVERE, "Failed while getting property '" + key + "' : " + e.getMessage(), e);
- throw e;
- }
- }
-
- public Properties getCalalogProperties() throws CatalogServiceException {
- try {
- return this.catalogService.getCalalogProperties();
- }catch (CatalogServiceException e) {
- LOG.log(Level.SEVERE, "Failed while getting catalog properties : " + e.getMessage(), e);
- throw e;
- }
- }
-
- public Properties getCalalogProperties(String catalogId) throws CatalogServiceException {
- try {
- return this.catalogService.getCalalogProperties(catalogId);
- }catch (CatalogServiceException e) {
- LOG.log(Level.SEVERE, "Failed while getting catalog properties for catalog '" + catalogId + "' : " + e.getMessage(), e);
- throw e;
- }
- }
-
- public Page getNextPage(Page page) throws CatalogServiceException {
- try {
- return this.catalogService.getNextPage(page);
- }catch (CatalogServiceException e) {
- LOG.log(Level.SEVERE, "Failed while getting next page : " + e.getMessage(), e);
- throw e;
- }
- }
-
- public Page getPage(PageInfo pageInfo, QueryExpression queryExpression) throws CatalogServiceException {
- try {
- return this.catalogService.getPage(pageInfo, queryExpression);
- }catch (CatalogServiceException e) {
- LOG.log(Level.SEVERE, "Failed while getting next page [pageInfo='" + pageInfo + "',query='" + queryExpression + "'] : " + e.getMessage(), e);
- throw e;
- }
- }
-
- public Page getPage(PageInfo pageInfo, QueryExpression queryExpression, Set<String> catalogIds) throws CatalogServiceException {
- try {
- return this.catalogService.getPage(pageInfo, queryExpression, catalogIds);
- }catch (CatalogServiceException e) {
- LOG.log(Level.SEVERE, "Failed while getting next page [pageInfo='" + pageInfo + "',query='" + queryExpression + "',catalogIds='" + catalogIds + "'] : " + e.getMessage(), e);
- throw e;
- }
- }
-
- public List<TransactionalMetadata> getMetadata(Page page) throws CatalogServiceException {
- try {
- return this.catalogService.getMetadata(page);
- }catch (CatalogServiceException e) {
- LOG.log(Level.SEVERE, "Failed while getting metadata for page : " + e.getMessage(), e);
- throw e;
- }
- }
-
- public QueryPager query(QueryExpression queryExpression) throws CatalogServiceException {
- try {
- return this.catalogService.query(queryExpression);
- }catch (CatalogServiceException e) {
- LOG.log(Level.SEVERE, "Failed while performing query '" + queryExpression + "' : " + e.getMessage(), e);
- throw e;
- }
- }
-
- public QueryPager query(QueryExpression queryExpression, Set<String> catalogIds) throws CatalogServiceException {
- try {
- return this.catalogService.query(queryExpression, catalogIds);
- }catch (CatalogServiceException e) {
- LOG.log(Level.SEVERE, "Failed while performing query '" + queryExpression + "' to catalogs '" + catalogIds + "' : " + e.getMessage(), e);
- throw e;
- }
- }
-
- public List<TransactionalMetadata> getNextPage(QueryPager queryPager) throws CatalogServiceException {
- try {
- return this.catalogService.getNextPage(queryPager);
- }catch (CatalogServiceException e) {
- LOG.log(Level.SEVERE, "Failed while get next page from query pager : " + e.getMessage(), e);
- throw e;
- }
- }
-
- public List<TransactionalMetadata> getAllPages(QueryPager queryPager) throws CatalogServiceException {
- try {
- return this.catalogService.getAllPages(queryPager);
- }catch (CatalogServiceException e) {
- LOG.log(Level.SEVERE, "Failed while get all pages from query pager : " + e.getMessage(), e);
- throw e;
- }
- }
-
- public List<TransactionalMetadata> getMetadataFromTransactionIdStrings(List<String> catalogServiceTransactionIdStrings) throws CatalogServiceException {
- try {
- return this.catalogService.getMetadataFromTransactionIdStrings(catalogServiceTransactionIdStrings);
- }catch (CatalogServiceException e) {
- LOG.log(Level.SEVERE, "Failed while getting metadata for catalog service transaction ids '" + catalogServiceTransactionIdStrings + "' : " + e.getMessage(), e);
- throw e;
- }
- }
-
- public List<TransactionalMetadata> getMetadataFromTransactionIds(List<TransactionId<?>> catalogServiceTransactionIds) throws CatalogServiceException {
- try {
- return this.catalogService.getMetadataFromTransactionIds(catalogServiceTransactionIds);
- }catch (CatalogServiceException e) {
- LOG.log(Level.SEVERE, "Failed while getting metadata for catalog service transaction ids '" + catalogServiceTransactionIds + "' : " + e.getMessage(), e);
- throw e;
- }
- }
-
- public List<TransactionId<?>> getCatalogServiceTransactionIds(List<TransactionId<?>> catalogTransactionIds, String catalogId) throws CatalogServiceException {
- try {
- return this.catalogService.getCatalogServiceTransactionIds(catalogTransactionIds, catalogId);
- }catch (CatalogServiceException e) {
- LOG.log(Level.SEVERE, "Failed while getting catalog service transaction ids for catalog transaction ids '" + catalogTransactionIds + "' from catalog '" + catalogId + "' : " + e.getMessage(), e);
- throw e;
- }
- }
-
- public TransactionId<?> getCatalogServiceTransactionId(TransactionId<?> catalogTransactionId, String catalogId) throws CatalogServiceException {
- try {
- return this.catalogService.getCatalogServiceTransactionId(catalogTransactionId, catalogId);
- }catch (CatalogServiceException e) {
- LOG.log(Level.SEVERE, "Failed while getting catalog service transaction id for catalog transaction id '" + catalogTransactionId + "' from catalog '" + catalogId + "' : " + e.getMessage(), e);
- throw e;
- }
- }
-
- public TransactionId<?> getCatalogServiceTransactionId(CatalogReceipt catalogReceipt, boolean generateNew) throws CatalogServiceException {
- try {
- return this.catalogService.getCatalogServiceTransactionId(catalogReceipt, generateNew);
- }catch (CatalogServiceException e) {
- LOG.log(Level.SEVERE, "Failed while getting metadata for catalog service transaction id for catalog receipt '" + catalogReceipt + "' with generate new equal '" + generateNew + "' : " + e.getMessage(), e);
- throw e;
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/CommunicationChannelClient.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/CommunicationChannelClient.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/CommunicationChannelClient.java
deleted file mode 100644
index 63f5016..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/CommunicationChannelClient.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.server.channel;
-
-import org.apache.oodt.cas.catalog.exception.CatalogException;
-import org.apache.oodt.cas.catalog.metadata.TransactionalMetadata;
-import org.apache.oodt.cas.catalog.page.CatalogReceipt;
-import org.apache.oodt.cas.catalog.page.Page;
-import org.apache.oodt.cas.catalog.page.PageInfo;
-import org.apache.oodt.cas.catalog.page.QueryPager;
-import org.apache.oodt.cas.catalog.page.TransactionReceipt;
-import org.apache.oodt.cas.catalog.query.QueryExpression;
-import org.apache.oodt.cas.catalog.struct.Dictionary;
-import org.apache.oodt.cas.catalog.struct.Index;
-import org.apache.oodt.cas.catalog.struct.TransactionId;
-import org.apache.oodt.cas.catalog.system.Catalog;
-import org.apache.oodt.cas.catalog.util.PluginURL;
-import org.apache.oodt.cas.metadata.Metadata;
-
-import java.net.URL;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A Communication Channel Interface
- * <p>
- */
-public interface CommunicationChannelClient {
-
- void shutdown() throws CatalogException;
-
- boolean isRestrictQueryPermissions() throws CatalogException;
-
- boolean isRestrictIngestPermissions() throws CatalogException;
-
- void addCatalog(Catalog catalog) throws CatalogException;
-
- void replaceCatalog(Catalog catalog) throws CatalogException;
-
- void addCatalog(String catalogId, Index index) throws CatalogException;
-
- void addCatalog(String catalogId, Index index, List<Dictionary> dictionaries) throws CatalogException;
-
- void addCatalog(String catalogId, Index index, List<Dictionary> dictionaries, boolean restrictQueryPermission,
- boolean restrictIngestPermission) throws CatalogException;
-
- void addDictionary(String catalogId, Dictionary dictionary) throws CatalogException;
-
- void replaceDictionaries(String catalogId, List<Dictionary> dictionaries) throws CatalogException;
-
- void replaceIndex(String catalogId, Index index) throws CatalogException;
-
- void modifyIngestPermission(String catalogId, boolean restrictIngestPermission) throws CatalogException;
-
- void modifyQueryPermission(String catalogId, boolean restrictQueryPermission) throws CatalogException;
-
- void removeCatalog(String catalogUrn) throws CatalogException;
-
- List<PluginURL> getPluginUrls() throws CatalogException;
-
- void addPluginUrls(List<PluginURL> pluginUrls) throws CatalogException;
-
- URL getPluginStorageDir() throws CatalogException;
-
- void transferUrl(URL fromUrl, URL toUrl) throws CatalogException;
-
- Set<String> getCurrentCatalogIds() throws CatalogException;
-
- TransactionReceipt ingest(Metadata metadata) throws CatalogException;
-
- void delete(Metadata metadata) throws CatalogException;
-
- List<String> getProperty(String key) throws CatalogException;
-
- Properties getCalalogProperties() throws CatalogException;
-
- Properties getCalalogProperties(String catalogUrn) throws CatalogException;
-
- Page getNextPage(Page page) throws CatalogException;
-
- Page getPage(PageInfo pageInfo, QueryExpression queryExpression) throws CatalogException;
-
- Page getPage(PageInfo pageInfo, QueryExpression queryExpression, Set<String> catalogIds) throws CatalogException;
-
- List<TransactionalMetadata> getMetadata(Page page) throws CatalogException;
-
- QueryPager query(QueryExpression queryExpression) throws CatalogException;
-
- QueryPager query(QueryExpression queryExpression, Set<String> catalogIds) throws CatalogException;
-
- List<TransactionalMetadata> getNextPage(QueryPager queryPager) throws CatalogException;
-
- List<TransactionId<?>> getTransactionIdsForAllPages(QueryPager queryPager) throws CatalogException;
-
- List<TransactionalMetadata> getAllPages(QueryPager queryPager) throws CatalogException;
-
- List<TransactionalMetadata> getMetadataFromTransactionIdStrings(List<String> catalogServiceTransactionIdStrings) throws CatalogException;
-
- List<TransactionalMetadata> getMetadataFromTransactionIds(List<TransactionId<?>> catalogServiceTransactionIds) throws CatalogException;
-
- List<TransactionId<?>> getCatalogServiceTransactionIds(List<TransactionId<?>> catalogTransactionIds,
- String catalogUrn) throws CatalogException;
-
- TransactionId<?> getCatalogServiceTransactionId(TransactionId<?> catalogTransactionId, String catalogUrn) throws CatalogException;
-
- TransactionId<?> getCatalogServiceTransactionId(CatalogReceipt catalogReceipt, boolean generateNew) throws CatalogException;
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/CommunicationChannelClientFactory.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/CommunicationChannelClientFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/CommunicationChannelClientFactory.java
deleted file mode 100644
index 24d0eb7..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/CommunicationChannelClientFactory.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.server.channel;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A Factory for creating CommunicationChannelClient
- * <p>
- */
-public interface CommunicationChannelClientFactory {
-
- CommunicationChannelClient createCommunicationChannelClient();
-
- void setServerUrl(String url);
-
- String getServerUrl();
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/CommunicationChannelServer.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/CommunicationChannelServer.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/CommunicationChannelServer.java
deleted file mode 100644
index bfd43a1..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/CommunicationChannelServer.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.server.channel;
-
-//JDK imports
-import org.apache.oodt.cas.catalog.metadata.TransactionalMetadata;
-import org.apache.oodt.cas.catalog.page.*;
-import org.apache.oodt.cas.catalog.query.QueryExpression;
-import org.apache.oodt.cas.catalog.struct.Dictionary;
-import org.apache.oodt.cas.catalog.struct.Index;
-import org.apache.oodt.cas.catalog.struct.TransactionId;
-import org.apache.oodt.cas.catalog.system.Catalog;
-import org.apache.oodt.cas.catalog.system.CatalogService;
-import org.apache.oodt.cas.catalog.util.PluginURL;
-import org.apache.oodt.cas.metadata.Metadata;
-
-import java.net.URL;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A Communication Channel Server
- * <p>
- */
-public interface CommunicationChannelServer {
-
- void setCatalogService(CatalogService catalogService);
-
- void setPort(int port);
-
- int getPort();
-
- void startup();
-
- void shutdown() throws Exception;
-
- boolean isRestrictQueryPermissions() throws Exception;
-//
-// public void setRestrictQueryPermissions(boolean restrictQueryPermissions) throws Exception;
-//
-boolean isRestrictIngestPermissions() throws Exception;
-//
-// public void setHasIngestPermissions(boolean restrictIngestPermissions) throws Exception;
-
-// public Class<? extends TransactionId<?>> getTransactionIdClass() throws Exception;
-//
-// public void setTransactionIdClass(Class<? extends TransactionId<?>> transactionIdClass) throws Exception;
-//
-void addCatalog(Catalog catalog) throws Exception;
-
- void replaceCatalog(Catalog catalog) throws Exception;
-
- void addCatalog(String catalogId, Index index) throws Exception;
-
- void addCatalog(String catalogId, Index index, List<Dictionary> dictionaries) throws Exception;
-
- void addCatalog(String catalogId, Index index, List<Dictionary> dictionaries, boolean restrictQueryPermission,
- boolean restrictIngestPermission) throws Exception;
-
- void addDictionary(String catalogId, Dictionary dictionary) throws Exception;
-
- void replaceDictionaries(String catalogId, List<Dictionary> dictionaries) throws Exception;
-
- void replaceIndex(String catalogId, Index index) throws Exception;
-
- void modifyIngestPermission(String catalogId, boolean restrictIngestPermission) throws Exception;
-
- void modifyQueryPermission(String catalogId, boolean restrictQueryPermission) throws Exception;
-
- void removeCatalog(String catalogUrn) throws Exception;
-
-// public void removeCatalog(String catalogUrn, boolean preserveMapping) throws Exception;
-
- List<PluginURL> getPluginUrls() throws Exception;
-
- void addPluginUrls(List<PluginURL> pluginURLs) throws Exception;
-
- URL getPluginStorageDir() throws Exception;
-
-// public Set<Catalog> getCurrentCatalogList() throws Exception;
-//
-// public Catalog getCatalog(String catalogUrn) throws Exception;
-
- Set<String> getCurrentCatalogIds() throws Exception;
-
- TransactionReceipt ingest(Metadata metadata) throws Exception;
-
- void delete(Metadata metadata) throws Exception;
-
- List<String> getProperty(String key) throws Exception;
-
- Properties getCalalogProperties() throws Exception;
-
- Properties getCalalogProperties(String catalogUrn) throws Exception;
-
-// public Page getFirstPage(QueryExpression queryExpression) throws Exception;
-//
-// public Page getFirstPage(QueryExpression queryExpression, Set<String> catalogIds) throws Exception;
-
- Page getNextPage(Page page) throws Exception;
-
- Page getPage(PageInfo pageInfo, QueryExpression queryExpression) throws Exception;
-
- Page getPage(PageInfo pageInfo, QueryExpression queryExpression, Set<String> catalogIds) throws Exception;
-
-// public Page getLastPage(QueryExpression queryExpression) throws Exception;
-//
-// public Page getLastPage(QueryExpression queryExpression, Set<String> catalogIds) throws Exception;
-
- List<TransactionalMetadata> getMetadata(Page page) throws Exception;
-
- QueryPager query(QueryExpression queryExpression) throws Exception;
-
- QueryPager query(QueryExpression queryExpression, Set<String> catalogIds) throws Exception;
-
-// public QueryPager query(QueryExpression queryExpression, boolean sortResults) throws Exception;
-
- List<TransactionalMetadata> getNextPage(QueryPager queryPager) throws Exception;
-
-// public List<TransactionId<?>> getTransactionIdsForAllPages(QueryPager queryPager) throws Exception;
-
- List<TransactionalMetadata> getAllPages(QueryPager queryPager) throws Exception;
-
- List<TransactionalMetadata> getMetadataFromTransactionIdStrings(List<String> catalogServiceTransactionIdStrings) throws Exception;
-
- List<TransactionalMetadata> getMetadataFromTransactionIds(List<TransactionId<?>> catalogServiceTransactionIds) throws Exception;
-
- List<TransactionId<?>> getCatalogServiceTransactionIds(List<TransactionId<?>> catalogTransactionIds,
- String catalogUrn) throws Exception;
-
- TransactionId<?> getCatalogServiceTransactionId(TransactionId<?> catalogTransactionId, String catalogUrn) throws Exception;
-
- TransactionId<?> getCatalogServiceTransactionId(CatalogReceipt catalogReceipt, boolean generateNew) throws Exception;
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/CommunicationChannelServerFactory.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/CommunicationChannelServerFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/CommunicationChannelServerFactory.java
deleted file mode 100644
index db6116b..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/CommunicationChannelServerFactory.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.server.channel;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.system.CatalogServiceFactory;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A Factory for creating CommunicationChannelServer
- * <p>
- */
-public interface CommunicationChannelServerFactory {
-
- CommunicationChannelServer createCommunicationChannelServer();
-
- void setPort(int port);
-
- int getPort();
-
- void setCatalogServiceFactory(CatalogServiceFactory catalogServiceFactory);
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/rmi/RmiCommunicationChannelClient.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/rmi/RmiCommunicationChannelClient.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/rmi/RmiCommunicationChannelClient.java
deleted file mode 100644
index 3611cc9..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/rmi/RmiCommunicationChannelClient.java
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.server.channel.rmi;
-
-//JDK imports
-import org.apache.oodt.cas.catalog.exception.CatalogException;
-import org.apache.oodt.cas.catalog.metadata.TransactionalMetadata;
-import org.apache.oodt.cas.catalog.page.CatalogReceipt;
-import org.apache.oodt.cas.catalog.page.Page;
-import org.apache.oodt.cas.catalog.page.PageInfo;
-import org.apache.oodt.cas.catalog.page.QueryPager;
-import org.apache.oodt.cas.catalog.page.TransactionReceipt;
-import org.apache.oodt.cas.catalog.query.QueryExpression;
-import org.apache.oodt.cas.catalog.server.channel.CommunicationChannelClient;
-import org.apache.oodt.cas.catalog.struct.Dictionary;
-import org.apache.oodt.cas.catalog.struct.Index;
-import org.apache.oodt.cas.catalog.struct.TransactionId;
-import org.apache.oodt.cas.catalog.system.Catalog;
-import org.apache.oodt.cas.catalog.util.PluginURL;
-import org.apache.oodt.cas.metadata.Metadata;
-
-import java.net.URL;
-import java.rmi.RemoteException;
-import java.rmi.server.UnicastRemoteObject;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-
-//OODT imports
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- */
-public class RmiCommunicationChannelClient extends UnicastRemoteObject implements CommunicationChannelClient{
-
- private static final long serialVersionUID = 4618051069367331679L;
-
- protected RmiCommunicationChannelClient() throws RemoteException {
- super();
- }
-
- public void addCatalog(Catalog catalog) throws CatalogException {
- // TODO Auto-generated method stub
-
- }
-
- public void addCatalog(String catalogId, Index index) throws CatalogException {
- // TODO Auto-generated method stub
-
- }
-
- public void addCatalog(String catalogId, Index index,
- List<Dictionary> dictionaries) throws CatalogException {
- // TODO Auto-generated method stub
-
- }
-
- public void addCatalog(String catalogId, Index index,
- List<Dictionary> dictionaries, boolean restrictQueryPermission,
- boolean restrictIngestPermission) throws CatalogException {
- // TODO Auto-generated method stub
-
- }
-
- public void addDictionary(String catalogId, Dictionary dictionary)
- throws CatalogException {
- // TODO Auto-generated method stub
-
- }
-
- public void addPluginUrls(List<PluginURL> pluginUrls) throws CatalogException {
- // TODO Auto-generated method stub
-
- }
-
- public void delete(Metadata metadata) throws CatalogException {
- // TODO Auto-generated method stub
-
- }
-
- public List<TransactionalMetadata> getAllPages(QueryPager queryPager)
- throws CatalogException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Properties getCalalogProperties() throws CatalogException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Properties getCalalogProperties(String catalogUrn) throws CatalogException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public TransactionId<?> getCatalogServiceTransactionId(
- TransactionId<?> catalogTransactionId, String catalogUrn)
- throws CatalogException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public TransactionId<?> getCatalogServiceTransactionId(
- CatalogReceipt catalogReceipt, boolean generateNew)
- throws CatalogException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public List<TransactionId<?>> getCatalogServiceTransactionIds(
- List<TransactionId<?>> catalogTransactionIds, String catalogUrn)
- throws CatalogException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Set<String> getCurrentCatalogIds() throws CatalogException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public List<TransactionalMetadata> getMetadata(Page page) throws CatalogException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public List<TransactionalMetadata> getMetadataFromTransactionIdStrings(
- List<String> catalogServiceTransactionIdStrings) throws CatalogException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public List<TransactionalMetadata> getMetadataFromTransactionIds(
- List<TransactionId<?>> catalogServiceTransactionIds)
- throws CatalogException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Page getNextPage(Page page) throws CatalogException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public List<TransactionalMetadata> getNextPage(QueryPager queryPager)
- throws CatalogException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Page getPage(PageInfo pageInfo, QueryExpression queryExpression)
- throws CatalogException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Page getPage(PageInfo pageInfo, QueryExpression queryExpression,
- Set<String> catalogIds) throws CatalogException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public URL getPluginStorageDir() throws CatalogException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public List<PluginURL> getPluginUrls() throws CatalogException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public List<String> getProperty(String key) throws CatalogException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public List<TransactionId<?>> getTransactionIdsForAllPages(
- QueryPager queryPager) throws CatalogException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public TransactionReceipt ingest(Metadata metadata) throws CatalogException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public boolean isRestrictIngestPermissions() throws CatalogException {
- // TODO Auto-generated method stub
- return false;
- }
-
- public boolean isRestrictQueryPermissions() throws CatalogException {
- // TODO Auto-generated method stub
- return false;
- }
-
- public void modifyIngestPermission(String catalogId,
- boolean restrictIngestPermission) throws CatalogException {
- // TODO Auto-generated method stub
-
- }
-
- public void modifyQueryPermission(String catalogId,
- boolean restrictQueryPermission) throws CatalogException {
- // TODO Auto-generated method stub
-
- }
-
- public QueryPager query(QueryExpression queryExpression) throws CatalogException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public QueryPager query(QueryExpression queryExpression,
- Set<String> catalogIds) throws CatalogException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void removeCatalog(String catalogUrn) throws CatalogException {
- // TODO Auto-generated method stub
-
- }
-
- public void replaceCatalog(Catalog catalog) throws CatalogException {
- // TODO Auto-generated method stub
-
- }
-
- public void replaceDictionaries(String catalogId,
- List<Dictionary> dictionaries) throws CatalogException {
- // TODO Auto-generated method stub
-
- }
-
- public void replaceIndex(String catalogId, Index index) throws CatalogException {
- // TODO Auto-generated method stub
-
- }
-
- public void shutdown() throws CatalogException {
- // TODO Auto-generated method stub
-
- }
-
- public void transferUrl(URL fromUrl, URL toUrl) throws CatalogException {
- // TODO Auto-generated method stub
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/rmi/RmiCommunicationChannelClientInterface.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/rmi/RmiCommunicationChannelClientInterface.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/rmi/RmiCommunicationChannelClientInterface.java
deleted file mode 100644
index 97f261b..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/rmi/RmiCommunicationChannelClientInterface.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.server.channel.rmi;
-
-//JDK imports
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.mapping.IngestMapper;
-import org.apache.oodt.cas.catalog.metadata.TransactionalMetadata;
-import org.apache.oodt.cas.catalog.page.QueryPager;
-import org.apache.oodt.cas.catalog.query.QueryExpression;
-import org.apache.oodt.cas.catalog.repository.CatalogRepository;
-import org.apache.oodt.cas.catalog.struct.TransactionId;
-import org.apache.oodt.cas.catalog.system.Catalog;
-import org.apache.oodt.cas.metadata.Metadata;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- */
-public interface RmiCommunicationChannelClientInterface extends Remote {
-
- void setCatalogRepository(CatalogRepository catalogRepository);
-
- CatalogRepository getCatalogRepository();
-
- IngestMapper getIngestMapper() throws RemoteException;
-
- void setIngestMapper(IngestMapper ingestMapper) throws RemoteException;
-
- boolean isRestrictQueryPermissions() throws RemoteException;
-
- void setRestrictQueryPermissions(boolean restrictQueryPermissions) throws RemoteException;
-
- boolean isHasIngestPermissions() throws RemoteException;
-
- void setHasIngestPermissions(boolean restrictIngestPermissions) throws RemoteException;
-
- Class<? extends TransactionId<?>> getTransactionIdClass() throws RemoteException;
-
- void setTransactionIdClass(Class<? extends TransactionId<?>> transactionIdClass) throws RemoteException;
-
- void addCatalog(Catalog catalog) throws RemoteException;
-
- void addCatalog(Catalog catalog, boolean allowOverride) throws RemoteException;
-
- void removeCatalog(String catalogUrn) throws RemoteException;
-
- void removeCatalog(String catalogUrn, boolean preserveMapping) throws RemoteException;
-
- Set<Catalog> getCurrentCatalogList() throws RemoteException;
-
- Catalog getCatalog(String catalogUrn) throws RemoteException;
-
- Set<String> getCurrentCatalogIds() throws RemoteException;
-
- TransactionId<?> ingest(Metadata metadata) throws RemoteException;
-
- void delete(Metadata metadata) throws RemoteException;
-
- List<String> getProperty(String key) throws RemoteException;
-
- Properties getCalalogProperties() throws RemoteException;
-
- Properties getCalalogProperties(String catalogUrn) throws RemoteException;
-
- QueryPager query(QueryExpression queryExpression) throws RemoteException;
-
- QueryPager query(QueryExpression queryExpression, boolean sortResults) throws RemoteException;
-
- Set<TransactionalMetadata> getNextPage(QueryPager queryPager) throws RemoteException;
-
- Set<TransactionId<?>> getTransactionIdsForAllPages(QueryPager queryPager) throws RemoteException;
-
- Set<TransactionalMetadata> getAllPages(QueryPager queryPager) throws RemoteException;
-
- Set<TransactionalMetadata> getMetadataFromTransactionIdStrings(List<String> catalogServiceTransactionIdStrings) throws RemoteException;
-
- Set<TransactionalMetadata> getMetadataFromTransactionIds(List<TransactionId<?>> catalogServiceTransactionIds) throws RemoteException;
-
- Set<TransactionId<?>> getCatalogServiceTransactionIds(List<TransactionId<?>> catalogTransactionIds,
- String catalogUrn) throws RemoteException;
-
- TransactionId<?> getCatalogServiceTransactionId(TransactionId<?> catalogTransactionId, String catalogUrn) throws RemoteException;
-
- TransactionId<?> getCatalogServiceTransactionId(TransactionId<?> catalogTransactionId, String catalogUrn,
- boolean generateNew) throws RemoteException;
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/rmi/RmiCommunicationChannelClientMBean.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/rmi/RmiCommunicationChannelClientMBean.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/rmi/RmiCommunicationChannelClientMBean.java
deleted file mode 100644
index 9c25ab7..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/rmi/RmiCommunicationChannelClientMBean.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.server.channel.rmi;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- */
-public interface RmiCommunicationChannelClientMBean {
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/rmi/RmiCommunicationChannelServer.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/rmi/RmiCommunicationChannelServer.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/rmi/RmiCommunicationChannelServer.java
deleted file mode 100644
index c03000b..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/rmi/RmiCommunicationChannelServer.java
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.server.channel.rmi;
-
-//JDK imports
-import java.io.IOException;
-import java.net.URL;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.metadata.TransactionalMetadata;
-import org.apache.oodt.cas.catalog.page.CatalogReceipt;
-import org.apache.oodt.cas.catalog.page.Page;
-import org.apache.oodt.cas.catalog.page.PageInfo;
-import org.apache.oodt.cas.catalog.page.QueryPager;
-import org.apache.oodt.cas.catalog.page.TransactionReceipt;
-import org.apache.oodt.cas.catalog.query.QueryExpression;
-import org.apache.oodt.cas.catalog.server.channel.CommunicationChannelServer;
-import org.apache.oodt.cas.catalog.struct.Dictionary;
-import org.apache.oodt.cas.catalog.struct.Index;
-import org.apache.oodt.cas.catalog.struct.TransactionId;
-import org.apache.oodt.cas.catalog.system.Catalog;
-import org.apache.oodt.cas.catalog.system.CatalogService;
-import org.apache.oodt.cas.catalog.util.PluginURL;
-import org.apache.oodt.cas.metadata.Metadata;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- */
-public class RmiCommunicationChannelServer implements
- CommunicationChannelServer {
-
- public void shutdown() throws IOException {
- // TODO Auto-generated method stub
-
- }
-
- public void startup() {
- // TODO Auto-generated method stub
-
- }
-
- public void addCatalog(Catalog catalog) throws Exception {
- // TODO Auto-generated method stub
-
- }
-
- public void addCatalog(String catalogId, Index index) throws Exception {
- // TODO Auto-generated method stub
-
- }
-
- public void addCatalog(String catalogId, Index index,
- List<Dictionary> dictionaries) throws Exception {
- // TODO Auto-generated method stub
-
- }
-
- public void addCatalog(String catalogId, Index index,
- List<Dictionary> dictionaries, boolean restrictQueryPermission,
- boolean restrictIngestPermission) throws Exception {
- // TODO Auto-generated method stub
-
- }
-
- public void addDictionary(String catalogId, Dictionary dictionary)
- throws Exception {
- // TODO Auto-generated method stub
-
- }
-
- public void addPluginUrls(List<PluginURL> pluginURLs) throws Exception {
- // TODO Auto-generated method stub
-
- }
-
- public void delete(Metadata metadata) throws Exception {
- // TODO Auto-generated method stub
-
- }
-
- public List<TransactionalMetadata> getAllPages(QueryPager queryPager)
- throws Exception {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Properties getCalalogProperties() throws Exception {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Properties getCalalogProperties(String catalogUrn) throws Exception {
- // TODO Auto-generated method stub
- return null;
- }
-
- public TransactionId<?> getCatalogServiceTransactionId(
- TransactionId<?> catalogTransactionId, String catalogUrn)
- throws Exception {
- // TODO Auto-generated method stub
- return null;
- }
-
- public TransactionId<?> getCatalogServiceTransactionId(
- CatalogReceipt catalogReceipt, boolean generateNew)
- throws Exception {
- // TODO Auto-generated method stub
- return null;
- }
-
- public List<TransactionId<?>> getCatalogServiceTransactionIds(
- List<TransactionId<?>> catalogTransactionIds, String catalogUrn)
- throws Exception {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Set<String> getCurrentCatalogIds() throws Exception {
- // TODO Auto-generated method stub
- return null;
- }
-
- public List<TransactionalMetadata> getMetadata(Page page) throws Exception {
- // TODO Auto-generated method stub
- return null;
- }
-
- public List<TransactionalMetadata> getMetadataFromTransactionIdStrings(
- List<String> catalogServiceTransactionIdStrings) throws Exception {
- // TODO Auto-generated method stub
- return null;
- }
-
- public List<TransactionalMetadata> getMetadataFromTransactionIds(
- List<TransactionId<?>> catalogServiceTransactionIds)
- throws Exception {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Page getNextPage(Page page) throws Exception {
- // TODO Auto-generated method stub
- return null;
- }
-
- public List<TransactionalMetadata> getNextPage(QueryPager queryPager)
- throws Exception {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Page getPage(PageInfo pageInfo, QueryExpression queryExpression)
- throws Exception {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Page getPage(PageInfo pageInfo, QueryExpression queryExpression,
- Set<String> catalogIds) throws Exception {
- // TODO Auto-generated method stub
- return null;
- }
-
- public URL getPluginStorageDir() throws Exception {
- // TODO Auto-generated method stub
- return null;
- }
-
- public List<PluginURL> getPluginUrls() throws Exception {
- // TODO Auto-generated method stub
- return null;
- }
-
- public int getPort() {
- // TODO Auto-generated method stub
- return 0;
- }
-
- public List<String> getProperty(String key) throws Exception {
- // TODO Auto-generated method stub
- return null;
- }
-
- public TransactionReceipt ingest(Metadata metadata) throws Exception {
- // TODO Auto-generated method stub
- return null;
- }
-
- public boolean isRestrictIngestPermissions() throws Exception {
- // TODO Auto-generated method stub
- return false;
- }
-
- public boolean isRestrictQueryPermissions() throws Exception {
- // TODO Auto-generated method stub
- return false;
- }
-
- public void modifyIngestPermission(String catalogId,
- boolean restrictIngestPermission) throws Exception {
- // TODO Auto-generated method stub
-
- }
-
- public void modifyQueryPermission(String catalogId,
- boolean restrictQueryPermission) throws Exception {
- // TODO Auto-generated method stub
-
- }
-
- public QueryPager query(QueryExpression queryExpression) throws Exception {
- // TODO Auto-generated method stub
- return null;
- }
-
- public QueryPager query(QueryExpression queryExpression,
- Set<String> catalogIds) throws Exception {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void removeCatalog(String catalogUrn) throws Exception {
- // TODO Auto-generated method stub
-
- }
-
- public void replaceCatalog(Catalog catalog) throws Exception {
- // TODO Auto-generated method stub
-
- }
-
- public void replaceDictionaries(String catalogId,
- List<Dictionary> dictionaries) throws Exception {
- // TODO Auto-generated method stub
-
- }
-
- public void replaceIndex(String catalogId, Index index) throws Exception {
- // TODO Auto-generated method stub
-
- }
-
- public void setCatalogService(CatalogService catalogService) {
- // TODO Auto-generated method stub
-
- }
-
- public void setPort(int port) {
- // TODO Auto-generated method stub
-
- }
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelClient.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelClient.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelClient.java
deleted file mode 100644
index 51b27b4..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelClient.java
+++ /dev/null
@@ -1,639 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.server.channel.xmlrpc;
-
-import org.apache.oodt.cas.catalog.exception.CatalogException;
-import org.apache.oodt.cas.catalog.metadata.TransactionalMetadata;
-import org.apache.oodt.cas.catalog.page.CatalogReceipt;
-import org.apache.oodt.cas.catalog.page.Page;
-import org.apache.oodt.cas.catalog.page.PageInfo;
-import org.apache.oodt.cas.catalog.page.QueryPager;
-import org.apache.oodt.cas.catalog.page.TransactionReceipt;
-import org.apache.oodt.cas.catalog.query.QueryExpression;
-import org.apache.oodt.cas.catalog.server.channel.AbstractCommunicationChannelClient;
-import org.apache.oodt.cas.catalog.struct.Dictionary;
-import org.apache.oodt.cas.catalog.struct.Index;
-import org.apache.oodt.cas.catalog.struct.TransactionId;
-import org.apache.oodt.cas.catalog.system.Catalog;
-import org.apache.oodt.cas.catalog.util.PluginURL;
-import org.apache.oodt.cas.metadata.Metadata;
-import org.apache.xmlrpc.CommonsXmlRpcTransportFactory;
-import org.apache.xmlrpc.XmlRpcClient;
-import org.apache.xmlrpc.XmlRpcException;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.net.URL;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-import java.util.Vector;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A Communication Channel Client over XML-RPC
- * <p>
- */
-public class XmlRpcCommunicationChannelClient extends AbstractCommunicationChannelClient {
-
- public static final int INT = 60;
- protected XmlRpcClient client;
- protected int chunkSize;
-
- public XmlRpcCommunicationChannelClient(URL serverUrl, int connectionTimeout, int requestTimeout, int chunkSize) {
- super();
- CommonsXmlRpcTransportFactory transportFactory = new CommonsXmlRpcTransportFactory(serverUrl);
- transportFactory.setConnectionTimeout(connectionTimeout * INT * 1000);
- transportFactory.setTimeout(requestTimeout * INT * 1000);
- this.client = new XmlRpcClient(serverUrl, transportFactory);
- this.chunkSize = chunkSize;
- }
-
- public void shutdown() throws CatalogException {
- Vector<Object> args = new Vector<Object>();
- try {
- this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_shutdown", args);
- } catch (XmlRpcException e) {
- throw new CatalogException("Shutdown Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Shutdown Failed: "+ e.getMessage(), e);
- }
- }
-
- public void addCatalog(Catalog catalog) throws CatalogException {
- Vector<Object> args = new Vector<Object>();
- args.add(this.serializer.serializeObject(catalog));
- try {
- this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_addCatalog", args);
- } catch (XmlRpcException e) {
- throw new CatalogException("Add Catalog Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Add Catalog Failed: "+ e.getMessage(), e);
- }
- }
-
- public void replaceCatalog(Catalog catalog) throws CatalogException {
- Vector<Object> args = new Vector<Object>();
- args.add(this.serializer.serializeObject(catalog));
- try {
- this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_replaceCatalog", args);
- } catch (XmlRpcException e) {
- throw new CatalogException("Replace Catalog Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Replace Catalog Failed: "+ e.getMessage(), e);
- }
- }
-
- public void addCatalog(String catalogId, Index index) throws CatalogException {
- Vector<Object> args = new Vector<Object>();
- args.add(catalogId);
- args.add(this.serializer.serializeObject(index));
- try {
- this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_addCatalog", args);
- } catch (XmlRpcException e) {
- throw new CatalogException("Add Catalog Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Add Catalog Failed: "+ e.getMessage(), e);
- }
- }
-
- public void addCatalog(String catalogId, Index index, List<Dictionary> dictionaries) throws CatalogException {
- Vector<Object> args = new Vector<Object>();
- args.add(catalogId);
- args.add(this.serializer.serializeObject(index));
- args.add(this.serializer.serializeObject(dictionaries));
- try {
- this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_addCatalog", args);
- } catch (XmlRpcException e) {
- throw new CatalogException("Add Catalog Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Add Catalog Failed: "+ e.getMessage(), e);
- }
- }
-
- public void addCatalog(String catalogId, Index index, List<Dictionary> dictionaries, boolean restrictQueryPermission, boolean restrictIngestPermission) throws CatalogException {
- Vector<Object> args = new Vector<Object>();
- args.add(catalogId);
- args.add(this.serializer.serializeObject(index));
- args.add(this.serializer.serializeObject(dictionaries));
- args.add(restrictQueryPermission);
- args.add(restrictIngestPermission);
- try {
- this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_addCatalog", args);
- } catch (XmlRpcException e) {
- throw new CatalogException("Add Catalog Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Add Catalog Failed: "+ e.getMessage(), e);
- }
- }
-
- public void addDictionary(String catalogId, Dictionary dictionary) throws CatalogException {
- Vector<Object> args = new Vector<Object>();
- args.add(catalogId);
- args.add(this.serializer.serializeObject(dictionary));
- try {
- this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_addDictionary", args);
- } catch (XmlRpcException e) {
- throw new CatalogException("Add Dictionary: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Add Dictionary: "+ e.getMessage(), e);
- }
- }
-
- public void replaceDictionaries(String catalogId, List<Dictionary> dictionaries) throws CatalogException {
- Vector<Object> args = new Vector<Object>();
- args.add(catalogId);
- args.add(this.serializer.serializeObject(dictionaries));
- try {
- this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_addDictionary", args);
- } catch (XmlRpcException e) {
- throw new CatalogException("Replace Dictionaries Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Replace Dictionaries Failed: "+ e.getMessage(), e);
- }
- }
-
- public void replaceIndex(String catalogId, Index index) throws CatalogException {
- Vector<Object> args = new Vector<Object>();
- args.add(catalogId);
- args.add(this.serializer.serializeObject(index));
- try {
- this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_replaceIndex", args);
- } catch (XmlRpcException e) {
- throw new CatalogException("Replace Index Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Replace Index Failed: "+ e.getMessage(), e);
- }
- }
-
- public void modifyIngestPermission(String catalogId, boolean restrictIngestPermission) throws CatalogException {
- Vector<Object> args = new Vector<Object>();
- args.add(catalogId);
- args.add(this.serializer.serializeObject(restrictIngestPermission));
- try {
- this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_modifyIngestPermission", args);
- } catch (XmlRpcException e) {
- throw new CatalogException("Modify Ingest Permission Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Modify Ingest Permission Failed: "+ e.getMessage(), e);
- }
- }
-
- public void modifyQueryPermission(String catalogId, boolean restrictQueryPermission) throws CatalogException {
- Vector<Object> args = new Vector<Object>();
- args.add(catalogId);
- args.add(this.serializer.serializeObject(restrictQueryPermission));
- try {
- this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_modifyQueryPermission", args);
- } catch (XmlRpcException e) {
- throw new CatalogException("Modify Query Permission Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Modify Query Permission Failed: "+ e.getMessage(), e);
- }
- }
-
- public List<PluginURL> getPluginUrls() throws CatalogException {
- Vector<Object> args = new Vector<Object>();
- try {
- return this.serializer.deserializeObject(List.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getPluginUrls", args));
- } catch (XmlRpcException e) {
- throw new CatalogException("Get Plugins Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Get Plugins Failed: "+ e.getMessage(), e);
- }
- }
-
- public void addPluginUrls(List<PluginURL> pluginURLs) throws CatalogException {
- Vector<Object> args = new Vector<Object>();
- args.add(this.serializer.serializeObject(pluginURLs));
- try {
- this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_addPluginUrls", args);
- } catch (XmlRpcException e) {
- throw new CatalogException("Add Plugins Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Add Plugins Failed: "+ e.getMessage(), e);
- }
- }
-
- public URL getPluginStorageDir() throws CatalogException {
- Vector<Object> args = new Vector<Object>();
- try {
- return this.serializer.deserializeObject(URL.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getPluginStorageDir", args));
- } catch (XmlRpcException e) {
- throw new CatalogException("Get Plugin Storage Dir Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Get Plugin Storage Dir Failed: "+ e.getMessage(), e);
- }
- }
-
- public void transferUrl(URL fromUrl, URL toURL) throws CatalogException {
- System.out.println("Transfering '" + fromUrl + "' to '" + toURL + "'");
- FileInputStream is = null;
- try {
- byte[] buf = new byte[this.chunkSize];
- is = new FileInputStream(new File(fromUrl.getPath()));
- int offset = 0;
- int numBytes;
- while ((numBytes = is.read(buf, offset, chunkSize)) != -1) {
- this.transferFile(new File(toURL.getPath()).getAbsolutePath(), buf, offset, numBytes);
- }
- } catch (FileNotFoundException e) {
- throw new CatalogException("Transfer URL Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Transfer URL Failed: "+ e.getMessage(), e);
- } finally {
- try {
- is.close();
- }catch(Exception ignored) {}
- }
- }
-
- protected void transferFile(String filePath, byte[] fileData, int offset,
- int numBytes) throws CatalogException {
- Vector<Object> argList = new Vector<Object>();
- argList.add(filePath);
- argList.add(fileData);
- argList.add(offset);
- argList.add(numBytes);
- try {
- client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_transferFile", argList);
- } catch (XmlRpcException e) {
- throw new CatalogException("Transfer File Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Transfer File Failed: "+ e.getMessage(), e);
- }
- }
-
- public void delete(Metadata metadata) throws CatalogException {
- Vector<Object> args = new Vector<Object>();
- args.add(this.serializer.serializeObject(metadata));
- try {
- this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_delete", args);
- } catch (XmlRpcException e) {
- throw new CatalogException("Delete Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Delete Failed: "+ e.getMessage(), e);
- }
- }
-
- public List<TransactionalMetadata> getAllPages(QueryPager queryPager) throws CatalogException {
- Vector<Object> args = new Vector<Object>();
- args.add(this.serializer.serializeObject(queryPager));
- try {
- return this.serializer.deserializeObject(List.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getAllPages", args));
- } catch (XmlRpcException e) {
- throw new CatalogException("Get All Pages Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Get All Pages Failed: "+ e.getMessage(), e);
- }
- }
-
- public Properties getCalalogProperties() throws CatalogException {
- try {
- return this.serializer.deserializeObject(Properties.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getCalalogProperties", new Vector<Object>()));
- } catch (XmlRpcException e) {
- throw new CatalogException("Get Catalog Properties Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Get Catalog Properties Failed: "+ e.getMessage(), e);
- }
- }
-
- public Properties getCalalogProperties(String catalogUrn)
- throws CatalogException {
- Vector<Object> args = new Vector<Object>();
- args.add(catalogUrn);
- try {
- return this.serializer.deserializeObject(Properties.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getCalalogProperties", args));
- } catch (XmlRpcException e) {
- throw new CatalogException("Get Catalog Properties Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Get Catalog Properties Failed: "+ e.getMessage(), e);
- }
- }
-
- public TransactionId<?> getCatalogServiceTransactionId(
- TransactionId<?> catalogTransactionId, String catalogUrn)
- throws CatalogException {
- Vector<Object> args = new Vector<Object>();
- args.add(this.serializer.serializeObject(catalogTransactionId));
- args.add(catalogUrn);
- try {
- return this.serializer.deserializeObject(TransactionId.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getCatalogServiceTransactionId", args));
- } catch (XmlRpcException e) {
- throw new CatalogException("Get Catalog Service Transaction Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Get Catalog Service Transaction Failed: "+ e.getMessage(), e);
- }
- }
-
- public TransactionId<?> getCatalogServiceTransactionId(
- CatalogReceipt catalogReceipt,
- boolean generateNew) throws CatalogException {
- Vector<Object> args = new Vector<Object>();
- args.add(this.serializer.serializeObject(catalogReceipt));
- args.add(this.serializer.serializeObject(generateNew));
- try {
- return this.serializer.deserializeObject(TransactionId.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getCatalogServiceTransactionId2", args));
- } catch (XmlRpcException e) {
- throw new CatalogException("Get Catalog Services Transaction Id Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Get Catalog Services Transaction Id Failed: "+ e.getMessage(), e);
- }
- }
-
- public List<TransactionId<?>> getCatalogServiceTransactionIds(
- List<TransactionId<?>> catalogTransactionIds, String catalogUrn)
- throws CatalogException {
- Vector<Object> args = new Vector<Object>();
- args.add(this.serializer.serializeObject(catalogTransactionIds));
- args.add(catalogUrn);
- try {
- return this.serializer.deserializeObject(List.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getCatalogServiceTransactionId", args));
- } catch (XmlRpcException e) {
- throw new CatalogException("Get Catalog Service Transaction Ids Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Get Catalog Service Transaction Ids Failed: "+ e.getMessage(), e);
- }
- }
-
- public Set<String> getCurrentCatalogIds() throws CatalogException {
- try {
- return this.serializer.deserializeObject(Set.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getCurrentCatalogIds", new Vector<Object>()));
- } catch (XmlRpcException e) {
- throw new CatalogException("Get Curent Catalog Ids Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Get Current Catalog Ids Failed: "+ e.getMessage(), e);
- }
- }
-
- public List<TransactionalMetadata> getMetadataFromTransactionIdStrings(
- List<String> catalogServiceTransactionIdStrings)
- throws CatalogException {
- Vector<Object> args = new Vector<Object>();
- args.add(this.serializer.serializeObject(catalogServiceTransactionIdStrings));
- try {
- return this.serializer.deserializeObject(List.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getMetadataFromTransactionIdStrings", args));
- } catch (XmlRpcException e) {
- throw new CatalogException("Get Metadata From Transaction Id Strings Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Get Metadata From Transaction Id String Failed: "+ e.getMessage(), e);
- }
- }
-
- public List<TransactionalMetadata> getMetadataFromTransactionIds(
- List<TransactionId<?>> catalogServiceTransactionIds)
- throws CatalogException {
- Vector<Object> args = new Vector<Object>();
- args.add(this.serializer.serializeObject(catalogServiceTransactionIds));
- try {
- return this.serializer.deserializeObject(List.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getMetadataFromTransactionIds", args));
- } catch (XmlRpcException e) {
- throw new CatalogException("Get Metadata Transaction Ids Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Get Metadata Transaction Ids Failed: "+ e.getMessage(), e);
- }
- }
-
- public List<TransactionalMetadata> getNextPage(QueryPager queryPager)
- throws CatalogException {
- Vector<Object> args = new Vector<Object>();
- args.add(this.serializer.serializeObject(queryPager));
- try {
- return this.serializer.deserializeObject(List.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getNextPage", args));
- } catch (XmlRpcException e) {
- throw new CatalogException("Get Next Page Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Get Next Page Failed: "+ e.getMessage(), e);
- }
- }
-
- public List<String> getProperty(String key) throws CatalogException {
- Vector<Object> args = new Vector<Object>();
- args.add(key);
- try {
- return this.serializer.deserializeObject(List.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getProperty", args));
- } catch (XmlRpcException e) {
- throw new CatalogException("Get Property Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Get Property Failed: "+ e.getMessage(), e);
- }
- }
-
- public Class<? extends TransactionId<?>> getTransactionIdClass() throws CatalogException {
- try {
- return this.serializer.deserializeObject(Class.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getTransactionIdClass", new Vector<Object>()));
- } catch (XmlRpcException e) {
- throw new CatalogException("Get Transaction Id Class Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Get Transaction Id Calss Failed: "+ e.getMessage(), e);
- }
- }
-
- public List<TransactionId<?>> getTransactionIdsForAllPages(
- QueryPager queryPager) throws CatalogException {
- Vector<Object> args = new Vector<Object>();
- args.add(this.serializer.serializeObject(queryPager));
- try {
- return this.serializer.deserializeObject(List.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getTransactionIdsForAllPages", args));
- } catch (XmlRpcException e) {
- throw new CatalogException("Get Transaction Ids For All Pages Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Get Transaction Ids For All Pages Failed: "+ e.getMessage(), e);
- }
- }
-
- public TransactionReceipt ingest(Metadata metadata)
- throws CatalogException {
- Vector<Object> args = new Vector<Object>();
- args.add(this.serializer.serializeObject(metadata));
- try {
- return this.serializer.deserializeObject(TransactionReceipt.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_ingest", args));
- } catch (XmlRpcException e) {
- throw new CatalogException("Ingest Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Ingest Failed: "+ e.getMessage(), e);
- }
- }
-
- public boolean isRestrictIngestPermissions() throws CatalogException {
- try {
- return this.serializer.deserializeObject(Boolean.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_isRestrictIngestPermissions", new Vector<Object>()));
- } catch (XmlRpcException e) {
- throw new CatalogException("Is Restrict Ingest Permissions Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Is Restrict Ingest Permissions Failed: "+ e.getMessage(), e);
- }
- }
-
- public boolean isRestrictQueryPermissions() throws CatalogException {
- try {
- return this.serializer.deserializeObject(Boolean.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_isRestrictQueryPermissions", new Vector<Object>()));
- } catch (XmlRpcException e) {
- throw new CatalogException("Is Restrict Query Permissions Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Is Restrict Query Permissions Failed: "+ e.getMessage(), e);
- }
- }
-
- public Page getFirstPage(QueryExpression queryExpression) throws CatalogException {
- Vector<Object> args = new Vector<Object>();
- args.add(this.serializer.serializeObject(queryExpression));
- try {
- return this.serializer.deserializeObject(Page.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getFirstPage", args));
- } catch (XmlRpcException e) {
- throw new CatalogException("Get First Page Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Get First Page Failed: "+ e.getMessage(), e);
- }
- }
-
- public Page getFirstPage(QueryExpression queryExpression, Set<String> catalogIds) throws CatalogException {
- Vector<Object> args = new Vector<Object>();
- args.add(this.serializer.serializeObject(queryExpression));
- args.add(this.serializer.serializeObject(catalogIds));
- try {
- return this.serializer.deserializeObject(Page.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getFirstPage", args));
- } catch (XmlRpcException e) {
- throw new CatalogException("Get First Page Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Get First Page Failed: "+ e.getMessage(), e);
- }
- }
-
- public Page getNextPage(Page page) throws CatalogException {
- Vector<Object> args = new Vector<Object>();
- args.add(this.serializer.serializeObject(page));
- try {
- return this.serializer.deserializeObject(Page.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getNextPage2", args));
- } catch (XmlRpcException e) {
- throw new CatalogException("Get Next Page Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Get Next Page Failed: "+ e.getMessage(), e);
- }
- }
-
- public Page getPage(PageInfo pageInfo, QueryExpression queryExpression) throws CatalogException {
- Vector<Object> args = new Vector<Object>();
- args.add(this.serializer.serializeObject(pageInfo));
- args.add(this.serializer.serializeObject(queryExpression));
- try {
- return this.serializer.deserializeObject(Page.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getPage", args));
- } catch (XmlRpcException e) {
- throw new CatalogException("Get Page Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Get Page Failed: "+ e.getMessage(), e);
- }
- }
-
- public Page getPage(PageInfo pageInfo, QueryExpression queryExpression, Set<String> catalogIds) throws CatalogException {
- Vector<Object> args = new Vector<Object>();
- args.add(this.serializer.serializeObject(pageInfo));
- args.add(this.serializer.serializeObject(queryExpression));
- args.add(this.serializer.serializeObject(catalogIds));
- try {
- return this.serializer.deserializeObject(Page.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getPage", args));
- } catch (XmlRpcException e) {
- throw new CatalogException("Get Page Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Get Page Failed: "+ e.getMessage(), e);
- }
- }
-
- public Page getLastPage(QueryExpression queryExpression) throws CatalogException {
- Vector<Object> args = new Vector<Object>();
- args.add(this.serializer.serializeObject(queryExpression));
- try {
- return this.serializer.deserializeObject(Page.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getLastPage", args));
- } catch (XmlRpcException e) {
- throw new CatalogException("Get Last Page Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Get Last Page Failed: "+ e.getMessage(), e);
- }
- }
-
- public Page getLastPage(QueryExpression queryExpression, Set<String> catalogIds) throws CatalogException {
- Vector<Object> args = new Vector<Object>();
- args.add(this.serializer.serializeObject(queryExpression));
- args.add(this.serializer.serializeObject(catalogIds));
- try {
- return this.serializer.deserializeObject(Page.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getLastPage", args));
- } catch (XmlRpcException e) {
- throw new CatalogException("Get Last Page Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Get Last Page Failed: "+ e.getMessage(), e);
- }
- }
-
- public List<TransactionalMetadata> getMetadata(Page page) throws CatalogException {
- Vector<Object> args = new Vector<Object>();
- args.add(this.serializer.serializeObject(page));
- try {
- return this.serializer.deserializeObject(List.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_getMetadata", args));
- } catch (XmlRpcException e) {
- throw new CatalogException("Get Metadata Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Get Metadata Failed: "+ e.getMessage(), e);
- }
- }
-
- public QueryPager query(QueryExpression queryExpression)
- throws CatalogException {
- Vector<Object> args = new Vector<Object>();
- args.add(this.serializer.serializeObject(queryExpression));
- try {
- return this.serializer.deserializeObject(QueryPager.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_query", args));
- } catch (XmlRpcException e) {
- throw new CatalogException("Query Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Query Failed: "+ e.getMessage(), e);
- }
- }
-
- public QueryPager query(QueryExpression queryExpression, Set<String> catalogIds) throws CatalogException {
- Vector<Object> args = new Vector<Object>();
- args.add(this.serializer.serializeObject(queryExpression));
- args.add(this.serializer.serializeObject(catalogIds));
- try {
- return this.serializer.deserializeObject(QueryPager.class, (String) this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_query", args));
- } catch (XmlRpcException e) {
- throw new CatalogException("Query Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Query Failed: "+ e.getMessage(), e);
- }
- }
-
-
- public void removeCatalog(String catalogUrn) throws CatalogException {
- Vector<Object> args = new Vector<Object>();
- args.add(catalogUrn);
- try {
- this.client.execute(XmlRpcCommunicationChannelServer.class.getSimpleName() + ".xmlrpc_removeCatalog", args);
- } catch (XmlRpcException e) {
- throw new CatalogException("Remove Catalog Failed: "+ e.getMessage(), e);
- } catch (IOException e) {
- throw new CatalogException("Remove Catalog Failed: "+ e.getMessage(), e);
- }
- }
-
-
-
-}
[07/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/DataFileToPropFileLinker.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/DataFileToPropFileLinker.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/DataFileToPropFileLinker.java
deleted file mode 100644
index 5bd4be3..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/DataFileToPropFileLinker.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.retrievalsystem;
-
-//JDK imports
-import java.io.File;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.LinkedList;
-import java.util.Map.Entry;
-
-//OODT imports
-import org.apache.oodt.cas.protocol.ProtocolFile;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class DataFileToPropFileLinker implements DownloadListener {
-
- private ConcurrentHashMap<String, File> protocolFilePathAndPropFileMap;
-
- private ConcurrentHashMap<File, String> propFileToErrorsMap;
-
- private LinkedList<ProtocolFile> downloadingDataFiles;
-
- private LinkedList<ProtocolFile> failedDataFiles;
-
- private LinkedList<ProtocolFile> successDataFiles;
-
- public DataFileToPropFileLinker() {
- this.protocolFilePathAndPropFileMap = new ConcurrentHashMap<String, File>();
- this.propFileToErrorsMap = new ConcurrentHashMap<File, String>();
- downloadingDataFiles = new LinkedList<ProtocolFile>();
- failedDataFiles = new LinkedList<ProtocolFile>();
- successDataFiles = new LinkedList<ProtocolFile>();
- }
-
- public synchronized void addPropFileToDataFileLink(File propFile,
- ProtocolFile pFile) {
- this.addPropFileToDataFileLink(propFile, pFile.getPath());
- }
-
- public synchronized void addPropFileToDataFileLink(File propFile,
- String remoteDataFilePath) {
- this.protocolFilePathAndPropFileMap.put(remoteDataFilePath, propFile);
- }
-
- public synchronized void markAsFailed(File propFile, String errorMsg) {
- String errors = this.propFileToErrorsMap.get(propFile);
- if (errors == null) {
- this.propFileToErrorsMap.put(propFile, errorMsg);
- } else {
- this.propFileToErrorsMap.put(propFile, errors + "," + errorMsg);
- }
- }
-
- public synchronized void markAsFailed(ProtocolFile pFile, String errorMsg) {
- this.markAsFailed(pFile.getPath(), errorMsg);
- }
-
- public synchronized void markAsFailed(String pFilePath, String errorMsg) {
- File propFile = this.protocolFilePathAndPropFileMap.get(pFilePath);
- if (propFile != null) {
- String errors = this.propFileToErrorsMap.get(propFile);
- if (errors == null) {
- this.propFileToErrorsMap.put(propFile, errorMsg);
- } else {
- this.propFileToErrorsMap.put(propFile, errors + "," + errorMsg);
- }
- }
- }
-
- public synchronized String getErrorsAndEraseLinks(File propFile) {
- this.eraseLinks(propFile);
- return this.getErrors(propFile);
- }
-
- public synchronized void eraseLinks(File propFile) {
- LinkedList<String> keysToRemove = new LinkedList<String>();
- for (Entry<String, File> entry : this.protocolFilePathAndPropFileMap
- .entrySet()) {
- if (entry.getValue().equals(propFile)) {
- keysToRemove.add(entry.getKey());
- }
- }
- for (String key : keysToRemove) {
- this.protocolFilePathAndPropFileMap.remove(key);
- }
- }
-
- public synchronized String getErrors(File propFile) {
- return this.propFileToErrorsMap.remove(propFile);
- }
-
- public synchronized String getStatusOf(File propFile) {
- return "Status for " + propFile.getAbsolutePath() + ":" + " Errors: \n"
- + " " + this.propFileToErrorsMap.get(propFile) + "\n"
- + " Data files specified which are currently downloading:\n"
- + " " + this.getDownloadingFilesLinkedToPropFile(propFile)
- + "\n"
- + " Data files specified which successfully downloaded:\n"
- + " "
- + this.getSuccessfullyDownloadedFilesLinkedToPropFile(propFile)
- + "\n" + " Data files specified which failed to download:\n"
- + " "
- + this.getFailedToDownloadFilesLinkedToPropFile(propFile)
- + "\n";
- }
-
- public synchronized LinkedList<ProtocolFile> getDownloadingFilesLinkedToPropFile(
- File propFile) {
- return this.getFilesLinkedToPropFileInList(propFile,
- this.downloadingDataFiles);
- }
-
- public synchronized LinkedList<ProtocolFile> getSuccessfullyDownloadedFilesLinkedToPropFile(
- File propFile) {
- return this.getFilesLinkedToPropFileInList(propFile,
- this.successDataFiles);
- }
-
- public synchronized LinkedList<ProtocolFile> getFailedToDownloadFilesLinkedToPropFile(
- File propFile) {
- return this.getFilesLinkedToPropFileInList(propFile,
- this.failedDataFiles);
- }
-
- private LinkedList<ProtocolFile> getFilesLinkedToPropFileInList(
- File propFile, LinkedList<ProtocolFile> list) {
- LinkedList<ProtocolFile> returnList = new LinkedList<ProtocolFile>();
- for (ProtocolFile pFile : list) {
- if (this.protocolFilePathAndPropFileMap.get(pFile.getPath()) != null) {
- returnList.add(pFile);
- }
- }
- return returnList;
- }
-
- public synchronized void downloadFailed(ProtocolFile file, String errorMsg) {
- this.markAsFailed(file, "Failed to download '" + file
- + "' -- Logged Error msg: " + errorMsg);
- this.failedDataFiles.add(file);
- this.downloadingDataFiles.remove(file);
- }
-
- public synchronized void downloadFinished(ProtocolFile file) {
- this.successDataFiles.add(file);
- this.downloadingDataFiles.remove(file);
- }
-
- public synchronized void downloadStarted(ProtocolFile file) {
- this.downloadingDataFiles.add(file);
- }
-
- public synchronized void clear() {
- this.propFileToErrorsMap.clear();
- this.protocolFilePathAndPropFileMap.clear();
- this.downloadingDataFiles.clear();
- this.failedDataFiles.clear();
- this.successDataFiles.clear();
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/DownloadListener.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/DownloadListener.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/DownloadListener.java
deleted file mode 100644
index 3db621c..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/DownloadListener.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.retrievalsystem;
-
-//OODT imports
-import org.apache.oodt.cas.protocol.ProtocolFile;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public interface DownloadListener {
-
- void downloadStarted(ProtocolFile pFile);
-
- void downloadFinished(ProtocolFile pFile);
-
- void downloadFailed(ProtocolFile pFile, String errorMsg);
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/DownloadThreadEvaluator.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/DownloadThreadEvaluator.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/DownloadThreadEvaluator.java
deleted file mode 100644
index a43dcd1..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/DownloadThreadEvaluator.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.retrievalsystem;
-
-//OODT imports
-
-import org.apache.oodt.cas.pushpull.exceptions.ThreadEvaluatorException;
-
-import java.io.File;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.LinkedList;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-//JDK imports
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class DownloadThreadEvaluator {
- private static Logger LOG = Logger.getLogger(DownloadThreadEvaluator.class.getName());
- private ConcurrentHashMap<File, DownloadingFileInfo> fileAndDownloadingFileInfo;
-
- private final int MAX_THREADS;
-
- private int currentThreadCount;
-
- private double[] downloadSpeedsForEachThread;
-
- public DownloadThreadEvaluator(int maxThreads) {
- this.MAX_THREADS = maxThreads;
- downloadSpeedsForEachThread = new double[maxThreads + 1];
- fileAndDownloadingFileInfo = new ConcurrentHashMap<File, DownloadingFileInfo>();
- currentThreadCount = 0;
- }
-
- public synchronized void startTrackingDownloadRuntimeForFile(File file)
- throws ThreadEvaluatorException {
- long curTime = System.currentTimeMillis();
- if (++this.currentThreadCount > this.MAX_THREADS) {
- throw new ThreadEvaluatorException(
- "Number of threads exceeds max allows threads");
- }
- updateThreadCounts(curTime);
- fileAndDownloadingFileInfo.put(file, new DownloadingFileInfo(file,
- curTime, this.currentThreadCount));
- }
-
- private void updateThreadCounts(long curTime) {
- Set<Entry<File, DownloadingFileInfo>> entrySet = fileAndDownloadingFileInfo
- .entrySet();
- for (Entry<File, DownloadingFileInfo> entry : entrySet) {
- entry.getValue()
- .updateThreadCount(curTime, this.currentThreadCount);
- }
- }
-
- public synchronized void cancelRuntimeTracking(File file) {
- fileAndDownloadingFileInfo.remove(file);
- currentThreadCount--;
- updateThreadCounts(System.currentTimeMillis());
- }
-
- public synchronized void fileDownloadComplete(File file)
- throws ThreadEvaluatorException {
- try {
- long finishTime = System.currentTimeMillis();
- DownloadingFileInfo dfi = fileAndDownloadingFileInfo.remove(file);
- updateThreadCounts(finishTime);
- LinkedList<TimeAndThreadCount> tatcList = dfi
- .getTimeAndThreadInfo();
- long runtime = finishTime - dfi.getStartTimeInMillis();
- double total = 0;
- long nextTime;
- for (int i = 0; i < tatcList.size(); i++) {
- TimeAndThreadCount tatc = tatcList.get(i);
- if (i + 1 >= tatcList.size()) {
- nextTime = finishTime;
- } else {
- nextTime = tatcList.get(i + 1).getStartTimeInMillis();
- }
- long threadCountTime = nextTime - tatc.getStartTimeInMillis();
- total += ((double) (tatc.getThreadCount() * threadCountTime))
- / (double) runtime;
- }
- int avgThreadCountForFile = (int) Math.rint(total);
- System.out.println("Recorded avg: " + avgThreadCountForFile);
-
- double downloadSpeed = (file.length() * avgThreadCountForFile)
- / calculateRuntime(dfi.getStartTimeInMillis());
- double currentAvgSpeed = this.downloadSpeedsForEachThread[avgThreadCountForFile];
- if (currentAvgSpeed == 0) {
- this.downloadSpeedsForEachThread[avgThreadCountForFile] = downloadSpeed;
- } else {
- this.downloadSpeedsForEachThread[avgThreadCountForFile] = (currentAvgSpeed + downloadSpeed) / 2;
- }
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- throw new ThreadEvaluatorException("Failed to register file "
- + file + " as downloaded : " + e.getMessage());
- } finally {
- currentThreadCount--;
- }
- }
-
- long calculateRuntime(final long startTime) {
- return System.currentTimeMillis() - startTime;
- }
-
- public synchronized int getRecommendedThreadCount() {
-
- int curRecThreadCount = 1;
- double curMaxSpeed = this.downloadSpeedsForEachThread[curRecThreadCount];
- for (int i = 1; i < this.downloadSpeedsForEachThread.length; i++) {
- double curSpeed = this.downloadSpeedsForEachThread[i];
- if (curSpeed > curMaxSpeed) {
- curMaxSpeed = curSpeed;
- curRecThreadCount = i;
- }
- }
-
- if (curRecThreadCount != this.MAX_THREADS
- && this.downloadSpeedsForEachThread[curRecThreadCount + 1] == 0) {
- curRecThreadCount++;
- } else if (this.downloadSpeedsForEachThread[curRecThreadCount - 1] == 0) {
- curRecThreadCount--;
- }
-
- System.out.print("[ ");
- for (double time : downloadSpeedsForEachThread) {
- System.out.print(time + " ");
- }
- System.out.println("]");
-
- System.out.println("Recommended Threads: " + curRecThreadCount);
-
- return curRecThreadCount;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/DownloadingFileInfo.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/DownloadingFileInfo.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/DownloadingFileInfo.java
deleted file mode 100644
index 555dbef..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/DownloadingFileInfo.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.retrievalsystem;
-
-//JDK imports
-import java.io.File;
-import java.util.LinkedList;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class DownloadingFileInfo {
-
- private File downloadingFile;
-
- private long startTimeInMillis;
-
- private LinkedList<TimeAndThreadCount> timeAndThreadCountList;
-
- public DownloadingFileInfo(File downloadingFile, long startTimeInMillis,
- int currentThreadCount) {
- timeAndThreadCountList = new LinkedList<TimeAndThreadCount>();
- this.downloadingFile = downloadingFile;
- this.startTimeInMillis = startTimeInMillis;
- this.timeAndThreadCountList.add(new TimeAndThreadCount(
- startTimeInMillis, currentThreadCount));
- }
-
- public void updateThreadCount(long timeInMillis, int threadCount) {
- this.timeAndThreadCountList.add(new TimeAndThreadCount(timeInMillis,
- threadCount));
- }
-
- public File getDownloadingFile() {
- return this.downloadingFile;
- }
-
- public long getStartTimeInMillis() {
- return this.startTimeInMillis;
- }
-
- public LinkedList<TimeAndThreadCount> getTimeAndThreadInfo() {
- return this.timeAndThreadCountList;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/FileRetrievalSystem.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/FileRetrievalSystem.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/FileRetrievalSystem.java
deleted file mode 100644
index 6088b49..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/FileRetrievalSystem.java
+++ /dev/null
@@ -1,966 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.retrievalsystem;
-
-import org.apache.oodt.cas.pushpull.config.Config;
-import org.apache.oodt.cas.pushpull.config.SiteInfo;
-import org.apache.oodt.cas.pushpull.exceptions.AlreadyInDatabaseException;
-import org.apache.oodt.cas.pushpull.exceptions.CrawlerException;
-import org.apache.oodt.cas.pushpull.exceptions.RemoteConnectionException;
-import org.apache.oodt.cas.pushpull.exceptions.ThreadEvaluatorException;
-import org.apache.oodt.cas.pushpull.exceptions.ToManyFailedDownloadsException;
-import org.apache.oodt.cas.pushpull.exceptions.UndefinedTypeException;
-import org.apache.oodt.cas.pushpull.filerestrictions.renamingconventions.RenamingConvention;
-import org.apache.oodt.cas.protocol.exceptions.ProtocolException;
-import org.apache.oodt.cas.protocol.util.ProtocolFileFilter;
-import org.apache.oodt.cas.protocol.Protocol;
-import org.apache.oodt.cas.protocol.ProtocolFile;
-import org.apache.oodt.cas.pushpull.protocol.ProtocolHandler;
-import org.apache.oodt.cas.pushpull.protocol.RemoteSite;
-import org.apache.oodt.cas.pushpull.protocol.RemoteSiteFile;
-import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException;
-import org.apache.oodt.cas.metadata.Metadata;
-import org.apache.oodt.cas.metadata.util.MimeTypeUtils;
-
-
-//JDK imports
-import java.io.File;
-import java.io.FileFilter;
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Vector;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import com.google.common.base.Preconditions;
-import com.google.common.base.Strings;
-
-/**
- * <pre>
- * Will crawl external directory structures and will download the files within these structures.
- *
- * This class's settings are set using a java .properties file which can be read in and parsed by Config.java.
- * This .properties file should have the following properties set:
- *
- * {@literal #list of sites to crawl
- * protocol.external.sources=<path-to-xml-file>
- *
- * #protocol types
- * protocolfactory.types=<list-of-protocols-separated-by-commas> (e.g. ftp,http,https,sftp)
- *
- * #Protocol factories per types (must have one for each protocol mention in protocolfactory.types -- the property must be name
- * # as such: protocolfactory.<name-of-protocol-type>
- * protocolfactory.ftp=<path-to-java-protocolfactory-class> (e.g. org.apache.oodt.cas.protocol.ftp.FtpClientFactory)
- * protocolfactory.http=<path-to-java-protocolfactory-class>
- * protocolfactory.https=<path-to-java-protocolfactory-class>
- * protocolfactory.sftp=<path-to-java-protocolfactory-class>
- *
- * #configuration to make java.net.URL accept unsupported protocols -- must exist just as shown
- * java.protocol.handler.pkgs=org.apache.oodt.cas.url.handlers
- * }
- *
- * In order to specify which external sites to crawl you must create a XML file which contains the
- * the site and necessary information needed to crawl the site, such as username and password.
- * protocol.external.sources must contain the path to this file so the crawl knows where to find it.
- * You can also train this class on how to crawl each given site. This is also specified in an XML
- * file, whose path must be given in the first mentioned XML file which contians the username and password.
- *
- * Then schema for the external sites XML file is as such:
- *
- * {@literal <sources>
- * <source url="url-of-server">
- * <username>username</username>
- * <password>password</password>
- * <dirstruct>path-to-xml-file</dirstruct>
- * <crawl>yes-or-no</crawl>
- * </source>
- * ...
- * ...
- * ...
- * </sources\>}
- *
- * You may specify as many sources as you would like by specifying multiple {@literal <source>} tags.
- * In the {@literal <source>} tag, the parameter 'url' must be specified. This is the url of the server
- * you want the crawler to connect to. It should be of the following format:
- * {@literal <protocol>://<host>} (e.g. sftp://remote.computer.gov)
- * If no username and password exist, then these elements can be omitted (they are optional).
- * For {@literal <crawl>} place yes or no here. This is for convenience of being able to keep record of the
- * sites and their information in this XML file even if you decide that you no longer need to crawl it
- * anymore (just put {@literal <crawl>no</crawl>} and the crawl will not crawl that site).
- * {@literal <dirStruct>} contains a path to another XML file which is documented in DirStruct.java javadoc. This
- * element is optional. If no {@literal <dirStruct>} is given, then every directory will be crawled on the site
- * and every encountered file will be downloaded.
- * </pre>
- *
- * @author bfoster (Brian Foster)
- */
-public class FileRetrievalSystem {
-
- /* our log stream */
- private static final Logger LOG = Logger
- .getLogger(FileRetrievalSystem.class.getName());
-
- private final static int MAX_RETRIES = 3;
- public static final int INT = 180;
- public static final int TIMEOUT = 5000;
- public static final int TIMEOUT1 = 5000;
- public static final int TIMEOUT2 = 600;
-
- private LinkedList<ProtocolFile> failedDownloadList;
-
- private HashSet<ProtocolFile> currentlyDownloading;
-
- private int max_allowed_failed_downloads;
-
- /**
- * The max number of threads able to run at the same time
- */
- private int max_sessions;
-
- private final int absMaxAllowedSessions = 50;
-
- /**
- * This is just for clarity purposes. . .I only create the amount of threads
- * that I will allow to be used at any given moment
- */
- private final static int EXTRA_LAZY_SESSIONS_TIMEOUT = 10;
-
- /**
- * A list of created protocol sessions (devoted to grabbing files from the
- * crawling directory structure) that are not presently in use.
- */
- private Vector<Protocol> avaliableSessions;
-
- /**
- * The number of sessions that have been created (should always be less than
- * or equal to MAX_SESSIONS).
- */
- private int numberOfSessions;
-
- /**
- * The thread pool that is in charge of the sessions.
- */
- private ThreadPoolExecutor threadController;
-
- /**
- * Manages the Protocols and always ensures that the Crawler is using the
- * appropriate protocol for any given server.
- */
- private ProtocolHandler protocolHandler;
-
- /**
- * max_sessions tracker
- */
- private DownloadThreadEvaluator dtEval;
-
- private DownloadListener dListener;
-
- private Config config;
-
- private SiteInfo siteInfo;
-
- private HashSet<File> stagingAreas;
-
- private MimeTypeUtils mimeTypeDetection;
-
- /**
- * Creates a Crawler based on the URL, DirStruct, and Config objects passed
- * in. If no DirStruct is needed then set it to null.
- *
- * @param config
- * The Configuration file that is passed to this objects
- * ProtocolHandler.
- * @throws InstantiationException
- * @throws DatabaseException
- */
- public FileRetrievalSystem(Config config, SiteInfo siteInfo)
- throws InstantiationException {
- try {
- protocolHandler = new ProtocolHandler(config.getProtocolInfo());
- this.config = config;
- this.siteInfo = siteInfo;
- mimeTypeDetection = new MimeTypeUtils(config
- .getProductTypeDetectionFile());
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- throw new InstantiationException(
- "Failed to create FileRetrievalSystem : " + e.getMessage());
- }
- }
-
- public void registerDownloadListener(DownloadListener dListener) {
- this.dListener = dListener;
- }
-
- public void initialize() throws IOException {
- try {
- resetVariables();
- } catch (Exception e) {
- throw new IOException("Failed to initialize FileRetrievalSystem : "
- + e.getMessage());
- }
- }
-
- /**
- * Initializes variables that must be reset when more than one crawl is done
- *
- * @throws ThreadEvaluatorException
- */
- void resetVariables() {
- numberOfSessions = 0;
- stagingAreas = new HashSet<File>();
- avaliableSessions = new Vector<Protocol>();
- currentlyDownloading = new HashSet<ProtocolFile>();
- failedDownloadList = new LinkedList<ProtocolFile>();
- max_allowed_failed_downloads = config.getMaxFailedDownloads();
- max_sessions = config.getRecommendedThreadCount();
- threadController = new ThreadPoolExecutor(this.max_sessions,
- this.max_sessions, EXTRA_LAZY_SESSIONS_TIMEOUT,
- TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
- if (config.useTracker()) {
- dtEval = new DownloadThreadEvaluator(this.absMaxAllowedSessions);
- }
- }
-
- /**
- * reset error flag
- */
- public void clearErrorFlag() {
- max_allowed_failed_downloads += config.getMaxFailedDownloads();
- }
-
- public boolean isAlreadyInDatabase(RemoteFile rf) throws CatalogException {
- return config.getIngester() != null && config.getIngester().hasProduct(
- config.getFmUrl(), rf.getMetadata(RemoteFile.PRODUCT_NAME));
- }
-
- public List<RemoteSiteFile> getNextPage(final RemoteSiteFile dir,
- final ProtocolFileFilter filter) throws RemoteConnectionException {
- for (int i = 0; i < 3; i++) {
- try {
- return protocolHandler.nextPage(dir.getSite(), protocolHandler
- .getAppropriateProtocol(dir, true, true),
- new ProtocolFileFilter() {
- @Override
- public boolean accept(ProtocolFile file) {
- return filter.accept(file)
- && !FileRetrievalSystem.this
- .isDownloading(file);
- }
- });
- } catch (Exception e) {
- LOG.log(Level.WARNING, "Retrying to get next page for " + dir
- + " because operation failed : " + e.getMessage(), e);
- }
- }
- throw new RemoteConnectionException("Failed to get next page for "
- + dir);
- }
-
- public void changeToRoot(RemoteSite remoteSite) throws
- org.apache.oodt.cas.protocol.exceptions.ProtocolException {
- if (validate(remoteSite)) {
- protocolHandler.cdToROOT(protocolHandler
- .getAppropriateProtocolBySite(remoteSite, true));
- } else {
- throw new ProtocolException("Not a valid remote site " + remoteSite);
- }
- }
-
- public void changeToHOME(RemoteSite remoteSite) throws ProtocolException {
- if (validate(remoteSite)) {
- protocolHandler.cdToHOME(protocolHandler
- .getAppropriateProtocolBySite(remoteSite, true));
- } else {
- throw new ProtocolException("Not a valid remote site " + remoteSite);
- }
- }
-
- public void changeToDir(String dir, RemoteSite remoteSite)
- throws ProtocolException {
- if (validate(remoteSite)) {
- this
- .changeToDir(protocolHandler.getProtocolFileFor(remoteSite,
- protocolHandler.getAppropriateProtocolBySite(
- remoteSite, true), dir, true));
- } else {
- throw new ProtocolException("Not a valid remote site " + remoteSite);
- }
- }
-
- public void changeToDir(RemoteSiteFile pFile) throws ProtocolException {
- RemoteSite remoteSite = pFile.getSite();
- if (validate(remoteSite)) {
- protocolHandler.cd(protocolHandler.getAppropriateProtocolBySite(
- remoteSite, true), pFile);
- } else {
- throw new ProtocolException("Not a valid remote site " + remoteSite);
- }
- }
-
- public ProtocolFile getHomeDir(RemoteSite remoteSite)
- throws ProtocolException {
- if (validate(remoteSite)) {
- return protocolHandler.getHomeDir(remoteSite, protocolHandler
- .getAppropriateProtocolBySite(remoteSite, true));
- } else {
- throw new ProtocolException("Not a valid remote site " + remoteSite);
- }
- }
-
- public ProtocolFile getProtocolFile(RemoteSite remoteSite, String file,
- boolean isDir) throws ProtocolException {
- if (validate(remoteSite)) {
- return protocolHandler.getProtocolFileFor(remoteSite, protocolHandler
- .getAppropriateProtocolBySite(remoteSite, true), file,
- isDir);
- } else {
- throw new ProtocolException("Not a valid remote site " + remoteSite);
- }
- }
-
- public ProtocolFile getCurrentFile(RemoteSite remoteSite)
- throws ProtocolException {
- if (validate(remoteSite)) {
- return protocolHandler.pwd(remoteSite, protocolHandler
- .getAppropriateProtocolBySite(remoteSite, true));
- } else {
- throw new ProtocolException("Not a valid remote site " + remoteSite);
- }
- }
-
- // returns true if download was added to queue. . .false otherwise
- public boolean addToDownloadQueue(RemoteSite remoteSite, String file,
- String renamingString, File downloadToDir,
- String uniqueMetadataElement, boolean deleteAfterDownload, Metadata fileMetadata)
- throws ToManyFailedDownloadsException, RemoteConnectionException,
- ProtocolException,
- AlreadyInDatabaseException, UndefinedTypeException,
- CatalogException, IOException {
- if (validate(remoteSite)) {
- if (!file.startsWith("/")) {
- file = "/" + file;
- }
- return addToDownloadQueue(protocolHandler.getProtocolFileFor(remoteSite,
- protocolHandler.getAppropriateProtocolBySite(remoteSite,
- true), file, false), renamingString, downloadToDir,
- uniqueMetadataElement, deleteAfterDownload, fileMetadata);
- } else {
- throw new ProtocolException("Not a valid remote site " + remoteSite);
- }
- }
-
- public boolean validate(RemoteSite remoteSite) {
- Preconditions.checkNotNull(remoteSite);
- LinkedList<RemoteSite> remoteSites = this.siteInfo
- .getPossibleRemoteSites(remoteSite.getAlias(), remoteSite
- .getURL(), remoteSite.getUsername(), remoteSite
- .getPassword());
- if (remoteSites.size() == 1) {
- RemoteSite rs = remoteSites.get(0);
- remoteSite.copy(rs);
- return true;
- }
- return false;
- }
-
- public void waitUntilAllCurrentDownloadsAreComplete()
- throws ProtocolException {
- synchronized (this) {
- for (int i = 0; i < INT; i++) {
- try {
- if (this.avaliableSessions.size() == this.numberOfSessions) {
- return;
- } else {
- this.wait(TIMEOUT);
- }
- } catch (Exception ignored) {
- }
- }
- throw new ProtocolException(
- "Downloads appear to be hanging . . . aborting wait . . . waited for 15 minutes");
- }
- }
-
- public boolean addToDownloadQueue(RemoteSiteFile file,
- String renamingString,
- File downloadToDir,
- String uniqueMetadataElement,
- boolean deleteAfterDownload,
- Metadata fileMetadata) throws ToManyFailedDownloadsException,
- RemoteConnectionException,
- AlreadyInDatabaseException,
- UndefinedTypeException,
- CatalogException,
- IOException {
- if (this.failedDownloadList.size() > max_allowed_failed_downloads) {
- throw new ToManyFailedDownloadsException(
- "Number of failed downloads exceeds "
- + max_allowed_failed_downloads
- + " . . . blocking all downloads from being added to queue . . . "
- + "reset error flag in order to force allow downloads into queue");
- }
- if (this.isDownloading(file)) {
- LOG.log(Level.WARNING, "Skipping file '" + file
- + "' because it is already on the download queue");
- return false;
- }
-
- RemoteFile remoteFile = new RemoteFile(file);
- remoteFile.addMetadata(fileMetadata);
- remoteFile.addMetadata(RemoteFile.RENAMING_STRING, renamingString);
- remoteFile.addMetadata(RemoteFile.DELETE_AFTER_DOWNLOAD,
- deleteAfterDownload + "");
-
- if (config.onlyDownloadDefinedTypes()) {
- String mimeType = this.mimeTypeDetection.getMimeType(file.getName());
- if (mimeType != null
- && !mimeType.equals("application/octet-stream")) {
- remoteFile.addMetadata(RemoteFile.MIME_TYPE, mimeType);
- remoteFile.addMetadata(RemoteFile.SUPER_TYPE, this.mimeTypeDetection
- .getSuperTypeForMimeType(mimeType));
- String description = this.mimeTypeDetection
- .getDescriptionForMimeType(mimeType);
- if (!Strings.isNullOrEmpty(description)) {
- if(description.contains("&")){
- for (String field : description.split("\\&\\&")) {
- String[] keyval = field.split("\\=");
- remoteFile.addMetadata(keyval[0].trim(), keyval[1].trim());
- }
- } else{
- // it's the ProductType
- remoteFile.addMetadata(RemoteFile.PRODUCT_TYPE, description);
- }
- if (remoteFile.getMetadata(RemoteFile.UNIQUE_ELEMENT) != null) {
- uniqueMetadataElement = remoteFile.getMetadata(RemoteFile.UNIQUE_ELEMENT);
- }
- }
- } else {
- throw new UndefinedTypeException("File '" + file
- + "' is not a defined type");
- }
- }
-
- downloadToDir = new File(downloadToDir.isAbsolute() ? downloadToDir
- .getAbsolutePath() : this.config.getBaseStagingArea() + "/"
- + downloadToDir.getPath());
- if (!this.isStagingAreaInitialized(downloadToDir)) {
- this.initializeStagingArea(downloadToDir);
- }
-
- remoteFile.addMetadata(RemoteFile.DOWNLOAD_TO_DIR, downloadToDir.getAbsolutePath());
-
- if (remoteFile.getMetadata(RemoteFile.PRODUCT_NAME_GENERATOR) != null) {
- remoteFile.addMetadata(RemoteFile.PRODUCT_NAME, RenamingConvention.rename(remoteFile, remoteFile.getMetadata(RemoteFile.PRODUCT_NAME_GENERATOR)));
- }else {
- remoteFile.setUniqueMetadataElement(uniqueMetadataElement == null ? RemoteFile.FILENAME : uniqueMetadataElement);
- }
-
- if (!isAlreadyInDatabase(remoteFile)) {
-
- // get download location
- File newFile = getSaveToLoc(remoteFile);
-
- // add session to thread pool
- if (!this.isInStagingArea(newFile)) {
- for (int retries = 0;; retries++) {
- try {
- addSessionToThreadPool(
- getNextAvaliableSession(remoteFile
- .getProtocolFile()), remoteFile,
- newFile);
- return true;
- } catch (Exception e) {
- if (retries < MAX_RETRIES) {
- LOG.log(Level.WARNING, "Failed to get session for "
- + file + " . . . retrying in 5 secs");
- synchronized (this) {
- try {
- wait(TIMEOUT1);
- } catch (Exception ignored) {
- }
- }
- } else {
- this.failedDownloadList.add(file);
- throw new RemoteConnectionException(
- "Failed to get session to download " + file
- + " : " + e.getMessage(), e);
- }
- }
- }
- } else {
- if (deleteAfterDownload) {
- try {
- protocolHandler
- .delete(protocolHandler.getAppropriateProtocol(
- file, true, true), file);
- } catch (Exception e) {
- LOG.log(Level.SEVERE,
- "Failed to delete file from server : "
- + e.getMessage());
- }
- }
- LOG.log(Level.WARNING, "Skipping file " + file
- + " because it is already in staging area");
- return false;
- }
- } else {
- throw new AlreadyInDatabaseException("File " + file
- + " is already the database");
- }
- }
-
- private boolean isStagingAreaInitialized(File stagingArea) {
- return this.stagingAreas.contains(stagingArea);
- }
-
- private boolean isInStagingArea(final File findFile) {
- return (findFile.exists() || new File(findFile.getParentFile(),
- "Downloading_" + findFile.getName()).exists());
- }
-
- private void initializeStagingArea(File stagingArea) throws IOException {
- LOG.log(Level.INFO, "Preparing staging area " + stagingArea);
- if (stagingArea.exists()) {
- File[] failedDownloads = stagingArea.listFiles(new FileFilter() {
- @Override
- public boolean accept(File pathname) {
- return pathname.getName().startsWith("Downloading_");
- }
- });
- if(failedDownloads!=null) {
- for (File file : failedDownloads) {
- LOG.log(Level.INFO, "Removing failed download file "
- + file.getAbsolutePath());
- file.delete();
- }
- }
- } else {
- LOG.log(Level.INFO, "Staging area " + stagingArea.getAbsolutePath()
- + " does not exist! -- trying to create it ");
- if (!stagingArea.mkdirs()) {
- throw new IOException("Failed to create staging area at "
- + stagingArea.getAbsolutePath());
- }
- }
- this.stagingAreas.add(stagingArea);
- }
-
- File getSaveToLoc(RemoteFile remoteFile) {
- String renamingString = remoteFile
- .getMetadata(RemoteFile.RENAMING_STRING);
- if (renamingString == null || renamingString.equals("")) {
- return new File(remoteFile.getMetadata(RemoteFile.DOWNLOAD_TO_DIR)
- + "/" + remoteFile.getMetadata(RemoteFile.FILENAME));
- } else {
- File newFile = new File(remoteFile
- .getMetadata(RemoteFile.DOWNLOAD_TO_DIR)
- + "/"
- + RenamingConvention.rename(remoteFile, renamingString));
- if (!newFile.getParentFile().equals(
- remoteFile.getMetadata(RemoteFile.DOWNLOAD_TO_DIR))) {
- newFile.getParentFile().mkdirs();
- }
- return newFile;
- }
- }
-
- Protocol getNextAvaliableSession(RemoteSiteFile file) throws CrawlerException {
- // wait for available session, then load it
- Protocol session;
- while ((session = getSession(file)) == null) {
- try {
- waitMainThread();
- } catch (InterruptedException ignored) {
- }
- }
- return session;
- }
-
- /**
- * Sleeps the crawling thread
- *
- * @throws InterruptedException
- */
- synchronized void waitMainThread() throws InterruptedException {
- wait();
- }
-
- /**
- * Wakes up the crawling thread
- */
- synchronized void wakeUpMainThread() {
- notify();
- }
-
- /**
- * Increments the number of downloading session
- */
- synchronized void incrementSessions() {
- numberOfSessions++;
- }
-
- synchronized void decrementSessions() {
- this.numberOfSessions--;
- }
-
- /**
- * Gets an available downloading session Protocol. Returns null if none are
- * available
- *
- * @return The found downloading session Protocol
- * @throws RemoteCommunicationException
- * If downloading session Protocol has to be reconnected and
- * there is an error communicating with the server
- */
- synchronized Protocol getSession(RemoteSiteFile file) throws CrawlerException {
- try {
- Protocol session = null;
- if (file.getSite().getMaxConnections() < 0
- || file.getSite().getMaxConnections() > this.getCurrentlyDownloadingFiles().size()) {
- if (avaliableSessions.size() > 0) {
- session = modifyAvailableSessionForPath(file);
- } else if (numberOfSessions < max_sessions) {
- session = createNewSessionForPath(file);
- incrementSessions();
- }
- }
- return session;
- } catch (Exception e) {
- throw new CrawlerException("Failed to get new session : "
- + e.getMessage(), e);
- }
- }
-
- Protocol createNewSessionForPath(RemoteSiteFile file)
- throws RemoteConnectionException {
- return protocolHandler.getAppropriateProtocol(file, /* reuse */false, /* navigate */
- true);
- }
-
- Protocol modifyAvailableSessionForPath(RemoteSiteFile file)
- throws RemoteConnectionException {
- Protocol session = getAvailableSession();
- if (!file.getSite().getURL().getHost().equals(
- file.getSite().getURL().getHost())
- || !protocolHandler.isProtocolConnected(session)) {
- protocolHandler.disconnect(session);
- session = protocolHandler.getAppropriateProtocol(file, /* reuse */
- false, /* navigate */true);
- } else {
- try {
- if (file.isDir()) {
- protocolHandler.cd(session, file);
- } else {
- protocolHandler.cd(session,
- new RemoteSiteFile(file.getParent(), file.getSite()));
- }
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- try {
- protocolHandler.disconnect(session);
- } catch (Exception ignored) {
- }
- session = protocolHandler.getAppropriateProtocol(file, /* reuse */
- false, /* navigate */true);
- }
- }
- return session;
- }
-
- /**
- * Puts a session in the available session list
- *
- * @param session
- * The Protocol session to be added to the available list
- */
- synchronized void addAvailableSession(Protocol session) {
- avaliableSessions.add(session);
- }
-
- /**
- * Removes a session from the available list and returns it
- *
- * @return An available downloading Protocol session
- */
- synchronized Protocol getAvailableSession() {
- return avaliableSessions.remove(0);
- }
-
- synchronized int getNumberOfUsedSessions() {
- return numberOfSessions - avaliableSessions.size();
- }
-
- /**
- * Registers a downloading session with the threadpoolexecutor to begin
- * downloading the specified ProtocolFile to the local File location
- *
- * @param session
- * The downloading Protocol session to be used to download the
- * ProtocolFile
- * @param newFile
- * The location which the downloaded file will be stored
- */
- void addSessionToThreadPool(final Protocol session,
- final RemoteFile remoteFile, final File newFile) {
- this.addToDownloadingList(remoteFile.getProtocolFile());
- threadController.execute(new Runnable() {
- @Override
- public void run() {
- boolean successful = false;
- int retries = 0;
- Protocol curSession = session;
-
- if (FileRetrievalSystem.this.dListener != null) {
- FileRetrievalSystem.this.dListener
- .downloadStarted(remoteFile.getProtocolFile());
- }
-
- // try until successful or all retries have been used
- do {
- try {
- // if thread tracker is to be used
- if (config.useTracker()) {
- dtEval.startTrackingDownloadRuntimeForFile(newFile);
- protocolHandler.download(curSession, remoteFile
- .getProtocolFile(), newFile, remoteFile
- .getMetadata(
- RemoteFile.DELETE_AFTER_DOWNLOAD)
- .equals("true"));
- dtEval.fileDownloadComplete(newFile);
- threadController
- .setCorePoolSize(max_sessions = dtEval
- .getRecommendedThreadCount());
- threadController.setMaximumPoolSize(max_sessions);
- // if static number of threads are to be used
- } else {
- protocolHandler.download(curSession, remoteFile
- .getProtocolFile(), newFile, remoteFile
- .getMetadata(
- RemoteFile.DELETE_AFTER_DOWNLOAD)
- .equals("true"));
- }
-
- successful = true;
- if (FileRetrievalSystem.this.dListener != null) {
- FileRetrievalSystem.this.dListener
- .downloadFinished(remoteFile
- .getProtocolFile());
- }
-
- remoteFile.addMetadata(RemoteFile.FILE_SIZE, newFile
- .length()
- + "");
-
- // try to create the metadata file
- if (config.getWriteMetFile()) {
- try {
- LOG.log(Level.INFO, "Writing metadata file for '" + newFile + "'");
- remoteFile.addMetadata(RemoteFile.FILE_SIZE,
- newFile.length() + "");
- remoteFile.writeToPropEqValFile(newFile
- .getAbsolutePath()
- + "." + config.getMetFileExtension(),
- config.getListOfMetadataToOutput());
- } catch (Exception e) {
- LOG.log(Level.SEVERE,
- "Failed to create metadata file for "
- + remoteFile.getProtocolFile());
- }
- }
-
- } catch (Exception e) {
-
- // if tracker is being used cancel tracking
- if (config.useTracker()) {
- dtEval.cancelRuntimeTracking(newFile);
- }
-
- // delete any created file from staging area
- newFile.delete();
- new File(newFile.getAbsolutePath() + "."
- + config.getMetFileExtension()).delete();
-
- // check if a retry is still allowed
- if (++retries > MAX_RETRIES) {
- FileRetrievalSystem.this.failedDownloadList
- .add(remoteFile.getProtocolFile());
- LOG.log(Level.SEVERE, "Failed to download "
- + remoteFile.getProtocolFile() + " : "
- + e.getMessage());
- if (FileRetrievalSystem.this.dListener != null) {
- FileRetrievalSystem.this.dListener
- .downloadFailed(remoteFile
- .getProtocolFile(), e
- .getMessage());
- }
- break;
- } else if (FileRetrievalSystem.this.failedDownloadList
- .size() < max_allowed_failed_downloads) {
- // discard current session and recreate a new
- // session to try to download file with
- LOG.log(Level.WARNING, "Retrying to download file "
- + remoteFile.getProtocolFile()
- + " because download failed : "
- + e.getMessage(), e);
- try {
- protocolHandler.disconnect(curSession);
- } catch (Exception ignored) {
- }
- try {
- curSession = protocolHandler
- .getAppropriateProtocol(remoteFile
- .getProtocolFile(), false, true);
- } catch (Exception exc) {
- LOG.log(Level.SEVERE,
- "Failed to reconnect protocol to retry download of file "
- + remoteFile.getProtocolFile()
- + " -- aborting retry : "
- + e.getMessage(), e);
- }
- } else {
- LOG
- .log(
- Level.SEVERE,
- "Terminating download tries for file "
- + remoteFile
- .getProtocolFile()
- + " do to too many previous download failures : "
- + e.getMessage(), e);
- if (FileRetrievalSystem.this.dListener != null) {
- FileRetrievalSystem.this.dListener
- .downloadFailed(remoteFile
- .getProtocolFile(), e
- .getMessage());
- }
- break;
- }
-
- }
- } while (!successful);
-
- FileRetrievalSystem.this.removeFromDownloadingList(remoteFile
- .getProtocolFile());
- determineSessionFate(curSession);
- }
- });
- }
-
- private synchronized void addToDownloadingList(ProtocolFile pFile) {
- this.currentlyDownloading.add(pFile);
- }
-
- private synchronized void removeFromDownloadingList(ProtocolFile pFile) {
- this.currentlyDownloading.remove(pFile);
- }
-
- public synchronized boolean isDownloading(ProtocolFile pFile) {
- return this.currentlyDownloading.contains(pFile);
- }
-
- public synchronized LinkedList<ProtocolFile> getCurrentlyDownloadingFiles() {
- LinkedList<ProtocolFile> list = new LinkedList<ProtocolFile>();
- list.addAll(this.currentlyDownloading);
- return list;
- }
-
- public LinkedList<ProtocolFile> getListOfFailedDownloads() {
- return this.failedDownloadList;
- }
-
- public void clearFailedDownloadsList() {
- this.failedDownloadList.clear();
- }
-
- synchronized void determineSessionFate(Protocol session) {
- // determine whether thread should be keep or should be thrown away
- if (numberOfSessions <= max_sessions) {
- giveBackSession(session);
- } else {
- disposeOfSession(session);
- }
- }
-
- void giveBackSession(Protocol session) {
- addAvailableSession(session);
- wakeUpMainThread();
- }
-
- void disposeOfSession(Protocol session) {
- try {
- protocolHandler.disconnect(session);
- } catch (Exception e) {
- // log failure
- }
- numberOfSessions--;
- }
-
- public void shutdown() {
- try {
- // close out threadpool
- threadController.shutdown();
- // give a max of 10 minutes to finish downloading any files
- threadController.awaitTermination(TIMEOUT2, TimeUnit.SECONDS);
- } catch (Exception e) {
- // log failure
- }
-
- try {
- this.resetVariables();
- } catch (Exception ignored) {
-
- }
-
- try {
- closeSessions();
- } catch (Exception e) {
- // log failure!!!
- }
-
- try {
- protocolHandler.close();
- } catch (Exception e) {
- // log failure!!!
- }
-
- }
-
- /**
- * Disconnects all downloading Protocol sessions in the avaiableSessions
- * list. The ThreadPoolExecutor needs to be completely shutdown before this
- * method should be called. Otherwise some Protocols might not be
- * disconnected or left downloading.
- *
- * @return True if successful, false otherwise
- * @throws RemoteConnectionException
- */
- public boolean closeSessions() throws RemoteConnectionException {
- for (Protocol session : avaliableSessions) {
- protocolHandler.disconnect(session);
- }
- avaliableSessions.clear();
- numberOfSessions = 0;
- return true;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/RemoteFile.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/RemoteFile.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/RemoteFile.java
deleted file mode 100644
index 68b0dcb..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/RemoteFile.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.retrievalsystem;
-
-//OODT imports
-import org.apache.oodt.cas.metadata.Metadata;
-import org.apache.oodt.cas.metadata.SerializableMetadata;
-import org.apache.oodt.cas.pushpull.protocol.RemoteSiteFile;
-
-//JDK imports
-import java.io.FileOutputStream;
-import java.io.IOException;
-
-/**
- * @author bfoster
- * @author mattmann
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class RemoteFile implements RemoteFileMetKeys {
-
- private Metadata metadata;
-
- private RemoteSiteFile pFile;
-
- public RemoteFile(RemoteSiteFile pFile) {
- this.pFile = pFile;
- this.metadata = new Metadata();
- this.metadata.addMetadata(RETRIEVED_FROM_LOC, pFile.getPath());
- this.metadata.addMetadata(FILENAME, pFile.getName());
- this.metadata.addMetadata(DATA_PROVIDER, pFile.getSite().getURL().getHost());
- }
-
- public void setUniqueMetadataElement(String uniqueMetadataElement) {
- this.metadata.addMetadata(PRODUCT_NAME, this
- .getMetadata(uniqueMetadataElement));
- }
-
- public void addMetadata(String key, String value) {
- this.metadata.addMetadata(key, value);
- }
-
- public void addMetadata(Metadata metadata) {
- this.metadata.addMetadata(metadata);
- }
-
- public String getMetadata(String key) {
- return this.metadata.getMetadata(key);
- }
-
- public Metadata getAllMetadata() {
- return this.metadata;
- }
-
- public RemoteSiteFile getProtocolFile() {
- return this.pFile;
- }
-
- public void writeToPropEqValFile(String filePath,
- String[] metadataToWriteOut) throws IOException {
- try {
- SerializableMetadata sMetadata = new SerializableMetadata("UTF-8",
- false);
- for (String metadataKey : metadataToWriteOut) {
- if (this.metadata.getMetadata(metadataKey) != null
- && !this.metadata.getMetadata(metadataKey).equals("")) {
- sMetadata.addMetadata(metadataKey, this.metadata
- .getMetadata(metadataKey));
- }
- }
- sMetadata.writeMetadataToXmlStream(new FileOutputStream(filePath));
- } catch (Exception e) {
- throw new IOException("Failed to write metadata file for "
- + this.pFile + " : " + e.getMessage());
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/RemoteFileMetKeys.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/RemoteFileMetKeys.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/RemoteFileMetKeys.java
deleted file mode 100644
index 1ad95e8..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/RemoteFileMetKeys.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.retrievalsystem;
-
-/**
- * @author mattmann
- * @version $Revision$
- *
- * <p>
- * Met keys needed by the {@link RemoteFile}
- * </p>.
- */
-public interface RemoteFileMetKeys {
-
- String PRODUCT_NAME = "ProductName";
-
- String RETRIEVED_FROM_LOC = "RetrievedFromLoc";
-
- String FILENAME = "Filename";
-
- String DATA_PROVIDER = "DataProvider";
-
- String FILE_SIZE = "FileSize";
-
- String RENAMING_STRING = "RenamingString";
-
- String DOWNLOAD_TO_DIR = "DownloadToDir";
-
- String PRODUCT_TYPE = "ProductType";
-
- String MIME_TYPE = "MimeType";
-
- String SUPER_TYPE = "SuperType";
-
- String DELETE_AFTER_DOWNLOAD = "DeleteAfterDownload";
-
- String PRODUCT_NAME_GENERATOR = "ProductNameGenerator";
-
- String UNIQUE_ELEMENT = "UniqueElement";
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/RetrievalSetup.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/RetrievalSetup.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/RetrievalSetup.java
deleted file mode 100644
index 3113620..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/RetrievalSetup.java
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.retrievalsystem;
-
-//OODT imports
-import org.apache.oodt.cas.pushpull.config.*;
-import org.apache.oodt.cas.pushpull.exceptions.ParserException;
-import org.apache.oodt.cas.pushpull.filerestrictions.Parser;
-import org.apache.oodt.cas.pushpull.objectfactory.PushPullObjectFactory;
-import org.apache.oodt.cas.pushpull.retrievalmethod.RetrievalMethod;
-
-//JDK imports
-import java.io.*;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class RetrievalSetup {
-
- public static final int TIMEOUT = 5000;
- private final Config config;
-
- private final HashSet<File> alreadyProcessedPropFiles;
-
- private final ConcurrentHashMap<Class<RetrievalMethod>, RetrievalMethod> classToRmMap;
-
- private boolean downloadingProps;
-
- private final SiteInfo siteInfo;
-
- private final DataFileToPropFileLinker linker;
-
- private final static Logger LOG = Logger.getLogger(RetrievalSetup.class
- .getName());
-
- public RetrievalSetup(Config config, SiteInfo siteInfo) {
- this.downloadingProps = false;
- this.config = config;
- this.siteInfo = siteInfo;
- alreadyProcessedPropFiles = new HashSet<File>();
- classToRmMap = new ConcurrentHashMap<Class<RetrievalMethod>, RetrievalMethod>();
- linker = new DataFileToPropFileLinker();
- }
-
- public void retrieveFiles(PropFilesInfo pfi, final DataFilesInfo dfi) {
-
- FileRetrievalSystem dataFilesFRS = null;
- try {
- this.startPropFileDownload(pfi);
-
- (dataFilesFRS = new FileRetrievalSystem(config, siteInfo))
- .initialize();
- dataFilesFRS.registerDownloadListener(linker);
-
- File[] propFiles;
- while ((propFiles = getCurrentlyDownloadedPropFiles(pfi)).length > 0
- || downloadingProps) {
- for (File propFile : propFiles) {
- try {
- Parser parser = pfi.getParserForFile(propFile);
- Class<RetrievalMethod> rmClass = config.getParserInfo()
- .getRetrievalMethod(parser);
- RetrievalMethod rm;
- if ((rm = this.classToRmMap.get(rmClass)) == null) {
- LOG.log(Level.INFO, "Creating '"
- + rmClass.getCanonicalName()
- + "' to download data files");
- rm = PushPullObjectFactory
- .createNewInstance(rmClass);
- this.classToRmMap.put(rmClass, rm);
- }
- rm.processPropFile(dataFilesFRS, parser, propFile, dfi,
- linker);
- } catch (ParserException e) {
- LOG.log(Level.SEVERE, "Failed to parse property file "
- + propFile + " : " + e.getMessage(), e);
- linker.markAsFailed(propFile,
- "Failed to parse property file " + propFile
- + " : " + e.getMessage());
- } catch (Exception e) {
- LOG.log(Level.SEVERE,
- "Failed to finish downloading per property files "
- + propFile.getAbsolutePath() + " : "
- + e.getMessage(), e);
- linker.markAsFailed(propFile,
- "Error while downloading per property file "
- + propFile.getAbsolutePath() + " : "
- + e.getMessage());
- }
- }
-
- dataFilesFRS.waitUntilAllCurrentDownloadsAreComplete();
-
- for (File propFile : propFiles) {
- try {
- if (pfi.getLocalDir().equals(pfi.getOnSuccessDir())
- || pfi.getLocalDir().equals(pfi.getOnFailDir())) {
- alreadyProcessedPropFiles.add(propFile);
- }
- this.movePropsFileToFinalDestination(pfi, propFile,
- linker.getErrorsAndEraseLinks(propFile));
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- LOG.log(Level.SEVERE,
- "Error occurred while writing errors to error dir for file '"
- + propFile + "' : " + e.getMessage());
- }
- }
- }
-
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- } finally {
- if (dataFilesFRS != null) {
- dataFilesFRS.shutdown();
- }
- alreadyProcessedPropFiles.clear();
- linker.clear();
- }
- }
-
- private void startPropFileDownload(final PropFilesInfo pfi) {
- if (pfi.needsToBeDownloaded()) {
- this.downloadingProps = true;
- new Thread(new Runnable() {
-
- @Override
- public void run() {
- FileRetrievalSystem frs = null;
- try {
- (frs = new FileRetrievalSystem(
- RetrievalSetup.this
- .createPropFilesConfig(config
- .getProtocolInfo()), siteInfo))
- .initialize();
-
- LinkedList<File> propDirStructFiles = pfi
- .getDownloadInfoPropFiles();
- for (File dirStructFile : propDirStructFiles) {
- Parser parser = pfi.getParserForFile(dirStructFile);
- Class<RetrievalMethod> rmClass = config
- .getParserInfo().getRetrievalMethod(parser);
- RetrievalMethod rm;
- if ((rm = RetrievalSetup.this.classToRmMap
- .get(rmClass)) == null) {
- LOG.log(Level.INFO, "Creating '"
- + rmClass.getCanonicalName()
- + "' to download property files");
- rm = PushPullObjectFactory
- .createNewInstance(rmClass);
- RetrievalSetup.this.classToRmMap.put(rmClass,
- rm);
- }
- rm.processPropFile(frs, parser, dirStructFile,
- new DataFilesInfo(null, pfi
- .getDownloadInfo()), linker);
- }
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- } finally {
- if (frs != null) {
- frs.shutdown();
- }
- RetrievalSetup.this.downloadingProps = false;
- }
- }
-
- }).start();
-
- // give property file download a 5 sec head start
- LOG
- .log(
- Level.INFO,
- "Waiting data download thread for 5 secs to give the property files download thread a head start");
- synchronized (this) {
- try {
- this.wait(TIMEOUT);
- } catch (Exception ignored) {
- }
- }
- }
- }
-
- private File[] getCurrentlyDownloadedPropFiles(final PropFilesInfo pfi) {
- File[] files = pfi.getLocalDir().listFiles(new FileFilter() {
- @Override
- public boolean accept(File pathname) {
- return pfi.getParserForFile(pathname) != null
- && !(pathname.getName().startsWith("Downloading_")
- || pathname.getName().endsWith(
- RetrievalSetup.this.config
- .getMetFileExtension()) || alreadyProcessedPropFiles
- .contains(pathname));
- }
- });
- return files == null ? new File[0] : files;
- }
-
- private Config createPropFilesConfig(ProtocolInfo pi) {
- Config propConfig = this.config.clone();
- ProtocolInfo propPI = pi.clone();
- propPI.setPageSize(-1);
- propConfig.setProtocolInfo(propPI);
- propConfig.setUseTracker(false);
- propConfig.setIngester(null);
- propConfig.setOnlyDownloadDefinedTypes(false);
- return propConfig;
- }
-
- private void movePropsFileToFinalDestination(PropFilesInfo pfi,
- File dirstructFile, String errorMsgs) throws IOException {
- File metFile = new File(
- String.format("%s.%s", dirstructFile.getAbsolutePath(), config.getMetFileExtension()));
- if (pfi.getDeleteOnSuccess() && errorMsgs == null) {
- dirstructFile.delete();
- metFile.delete();
- return;
- }
- File moveToDir = pfi.getFinalDestination(errorMsgs == null);
- moveToDir.mkdirs();
- File newLoc = new File(moveToDir, dirstructFile.getName());
- dirstructFile.renameTo(newLoc);
- metFile.renameTo(new File(
- String.format("%s.%s", newLoc.getAbsolutePath(), config.getMetFileExtension())));
- if (errorMsgs != null) {
- File errorFile = new File(newLoc.getParentFile(), dirstructFile
- .getName()
- + ".errors");
- errorFile.createNewFile();
-
- PrintStream ps = new PrintStream(new FileOutputStream(errorFile));
- ps.print(errorMsgs);
- ps.println();
- ps.close();
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/TimeAndThreadCount.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/TimeAndThreadCount.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/TimeAndThreadCount.java
deleted file mode 100644
index f8f3985..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/TimeAndThreadCount.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.retrievalsystem;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class TimeAndThreadCount {
-
- private long startTimeInMillis;
-
- private int threadCount;
-
- public TimeAndThreadCount(long startTimeInMillis, int threadCount) {
- this.startTimeInMillis = startTimeInMillis;
- this.threadCount = threadCount;
- }
-
- public long getStartTimeInMillis() {
- return this.startTimeInMillis;
- }
-
- public int getThreadCount() {
- return this.threadCount;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/url/handlers/imaps/Handler.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/url/handlers/imaps/Handler.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/url/handlers/imaps/Handler.java
deleted file mode 100644
index c5ed8c2..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/url/handlers/imaps/Handler.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.url.handlers.imaps;
-
-//JDK imports
-import java.io.IOException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.URLStreamHandler;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>Describe your class here</p>.
- */
-public class Handler extends URLStreamHandler {
-
- @Override
- protected URLConnection openConnection(URL url) throws IOException {
- return new ImapsURLConnection(url);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/url/handlers/imaps/ImapsURLConnection.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/url/handlers/imaps/ImapsURLConnection.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/url/handlers/imaps/ImapsURLConnection.java
deleted file mode 100644
index 6e1d792..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/url/handlers/imaps/ImapsURLConnection.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.url.handlers.imaps;
-
-//JDK imports
-import java.io.IOException;
-import java.net.URL;
-import java.net.URLConnection;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class ImapsURLConnection extends URLConnection {
-
- protected ImapsURLConnection(URL url) {
- super(url);
- }
-
- @Override
- public void connect() throws IOException {
- // do nothing
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/url/handlers/sftp/Handler.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/url/handlers/sftp/Handler.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/url/handlers/sftp/Handler.java
deleted file mode 100644
index e80a030..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/url/handlers/sftp/Handler.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.url.handlers.sftp;
-
-//JDK imports
-import java.io.IOException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.URLStreamHandler;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>Describe your class here</p>.
- */
-public class Handler extends URLStreamHandler {
-
- @Override
- protected URLConnection openConnection(URL url) throws IOException {
- return new SftpURLConnection(url);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/url/handlers/sftp/SftpURLConnection.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/url/handlers/sftp/SftpURLConnection.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/url/handlers/sftp/SftpURLConnection.java
deleted file mode 100644
index ff63cdc..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/url/handlers/sftp/SftpURLConnection.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.url.handlers.sftp;
-
-//JDK imports
-import java.io.IOException;
-import java.net.URL;
-import java.net.URLConnection;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>Describe your class here</p>.
- */
-public class SftpURLConnection extends URLConnection {
-
- protected SftpURLConnection(URL url) {
- super(url);
- }
-
- @Override
- public void connect() throws IOException {
- // do nothing!!!
- }
-
-}
[33/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/DataSourceIngestMapperFactory.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/DataSourceIngestMapperFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/DataSourceIngestMapperFactory.java
deleted file mode 100644
index 901915b..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/DataSourceIngestMapperFactory.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.mapping;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-//Spring imports
-import org.springframework.beans.factory.annotation.Required;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A Factory for creating DataSourceIngestMapper
- * <p>
- */
-public class DataSourceIngestMapperFactory implements IngestMapperFactory {
-
- private static Logger LOG = Logger.getLogger(DataSourceIngestMapperFactory.class.getName());
-
- protected String jdbcUrl;
- protected String user;
- protected String pass;
- protected String driver;
-
- public DataSourceIngestMapperFactory() {}
-
- public String getJdbcUrl() {
- return jdbcUrl;
- }
-
- @Required
- public void setJdbcUrl(String jdbcUrl) {
- this.jdbcUrl = jdbcUrl;
- }
-
- public String getUser() {
- return user;
- }
-
- @Required
- public void setUser(String user) {
- this.user = user;
- }
-
- public String getPass() {
- return pass;
- }
-
- @Required
- public void setPass(String pass) {
- this.pass = pass;
- }
-
- public String getDriver() {
- return driver;
- }
-
- @Required
- public void setDriver(String driver) {
- this.driver = driver;
- }
-
- @Override
- public IngestMapper createMapper() {
- try {
- return new DataSourceIngestMapper(user, pass,
- driver, jdbcUrl);
- }catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage(), e);
- return null;
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/InMemoryIngestMapper.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/InMemoryIngestMapper.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/InMemoryIngestMapper.java
deleted file mode 100644
index 525ea07..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/InMemoryIngestMapper.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.mapping;
-
-//OODT imports
-import org.apache.oodt.commons.database.SqlScript;
-
-//JDK imports
-import java.io.File;
-import java.io.IOException;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- */
-public class InMemoryIngestMapper extends DataSourceIngestMapper {
-
- public InMemoryIngestMapper(String user, String pass, String driver,
- String jdbcUrl, String tablesFile) throws IOException {
- super(user, pass, driver, jdbcUrl);
- SqlScript coreSchemaScript = new SqlScript(new File(tablesFile).getAbsolutePath(), this.getDataSource());
- coreSchemaScript.loadScript();
- coreSchemaScript.execute();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/InMemoryIngestMapperFactory.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/InMemoryIngestMapperFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/InMemoryIngestMapperFactory.java
deleted file mode 100644
index 8d79e41..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/InMemoryIngestMapperFactory.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.mapping;
-
-//JDK imports
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.struct.impl.index.InMemoryIndexFactory;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- */
-public class InMemoryIngestMapperFactory extends DataSourceIngestMapperFactory {
-
- private static final Logger LOG = Logger.getLogger(InMemoryIndexFactory.class.getName());
-
- protected String tablesFile;
-
- @Override
- public InMemoryIngestMapper createMapper() {
- try {
- return new InMemoryIngestMapper(user, pass,
- driver, jdbcUrl, this.tablesFile);
- }catch (Exception e) {
- LOG.log(Level.SEVERE, "Failed to create InMemoryIndex : " + e.getMessage(), e);
- return null;
- }
- }
-
- public void setTablesFile(String tablesFile) {
- this.tablesFile = tablesFile;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/IngestMapper.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/IngestMapper.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/IngestMapper.java
deleted file mode 100644
index 1c1ecde..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/IngestMapper.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.mapping;
-
-import java.sql.SQLException;
-import java.text.ParseException;
-//JDK imports
-import java.util.Set;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.exception.CatalogRepositoryException;
-import org.apache.oodt.cas.catalog.page.CatalogReceipt;
-import org.apache.oodt.cas.catalog.page.IndexPager;
-import org.apache.oodt.cas.catalog.struct.TransactionId;
-import org.apache.oodt.cas.catalog.struct.TransactionIdFactory;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * An Interface Ingest Mapper that indexes transaction ids to catalog transaction ids and catlaog ids
- * <p>
- */
-public interface IngestMapper {
-
- /**
- * Maps the three arguments to each other so any of the others can be
- * retrieved via one of the other arguments
- *
- * @param catalogServiceTransactionId
- * TransactionId generated by the CatalogService
- * @throws CatalogRepositoryException
- * Any error
- * @throws SQLException
- */
- void storeTransactionIdMapping(
- TransactionId<?> catalogServiceTransactionId, TransactionIdFactory catalogServiceTransactionIdFactory,
- CatalogReceipt catalogReceipt, TransactionIdFactory catalogTransactionIdFactory)
- throws CatalogRepositoryException, SQLException;
-
- Set<TransactionId<?>> getPageOfCatalogTransactionIds(IndexPager indexPager,
- String catalogId) throws CatalogRepositoryException, SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException;
-
- void deleteTransactionIdMapping(TransactionId<?> catalogTransactionId,
- String catalogId) throws CatalogRepositoryException, SQLException;
-
- void deleteAllMappingsForCatalogServiceTransactionId(
- TransactionId<?> catalogServiceTransactionId)
- throws CatalogRepositoryException, SQLException;
-
- void deleteAllMappingsForCatalog(String catalogId)
- throws CatalogRepositoryException, SQLException;
-
- /**
- * Verify if the given CatalogService TransactionId has been stored in a
- * mapping {@link storeTransactionIdMapping(String, TransactionId<?>,
- * TransactionId<?>)}
- *
- * @param catalogServiceTransactionId
- * The CatalogService TransactionId in question
- * @return True is the catalogServiceTransactionId has been used in a used in a mapping
- * @throws CatalogRepositoryException
- * Any error
- * @throws SQLException
- */
- boolean hasCatalogServiceTransactionId(
- TransactionId<?> catalogServiceTransactionId)
- throws CatalogRepositoryException, SQLException;
-
- /**
- * Get the CatalogService TransactionId that was mapped to the given Catalog
- * URN and Catalog TransactionId
- *
- * @param catalogTransactionId
- * A Catalog TransactionId
- * @param catalogId
- * A unique Catalog ID when the Catalog TransactionId was used
- * @return The CatalogService TransactionId which was mapped to the given
- * Catalog TransactionId and Catalog ID
- * @throws CatalogRepositoryException
- * Any Error
- * @throws SQLException
- * @throws ClassNotFoundException
- * @throws IllegalAccessException
- * @throws InstantiationException
- */
- TransactionId<?> getCatalogServiceTransactionId(
- TransactionId<?> catalogTransactionId, String catalogId)
- throws CatalogRepositoryException, SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException;
-
- /**
- * Get the Catalog TransactionId that was mapped to the given Catalog ID
- * and CatalogService TransactionId
- *
- * @param catalogServiceTransactionId
- * A Catalog TransactionId
- * @param catalogId
- * A unique Catalog ID when the Catalog TransactionId was used
- * @return The CatalogService TransactionId which was mapped to the given
- * Catalog TransactionId and Catalog ID
- * @throws CatalogRepositoryException
- * Any Error
- * @throws SQLException
- * @throws ClassNotFoundException
- * @throws IllegalAccessException
- * @throws InstantiationException
- */
- TransactionId<?> getCatalogTransactionId(
- TransactionId<?> catalogServiceTransactionId, String catalogId)
- throws CatalogRepositoryException, SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException;
-
- /**
- * Get all the Catalog URNs for which the given TransactionId was mapped
- *
- * @param catalogServiceTransactionId
- * A CatalogService TransactionId
- * @return Catalog IDs for which the given TransactionId was mapped
- * @throws CatalogRepositoryException
- * Any Error
- * @throws SQLException
- */
- Set<String> getCatalogIds(
- TransactionId<?> catalogServiceTransactionId)
- throws CatalogRepositoryException, SQLException;
-
- /**
- *
- * @param catalogServiceTransactionId
- * @param catalogId
- * @return
- * @throws CatalogRepositoryException
- * @throws SQLException
- * @throws ClassNotFoundException
- * @throws IllegalAccessException
- * @throws InstantiationException
- * @throws ParseException
- */
- CatalogReceipt getCatalogReceipt(
- TransactionId<?> catalogServiceTransactionId, String catalogId)
- throws CatalogRepositoryException, SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException, ParseException;
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/IngestMapperFactory.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/IngestMapperFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/IngestMapperFactory.java
deleted file mode 100644
index 964a0dd..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/IngestMapperFactory.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.mapping;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A Factory for creating IngestMapper
- * <p>
- */
-public interface IngestMapperFactory {
-
- IngestMapper createMapper();
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/LuceneIngestMapper.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/LuceneIngestMapper.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/LuceneIngestMapper.java
deleted file mode 100644
index 3b97265..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/LuceneIngestMapper.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.mapping;
-
-//JDK imports
-import java.util.Set;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.exception.CatalogRepositoryException;
-import org.apache.oodt.cas.catalog.page.CatalogReceipt;
-import org.apache.oodt.cas.catalog.page.IndexPager;
-import org.apache.oodt.cas.catalog.struct.TransactionId;
-import org.apache.oodt.cas.catalog.struct.TransactionIdFactory;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A Ingest Mapper that indexes to a Lucene index
- * <p>
- */
-public class LuceneIngestMapper implements IngestMapper {
-
- private static final String UNSUPPORTED = "This operation is currently unsupported. Please report to dev@oodt.apache.org";
- @Override
- public void deleteAllMappingsForCatalog(String catalogId)
- throws CatalogRepositoryException {
- throw new UnsupportedOperationException(UNSUPPORTED);
- }
-
- @Override
- public void deleteAllMappingsForCatalogServiceTransactionId(
- TransactionId<?> catalogServiceTransactionId)
- throws CatalogRepositoryException {
- throw new UnsupportedOperationException(UNSUPPORTED);
- }
-
- @Override
- public void deleteTransactionIdMapping(
- TransactionId<?> catalogTransactionId, String catalogId)
- throws CatalogRepositoryException {
- throw new UnsupportedOperationException(UNSUPPORTED);
- }
-
- @Override
- public CatalogReceipt getCatalogReceipt(
- TransactionId<?> catalogServiceTransactionId, String catalogId)
- throws CatalogRepositoryException {
- throw new UnsupportedOperationException(UNSUPPORTED);
- }
-
- @Override
- public TransactionId<?> getCatalogServiceTransactionId(
- TransactionId<?> catalogTransactionId, String catalogId)
- throws CatalogRepositoryException {
- throw new UnsupportedOperationException(UNSUPPORTED);
- }
-
- @Override
- public TransactionId<?> getCatalogTransactionId(
- TransactionId<?> catalogServiceTransactionId, String catalogId)
- throws CatalogRepositoryException {
- throw new UnsupportedOperationException(UNSUPPORTED);
- }
-
- @Override
- public Set<String> getCatalogIds(
- TransactionId<?> catalogServiceTransactionId)
- throws CatalogRepositoryException {
- throw new UnsupportedOperationException(UNSUPPORTED);
- }
-
- @Override
- public Set<TransactionId<?>> getPageOfCatalogTransactionIds(
- IndexPager indexPager, String catalogId)
- throws CatalogRepositoryException {
- throw new UnsupportedOperationException(UNSUPPORTED);
- }
-
- @Override
- public boolean hasCatalogServiceTransactionId(
- TransactionId<?> catalogServiceTransactionId)
- throws CatalogRepositoryException {
- throw new UnsupportedOperationException(UNSUPPORTED);
- }
-
- @Override
- public void storeTransactionIdMapping(
- TransactionId<?> catalogServiceTransactionId,
- TransactionIdFactory catalogServiceTransactionIdFactory,
- CatalogReceipt catalogReceipt,
- TransactionIdFactory catalogTransactionIdFactory)
- throws CatalogRepositoryException {
- throw new UnsupportedOperationException(UNSUPPORTED);
- }
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/LuceneIngestMapperFactory.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/LuceneIngestMapperFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/LuceneIngestMapperFactory.java
deleted file mode 100644
index c736bd9..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/LuceneIngestMapperFactory.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.mapping;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A Factory for creating LuceneIngestMapper
- * <p>
- */
-public class LuceneIngestMapperFactory implements
- IngestMapperFactory {
-
- @Override
- public IngestMapper createMapper() {
- return new LuceneIngestMapper();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/MemoryBasedIngestMapper.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/MemoryBasedIngestMapper.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/MemoryBasedIngestMapper.java
deleted file mode 100644
index 58df519..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/MemoryBasedIngestMapper.java
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.mapping;
-
-//JDK imports
-import org.apache.oodt.cas.catalog.exception.CatalogRepositoryException;
-import org.apache.oodt.cas.catalog.page.CatalogReceipt;
-import org.apache.oodt.cas.catalog.page.IndexPager;
-import org.apache.oodt.cas.catalog.struct.TransactionId;
-import org.apache.oodt.cas.catalog.struct.TransactionIdFactory;
-
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.Vector;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-//OODT imports
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A Ingest Mapper that indexes to local memory
- * <p>
- */
-public class MemoryBasedIngestMapper implements IngestMapper {
-
- private static Logger LOG = Logger.getLogger(MemoryBasedIngestMapper.class.getName());
-
- protected ConcurrentHashMap<String, TransactionIdMapping> catalogServiceTransactionIdKeyMapping;
- protected ConcurrentHashMap<String, TransactionIdMapping> catalogInfoKeyMapping;
- protected ConcurrentHashMap<String, List<CatalogReceipt>> catalogIdToCatalogReceiptMapping;
-
- public MemoryBasedIngestMapper() {
- this.catalogServiceTransactionIdKeyMapping = new ConcurrentHashMap<>();
- this.catalogInfoKeyMapping = new ConcurrentHashMap<>();
- this.catalogIdToCatalogReceiptMapping = new ConcurrentHashMap<>();
- }
-
- /*
- * (non-Javadoc)
- *
- * @seeorg.apache.oodt.cas.catalog.repository.CatalogRepository#
- * getCatalogServiceTransactionId
- * (org.apache.oodt.cas.catalog.struct.TransactionId, java.lang.String)
- */
- @Override
- public synchronized TransactionId<?> getCatalogServiceTransactionId(
- TransactionId<?> catalogTransactionId, String catalogId)
- throws CatalogRepositoryException {
- LOG.log(Level.INFO, "Looking up CatalogService TransactionId for Catalog TransactionId '" + catalogTransactionId + "' and catalog '" + catalogId + "'");
- String key = generateKey(catalogTransactionId.toString(), catalogId);
- TransactionIdMapping mapping = this.catalogInfoKeyMapping.get(key);
- if (mapping != null) {
- return mapping.catalogServiceTransactionId;
- }else {
- return null;
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @seeorg.apache.oodt.cas.catalog.repository.CatalogRepository#
- * getCatalogTransactionId
- * (org.apache.oodt.cas.catalog.struct.TransactionId, java.lang.String)
- */
- @Override
- public synchronized TransactionId<?> getCatalogTransactionId(
- TransactionId<?> catalogServiceTransactionId, String catalogId)
- throws CatalogRepositoryException {
- TransactionIdMapping mapping = this.catalogServiceTransactionIdKeyMapping
- .get(catalogServiceTransactionId.toString());
- if (mapping != null) {
- for (CatalogReceipt receipt : mapping.getCatalogReceipts()) {
- if (receipt.getCatalogId().equals(catalogId)) {
- return receipt.getTransactionId();
- }
- }
- }
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.oodt.cas.catalog.mapping.IngestMapper#getPage(org.apache
- * .oodt.cas.catalog.page.IndexPager, java.lang.String)
- */
- @Override
- public synchronized Set<TransactionId<?>> getPageOfCatalogTransactionIds(IndexPager indexPager,
- String catalogId) throws CatalogRepositoryException {
- Set<TransactionId<?>> catalogTransactionIds = new HashSet<>();
- List<CatalogReceipt> catalogReceipts = this.catalogIdToCatalogReceiptMapping.get(catalogId);
- if (catalogReceipts != null) {
- for (int i = indexPager.getPageNum() * indexPager.getPageSize();
- i < catalogReceipts.size() && i < (indexPager.getPageNum() + 1) * indexPager.getPageSize(); i++) {
- catalogTransactionIds.add(catalogReceipts.get(i).getTransactionId());
- }
- }
- return catalogTransactionIds;
- }
-
- /*
- * (non-Javadoc)
- * @see org.apache.oodt.cas.catalog.mapping.IngestMapper#deleteAllMappingsForCatalog(java.lang.String)
- */
- @Override
- public synchronized void deleteAllMappingsForCatalog(String catalogId)
- throws CatalogRepositoryException {
- List<CatalogReceipt> catalogReceipts = this.catalogIdToCatalogReceiptMapping.remove(catalogId);
- if (catalogReceipts != null) {
- for (CatalogReceipt catalogReceipt : catalogReceipts) {
- TransactionIdMapping mapping = this.catalogInfoKeyMapping.remove(generateKey(catalogReceipt.getTransactionId().toString(), catalogReceipt.getCatalogId()));
- if (mapping != null) {
- mapping.getCatalogReceipts().remove(catalogReceipt);
- }
- }
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.apache.oodt.cas.catalog.repository.CatalogRepository#deleteAllMappingsForCatalogServiceTransactionId(org.apache.oodt.cas.catalog.struct.TransactionId)
- */
- @Override
- public synchronized void deleteAllMappingsForCatalogServiceTransactionId(
- TransactionId<?> catalogServiceTransactionId)
- throws CatalogRepositoryException {
- TransactionIdMapping mapping = this.catalogServiceTransactionIdKeyMapping.remove(catalogServiceTransactionId.toString());
- if (mapping != null) {
- for (CatalogReceipt catalogReceipt : mapping.getCatalogReceipts()) {
- this.catalogIdToCatalogReceiptMapping.get(catalogReceipt.getCatalogId()).remove(catalogReceipt);
- this.catalogInfoKeyMapping
- .remove(generateKey(catalogReceipt.getTransactionId().toString(), catalogReceipt.getCatalogId()));
- }
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.apache.oodt.cas.catalog.repository.CatalogRepository#deleteTransactionIdMapping(org.apache.oodt.cas.catalog.struct.TransactionId, org.apache.oodt.cas.catalog.struct.TransactionId, java.lang.String)
- */
- @Override
- public synchronized void deleteTransactionIdMapping(
- TransactionId<?> catalogTransactionId, String catalogId)
- throws CatalogRepositoryException {
- List<CatalogReceipt> catalogReceipts = this.catalogIdToCatalogReceiptMapping.get(catalogId);
- for (int i = 0; i < catalogReceipts.size(); i++) {
- if (catalogReceipts.get(i).getCatalogId().equals(catalogId) && catalogReceipts.get(i).getTransactionId().equals(catalogTransactionId)) {
- catalogReceipts.remove(i);
- break;
- }
- }
- TransactionIdMapping mapping = this.catalogInfoKeyMapping.remove(generateKey(catalogTransactionId.toString(), catalogId));
- this.catalogServiceTransactionIdKeyMapping.remove(mapping.getCatalogServiceTransactionId().toString());
- }
-
- /*
- * (non-Javadoc)
- * @see org.apache.oodt.cas.catalog.repository.CatalogRepository#hasCatalogServiceTransactionId(org.apache.oodt.cas.catalog.struct.TransactionId)
- */
- @Override
- public synchronized boolean hasCatalogServiceTransactionId(
- TransactionId<?> catalogServiceTransactionId)
- throws CatalogRepositoryException {
- return this.catalogServiceTransactionIdKeyMapping.containsKey(catalogServiceTransactionId.toString());
- }
-
- /*
- * (non-Javadoc)
- *
- * @seeorg.apache.oodt.cas.catalog.repository.CatalogRepository#
- * storeTransactionIdMapping(java.lang.String,
- * org.apache.oodt.cas.catalog.struct.TransactionId,
- * org.apache.oodt.cas.catalog.struct.TransactionId)
- */
- @Override
- public synchronized void storeTransactionIdMapping(
- TransactionId<?> catalogServiceTransactionId,
- TransactionIdFactory catalogServiceTransactionIdFactory,
- CatalogReceipt catalogReceipt,
- TransactionIdFactory catalogTransactionIdFactory)
- throws CatalogRepositoryException {
- TransactionIdMapping mapping = this.catalogServiceTransactionIdKeyMapping
- .get(catalogServiceTransactionId.toString());
- if (mapping == null) {
- mapping = new TransactionIdMapping(catalogServiceTransactionId);
- }
- mapping.addCatalogReceipt(catalogReceipt);
- this.catalogServiceTransactionIdKeyMapping.put(
- catalogServiceTransactionId.toString(), mapping);
- this.catalogInfoKeyMapping.put(generateKey(catalogReceipt.getTransactionId().toString(), catalogReceipt.getCatalogId()), mapping);
- List<CatalogReceipt> catalogReceipts = this.catalogIdToCatalogReceiptMapping.get(catalogReceipt.getCatalogId());
- if (catalogReceipts == null) {
- catalogReceipts = new Vector<CatalogReceipt>();
- }
- catalogReceipts.add(catalogReceipt);
- this.catalogIdToCatalogReceiptMapping.put(catalogReceipt.getCatalogId(), catalogReceipts);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.oodt.cas.catalog.repository.CatalogRepository#getCatalogs
- * (org.apache.oodt.cas.catalog.struct.TransactionId)
- */
- @Override
- public synchronized Set<String> getCatalogIds(
- TransactionId<?> catalogServiceTransactionId)
- throws CatalogRepositoryException {
- HashSet<String> catalogs = new HashSet<>();
- TransactionIdMapping mapping = this.catalogServiceTransactionIdKeyMapping
- .get(catalogServiceTransactionId.toString());
- for (CatalogReceipt catalogReceipt : mapping.getCatalogReceipts()) {
- catalogs.add(catalogReceipt.getCatalogId());
- }
- return catalogs;
- }
-
- @Override
- public CatalogReceipt getCatalogReceipt(
- TransactionId<?> catalogServiceTransactionId, String catalogId)
- throws CatalogRepositoryException {
- TransactionIdMapping mapping = this.catalogServiceTransactionIdKeyMapping.get(catalogServiceTransactionId);
- for (CatalogReceipt catalogReceipt : mapping.getCatalogReceipts()) {
- if (catalogReceipt.getCatalogId().equals(catalogId)) {
- return catalogReceipt;
- }
- }
- return null;
- }
-
- private static String generateKey(String catalogTransactionId, String catalogId) {
- return catalogTransactionId + ":" + catalogId;
- }
-
- private static class TransactionIdMapping {
-
- private TransactionId<?> catalogServiceTransactionId;
- private List<CatalogReceipt> catalogReceipts;
-
- public TransactionIdMapping(TransactionId<?> catalogServiceTransactionId) {
- this.catalogServiceTransactionId = catalogServiceTransactionId;
- this.catalogReceipts = new Vector<>();
- }
-
- public void addCatalogReceipt(CatalogReceipt catalogReceipt) {
- this.catalogReceipts.add(catalogReceipt);
- }
-
- public List<CatalogReceipt> getCatalogReceipts() {
- return this.catalogReceipts;
- }
-
- public TransactionId<?> getCatalogServiceTransactionId() {
- return catalogServiceTransactionId;
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/MemoryBasedIngestMapperFactory.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/MemoryBasedIngestMapperFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/MemoryBasedIngestMapperFactory.java
deleted file mode 100644
index cf691ba..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/MemoryBasedIngestMapperFactory.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.mapping;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A Factory for creating MemoryBasedIngestMapper
- * <p>
- */
-public class MemoryBasedIngestMapperFactory implements IngestMapperFactory {
-
- @Override
- public IngestMapper createMapper() {
- return new MemoryBasedIngestMapper();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/metadata/TransactionalMetadata.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/metadata/TransactionalMetadata.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/metadata/TransactionalMetadata.java
deleted file mode 100644
index 7474581..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/metadata/TransactionalMetadata.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.metadata;
-
-//JDK imports
-import java.util.Date;
-import java.util.Set;
-
-//APACHE imports
-import org.apache.commons.lang.StringUtils;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.page.TransactionReceipt;
-import org.apache.oodt.cas.catalog.struct.TransactionId;
-import org.apache.oodt.cas.catalog.system.CatalogService;
-import org.apache.oodt.cas.metadata.Metadata;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Metadata tied to a Transaction
- * <p>
- */
-public class TransactionalMetadata {
-
- protected TransactionReceipt receipt;
- protected Metadata metadata;
-
- public TransactionalMetadata(TransactionReceipt receipt, Metadata metadata) {
- this.receipt = receipt;
- this.metadata = metadata;
- this.metadata.replaceMetadata(CatalogService.CATALOG_SERVICE_TRANSACTION_ID_MET_KEY, this.receipt.getTransactionId().toString());
- this.metadata.replaceMetadata(CatalogService.CATALOG_IDS_MET_KEY, StringUtils.join(this.receipt.getCatalogIds().iterator(), ","));
- }
-
- public TransactionId<?> getTransactionId() {
- return receipt.getTransactionId();
- }
-
- public Set<String> getCatalogIds() {
- return receipt.getCatalogIds();
- }
-
- public Date getTransactionDate() {
- return receipt.getTransactionDate();
- }
-
- public Metadata getMetadata() {
- return metadata;
- }
-
- @Override
- public int hashCode() {
- return this.getTransactionId().hashCode();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/page/CatalogReceipt.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/CatalogReceipt.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/page/CatalogReceipt.java
deleted file mode 100644
index 3f9c195..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/CatalogReceipt.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.page;
-
-//JDK imports
-import org.apache.oodt.cas.catalog.struct.TransactionId;
-
-import java.util.Date;
-
-//OODT imports
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- */
-public class CatalogReceipt {
-
- private TransactionId<?> transactionId;
- private Date transactionDate;
- private String catalogId;
-
- public CatalogReceipt(IngestReceipt ingestReceipt, String catalogId) {
- this.transactionId = ingestReceipt.getCatalogTransactionId();
- this.transactionDate = ingestReceipt.getTransactionDate();
- this.catalogId = catalogId;
- }
-
- public TransactionId<?> getTransactionId() {
- return this.transactionId;
- }
-
- public Date getTransactionDate() {
- return this.transactionDate;
- }
-
- public String getCatalogId() {
- return this.catalogId;
- }
-
- public boolean equals(Object obj) {
- if (obj instanceof CatalogReceipt) {
- CatalogReceipt compareTo = (CatalogReceipt) obj;
- return this.transactionId.equals(compareTo.transactionId) && this.transactionDate.equals(compareTo.transactionDate) && this.catalogId.equals(compareTo.catalogId);
- }else {
- return false;
- }
- }
-
- public int hashCode() {
- return this.toString().hashCode();
- }
-
- public String toString() {
- return ("{CatalogReceipt(tID=" + this.transactionId + ",tDate=" + this.transactionDate + ",catID=" + this.catalogId + ")}");
- }
-
- public void setTransactionId(TransactionId<?> transactionId) {
- this.transactionId = transactionId;
- }
-
- public void setTransactionDate(Date transactionDate) {
- this.transactionDate = transactionDate;
- }
-
- public void setCatalogId(String catalogId) {
- this.catalogId = catalogId;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/page/IndexPager.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/IndexPager.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/page/IndexPager.java
deleted file mode 100644
index 9c9045a..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/IndexPager.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.page;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A pager for paging through a index
- * <p>
- */
-public class IndexPager {
-
- protected int pageSize;
- protected int pageNum;
- protected int totalPages;
- protected int numOfHits;
-
- public IndexPager() {
- this.pageSize = 20;
- this.pageNum = 1;
- this.totalPages = 0;
- }
-
- public IndexPager(ProcessedPageInfo processedPageInfo) {
- this.pageSize = processedPageInfo.getPageSize();
- this.pageNum = processedPageInfo.getPageNum();
- this.totalPages = processedPageInfo.getTotalPages();
- this.numOfHits = processedPageInfo.getNumOfHits();
- }
-
- public ProcessedPageInfo getProcessedPageInfo() {
- return new ProcessedPageInfo(this.pageSize, this.pageNum, this.numOfHits);
- }
-
- public int getPageSize() {
- return this.pageSize;
- }
-
- public int getPageNum() {
- return this.pageNum;
- }
-
- public int getTotalPages() {
- return this.totalPages;
- }
-
- public int getNumOfHits() {
- return this.numOfHits;
- }
-
- public void incrementPageNumber() {
- if (this.pageNum + 1 <= this.totalPages) {
- this.pageNum++;
- }
- }
-
- public boolean isLastPage() {
- return this.getProcessedPageInfo().isLastPage();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/page/IngestReceipt.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/IngestReceipt.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/page/IngestReceipt.java
deleted file mode 100644
index f6e0b38..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/IngestReceipt.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.page;
-
-//JDK imports
-import java.util.Date;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.struct.TransactionId;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- */
-public class IngestReceipt {
-
- protected TransactionId<?> catalogTransactionId;
- protected Date transactionDate;
-
- public IngestReceipt(TransactionId<?> catalogTransactionId, Date transactionDate) {
- this.catalogTransactionId = catalogTransactionId;
- this.transactionDate = transactionDate;
- }
-
- public TransactionId<?> getCatalogTransactionId() {
- return this.catalogTransactionId;
- }
-
- public Date getTransactionDate() {
- return this.transactionDate;
- }
-
- public int hashCode() {
- return this.catalogTransactionId.hashCode();
- }
-
- public String toString() {
- return this.catalogTransactionId.toString() + " : " + this.transactionDate.toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/page/Page.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/Page.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/page/Page.java
deleted file mode 100644
index be5dce3..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/Page.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.page;
-
-//JDK imports
-import java.util.List;
-import java.util.Set;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.query.QueryExpression;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- */
-public class Page {
-
- protected List<TransactionReceipt> receipts;
- protected ProcessedPageInfo processedPageInfo;
- protected QueryExpression queryExpression;
- protected Set<String> restrictToCatalogIds;
-
- public Page(ProcessedPageInfo pageInfo, QueryExpression queryExpression, Set<String> restrictToCatalogIds, List<TransactionReceipt> receipts) {
- this.processedPageInfo = pageInfo;
- this.queryExpression = queryExpression;
- this.restrictToCatalogIds = restrictToCatalogIds;
- this.receipts = receipts;
- }
-
- public List<TransactionReceipt> getReceipts() {
- return this.receipts;
- }
-
- public int getPageSize() {
- return this.processedPageInfo.getPageSize();
- }
-
- public int getPageNum() {
- return this.processedPageInfo.getPageNum();
- }
-
- public int getTotalPages() {
- return this.processedPageInfo.getTotalPages();
- }
-
- public int getNumOfHits() {
- return this.processedPageInfo.getNumOfHits();
- }
-
- public QueryExpression getQueryExpression() {
- return queryExpression;
- }
-
- public Set<String> getRestrictToCatalogIds() {
- return restrictToCatalogIds;
- }
-
- public boolean isLastPage() {
- return this.processedPageInfo.isLastPage();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/page/PageInfo.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/PageInfo.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/page/PageInfo.java
deleted file mode 100644
index af0f0f3..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/PageInfo.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.page;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- */
-public class PageInfo {
-
- protected int pageSize;
- protected int pageNum;
-
- public static final int LAST_PAGE = Integer.MAX_VALUE;
- public static final int FIRST_PAGE = 1;
-
- public PageInfo(int pageSize, int pageNum) {
- this.pageSize = pageSize;
- if (pageNum < 1) {
- this.pageNum = 1;
- } else {
- this.pageNum = pageNum;
- }
- }
-
- public int getPageSize() {
- return pageSize;
- }
-
- public int getPageNum() {
- return pageNum;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/page/ProcessedPageInfo.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/ProcessedPageInfo.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/page/ProcessedPageInfo.java
deleted file mode 100644
index d454e69..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/ProcessedPageInfo.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.page;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- */
-public class ProcessedPageInfo extends PageInfo {
-
- protected int totalPages;
- protected int numOfHits;
-
- public ProcessedPageInfo(int pageSize, int pageNum, int numOfHits) {
- super(pageSize, pageNum > ((int) Math.ceil((double) numOfHits / (double) pageSize)) ? ((int) Math.ceil((double) numOfHits / (double) pageSize)) : pageNum);
- this.totalPages = ((int) Math.ceil((double) numOfHits / (double) pageSize));
- this.numOfHits = numOfHits;
- }
-
- public int getTotalPages() {
- return this.totalPages;
- }
-
- public int getNumOfHits() {
- return this.numOfHits;
- }
-
- public boolean isLastPage() {
- return this.pageNum >= this.totalPages;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/page/QueryPager.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/QueryPager.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/page/QueryPager.java
deleted file mode 100644
index 59ff1f5..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/QueryPager.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.page;
-
-//JDK imports
-import java.util.Collections;
-import java.util.List;
-import java.util.Vector;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A pager for paging through query results
- * <p>
- */
-public class QueryPager extends IndexPager {
-
- protected List<TransactionReceipt> receipts;
-
- public QueryPager(List<TransactionReceipt> receipts) {
- super();
- this.receipts = new Vector<TransactionReceipt>(receipts);
- this.totalPages = this.caculateTotalPages();
- this.numOfHits = receipts.size();
- }
-
- protected int caculateTotalPages() {
- return (int) Math.ceil((double) receipts.size() / (double) this.getPageSize());
- }
-
- public void setPageInfo(PageInfo pageInfo) {
- this.pageSize = Math.max(pageInfo.getPageSize(), 0);
- this.totalPages = this.caculateTotalPages();
- if (this.totalPages == 0) {
- this.pageNum = 0;
- } else {
- this.pageNum = (pageInfo.getPageNum() == PageInfo.LAST_PAGE || pageInfo.getPageNum() >= this.totalPages)
- ? this.totalPages : pageInfo.getPageNum();
- }
- }
-
- public List<TransactionReceipt> getTransactionReceipts() {
- return Collections.unmodifiableList(this.receipts);
- }
-
- public List<TransactionReceipt> getCurrentPage() {
- List<TransactionReceipt> currentPage = new Vector<TransactionReceipt>();
- if (this.pageNum > 0) {
- for (int i = (this.getPageNum() - 1) * this.getPageSize();
- i < receipts.size() && i < this.getPageNum() * this.getPageSize(); i++) {
- currentPage.add(receipts.get(i));
- }
- }
- return currentPage;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/page/TransactionReceipt.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/TransactionReceipt.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/page/TransactionReceipt.java
deleted file mode 100644
index 9dfa440..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/TransactionReceipt.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.page;
-
-//JDK imports
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.Vector;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.struct.TransactionId;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A Reciept created by performing a transaction with a CatalogService
- * <p>
- */
-public class TransactionReceipt {
-
- protected TransactionId<?> transactionId;
- protected Set<String> catalogIds;
- protected Date transactionDate;
- protected Vector<CatalogReceipt> catalogReceipts;
-
- public TransactionReceipt(TransactionId<?> transactionId, List<CatalogReceipt> catalogReceipts) {
- this.transactionId = transactionId;
- this.catalogIds = new HashSet<String>();
- this.catalogReceipts = new Vector<CatalogReceipt>(catalogReceipts);
- for (CatalogReceipt catalogReceipt : catalogReceipts) {
- this.catalogIds.add(catalogReceipt.getCatalogId());
- if (this.transactionDate == null) {
- this.transactionDate = catalogReceipt.getTransactionDate();
- } else if (this.transactionDate.before(catalogReceipt.getTransactionDate())) {
- this.transactionDate = catalogReceipt.getTransactionDate();
- }
- }
- }
-
- public TransactionId<?> getTransactionId() {
- return this.transactionId;
- }
-
- public Set<String> getCatalogIds() {
- return this.catalogIds;
- }
-
- public Date getTransactionDate() {
- return this.transactionDate;
- }
-
- public List<CatalogReceipt> getCatalogReceipts() {
- return Collections.unmodifiableList(this.catalogReceipts);
- }
-
- public int hashCode() {
- return this.transactionId.hashCode();
- }
-
- public boolean equals(Object obj) {
- if (obj instanceof TransactionReceipt) {
- return this.transactionId.equals(((TransactionReceipt) obj).transactionId);
- }else {
- return false;
- }
- }
-
- public String toString() {
- return this.transactionId + ":" + this.catalogIds;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/query/ComparisonQueryExpression.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/ComparisonQueryExpression.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/ComparisonQueryExpression.java
deleted file mode 100644
index 049e821..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/ComparisonQueryExpression.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.query;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A TermQueryExpression which allows Term comparison
- * <p>
- */
-public class ComparisonQueryExpression extends TermQueryExpression {
-
- public enum Operator { EQUAL_TO("=="), LESS_THAN_EQUAL_TO("<="), GREATER_THAN_EQUAL_TO(">="), LESS_THAN("<"), GREATER_THAN(">"), LIKE("LIKE");
-
- private String value;
-
- Operator(String value) {
- this.value = value;
- }
-
- public static Operator getOperatorBySign(String sign) {
- if (EQUAL_TO.value.equals(sign)) {
- return EQUAL_TO;
- } else if (LESS_THAN_EQUAL_TO.value.equals(sign)) {
- return LESS_THAN_EQUAL_TO;
- } else if (GREATER_THAN_EQUAL_TO.value.equals(sign)) {
- return GREATER_THAN_EQUAL_TO;
- } else if (LESS_THAN.value.equals(sign)) {
- return LESS_THAN;
- } else if (GREATER_THAN.value.equals(sign)) {
- return GREATER_THAN;
- } else if (LIKE.value.equals(sign)) {
- return LIKE;
- } else {
- throw new IllegalArgumentException("Not matching operator for '" + sign + "'");
- }
- }
-
- public String toString() {
- return this.value;
- }
-
- }
- protected Operator operator;
-
- public void setOperator(Operator operator) {
- this.operator = operator;
- }
-
- public Operator getOperator() {
- return this.operator;
- }
-
- @Override
- public String toString() {
- return "({" + this.bucketNames + "} " + this.getTerm().getName() + " " + this.operator + " " + this.getTerm().getValues() + ")";
- }
-
- @Override
- public ComparisonQueryExpression clone() {
- ComparisonQueryExpression newQE = new ComparisonQueryExpression();
- newQE.operator = this.operator;
- newQE.setTerm(this.term.clone());
- newQE.setBucketNames(this.getBucketNames());
- return newQE;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/query/CustomQueryExpression.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/CustomQueryExpression.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/CustomQueryExpression.java
deleted file mode 100644
index 544ef35..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/CustomQueryExpression.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.query;
-
-//JDK imports
-import java.util.Properties;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A Configurable QueryExpression
- * <p>
- */
-public class CustomQueryExpression extends QueryExpression {
-
- protected Properties properties;
- protected String name;
-
- public CustomQueryExpression(String name) {
- this(name, new Properties());
- }
-
- public CustomQueryExpression(String name, Properties properties) {
- super();
- this.name = name;
- if (properties != null) {
- this.properties = properties;
- } else {
- this.properties = new Properties();
- }
- }
-
- public String getName() {
- return this.name;
- }
-
- public void setProperty(String key, String value) {
- this.properties.put(key, value);
- }
-
- public String getProperty(String key) {
- return this.properties.getProperty(key);
- }
-
- @Override
- public CustomQueryExpression clone() {
- CustomQueryExpression cqe = new CustomQueryExpression(this.name, (Properties) this.properties.clone());
- cqe.setBucketNames(this.getBucketNames());
- return cqe;
- }
-
- @Override
- public String toString() {
- return "({" + this.bucketNames + "} " + this.name + " : " + this.properties.toString() + ")";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/query/CustomWrapperQueryExpression.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/CustomWrapperQueryExpression.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/CustomWrapperQueryExpression.java
deleted file mode 100644
index 8a621fd..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/CustomWrapperQueryExpression.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.query;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- */
-public class CustomWrapperQueryExpression extends WrapperQueryExpression {
-
- protected String meaning;
-
- public CustomWrapperQueryExpression(String meaning) {
- this.meaning = meaning;
- }
-
- public CustomWrapperQueryExpression(String meaning, QueryExpression queryExpression) {
- super(queryExpression);
- this.meaning = meaning;
- }
-
- public String getMeaning() {
- return this.meaning;
- }
-
- @Override
- public CustomWrapperQueryExpression clone() {
- CustomWrapperQueryExpression cwqe = new CustomWrapperQueryExpression(this.meaning, this.queryExpression.clone());
- cwqe.setBucketNames(this.bucketNames);
- return cwqe;
- }
-
- @Override
- public String toString() {
- return "({" + this.bucketNames + "} " + this.meaning + "(" + this.queryExpression + "))";
- }
-
- @Override
- public boolean isValidWithNoSubExpression() {
- return false;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/query/FreeTextQueryExpression.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/FreeTextQueryExpression.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/FreeTextQueryExpression.java
deleted file mode 100644
index 01142a4..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/FreeTextQueryExpression.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.query;
-
-//JDK imports
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.StringTokenizer;
-import java.util.Vector;
-
-/**
- * @author woollard
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A Free Text TermQueryExpression
- * </p>
- *
- */
-public class FreeTextQueryExpression extends TermQueryExpression {
-
- private HashSet<String> noiseWordHash = new HashSet<String>(
- Arrays.asList(new String[] { "a", "all", "am", "an", "and",
- "any", "are", "as", "at", "be", "but", "can", "did", "do", "does",
- "for", "from", "had", "has", "have", "here", "how", "i", "if",
- "in", "is", "it", "no", "not", "of", "on", "or", "so", "that",
- "the", "then", "there", "this", "to", "too", "up", "use", "what",
- "when", "where", "who", "why", "you" }));
-
- /**
- * A method for adding unparsed free text to the FreeTextCriteria. Free text
- * entered as a string is tokenized and punctuation and common words are
- * dropped before the values are added to the query. In order to query for
- * pre-parsed keywords, see the setValues method of this class.
- *
- * @param text
- * The free text to be parsed and searched on.
- */
- public void addFreeText(String text) {
- // remove punctuation from the text
- text = text.replaceAll("\\p{Punct}+", "");
-
- // tokenize string using default delimiters
- StringTokenizer tok = new StringTokenizer(text);
- String token;
-
- // filter noise words and add to values vector
- List<String> values = new Vector<String>();
- while (tok.hasMoreElements()) {
- token = tok.nextToken();
- if (!noiseWordHash.contains(token)) {
- values.add(token);
- }
- }
- if (values.size() > 0) {
- values.addAll(this.term.getValues());
- this.term.setValues(values);
- }
- }
-
- /**
- * Implementation of the abstract method inherited from QueryCriteria for
- * generating a human-parsable string version of the query criteria. Note
- * that the returned String follows the Lucene query language.
- *
- * @return The query as a String.
- */
- public String toString() {
- StringBuilder serial = new StringBuilder();
- serial.append("({").append(this.bucketNames).append("} ").append(this.term.getName()).append(" :|");
- for (String value : this.term.getValues()) {
- serial.append("+").append(value);
- serial.append("|: )");
- }
- return serial.toString();
- }
-
- @Override
- public FreeTextQueryExpression clone() {
- FreeTextQueryExpression ftQE = new FreeTextQueryExpression();
- ftQE.noiseWordHash = new HashSet<String>(this.noiseWordHash);
- ftQE.setTerm(this.term.clone());
- ftQE.setBucketNames(this.bucketNames);
- return ftQE;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/query/NotQueryExpression.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/NotQueryExpression.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/NotQueryExpression.java
deleted file mode 100644
index 3609dfc..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/NotQueryExpression.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.query;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A WrapperQueryExpression which signifies negation of wrapped QueryExpression
- * <p>
- */
-public class NotQueryExpression extends WrapperQueryExpression {
-
- public NotQueryExpression() {
- super();
- }
-
- public NotQueryExpression(QueryExpression queryExpression) {
- super(queryExpression);
- }
-
- @Override
- public NotQueryExpression clone() {
- NotQueryExpression nqe = new NotQueryExpression(this.queryExpression.clone());
- nqe.setBucketNames(this.getBucketNames());
- return nqe;
- }
-
- @Override
- public String toString() {
- return "(NOT (" + this.queryExpression + "))";
- }
-
- @Override
- public boolean isValidWithNoSubExpression() {
- return false;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/query/QueryExpression.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/QueryExpression.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/QueryExpression.java
deleted file mode 100644
index c8ef02a..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/QueryExpression.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.query;
-
-//JDK imports
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A Expression for querying against a CatalogServices Metadata
- * <p>
- */
-public abstract class QueryExpression implements Cloneable {
-
- protected Set<String> bucketNames;
-
- public QueryExpression() {}
-
- public QueryExpression(Set<String> bucketNames) {
- this.bucketNames = new HashSet<String>(bucketNames);
- }
-
- public Set<String> getBucketNames() {
- return (this.bucketNames != null) ? new HashSet<String>(this.bucketNames) : null;
- }
-
- public void setBucketNames(Set<String> bucketNames) {
- this.bucketNames = bucketNames;
- }
-
- public abstract String toString();
-
- public abstract QueryExpression clone();
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/query/QueryLogicalGroup.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/QueryLogicalGroup.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/QueryLogicalGroup.java
deleted file mode 100644
index 1a1fdac..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/QueryLogicalGroup.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.query;
-
-//JDK imports
-import java.util.Collections;
-import java.util.List;
-import java.util.Vector;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A QueryExpression which groups other QueryExpressions
- * <p>
- */
-public class QueryLogicalGroup extends QueryExpression {
-
- public enum Operator { AND, OR }
-
- protected Operator operator;
-
- protected List<QueryExpression> queryExpressions;
-
- public QueryLogicalGroup() {
- this(new Vector<QueryExpression>(), Operator.AND);
- }
-
- public QueryLogicalGroup(List<QueryExpression> queryExpressions) {
- this(queryExpressions, Operator.AND);
- }
-
- public QueryLogicalGroup(List<QueryExpression> queryExpressions, Operator operator) {
- this.setExpressions(queryExpressions);
- this.setOperator(operator);
- }
-
- public void setExpressions(List<QueryExpression> queryExpressions) {
- this.queryExpressions = new Vector<QueryExpression>(queryExpressions);
- }
-
- /**
- *
- * @param queryExpression
- */
- public void addExpression(QueryExpression queryExpression) {
- this.queryExpressions.add(queryExpression);
- }
-
- /**
- *
- * @param queryExpressions
- */
- public void addExpressions(List<QueryExpression> queryExpressions) {
- this.queryExpressions.addAll(queryExpressions);
- }
-
- /**
- *
- * @return
- */
- public List<QueryExpression> getExpressions() {
- return Collections.unmodifiableList(this.queryExpressions);
- }
-
- /**
- *
- * @param operator
- */
- public void setOperator(Operator operator) {
- this.operator = operator;
- }
-
- /**
- *
- * @return
- */
- public Operator getOperator() {
- return this.operator;
- }
-
- @Override
- public String toString() {
- StringBuilder query = new StringBuilder();
- query.append("({").append(this.bucketNames).append("} ").append(this.operator).append(" : ");
- for (QueryExpression queryExpression : this.queryExpressions) {
- query.append(queryExpression.toString()).append(",");
- }
- return query.substring(0, query.length() - 1) + ")";
- }
-
- public QueryLogicalGroup clone() {
- QueryLogicalGroup qlGroup = new QueryLogicalGroup();
- qlGroup.setBucketNames(this.getBucketNames());
- qlGroup.setOperator(this.operator);
- for (QueryExpression qe : this.queryExpressions) {
- qlGroup.addExpression(qe.clone());
- }
- return qlGroup;
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/query/StdQueryExpression.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/StdQueryExpression.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/StdQueryExpression.java
deleted file mode 100644
index 4353d4c..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/StdQueryExpression.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.query;
-
-//JDK imports
-import java.util.Set;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A Standard QueryExpression
- * <p>
- */
-public class StdQueryExpression extends QueryExpression {
-
- public StdQueryExpression() {
- super();
- }
-
- public StdQueryExpression(Set<String> bucketNames) {
- super(bucketNames);
- }
-
- @Override
- public StdQueryExpression clone() {
- return new StdQueryExpression(this.getBucketNames());
- }
-
- @Override
- public String toString() {
- return "({" + this.bucketNames + "})";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/query/TermQueryExpression.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/TermQueryExpression.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/TermQueryExpression.java
deleted file mode 100644
index b551126..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/TermQueryExpression.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.query;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.term.Term;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A QueryExpression which wrappers a Term
- * <p>
- */
-public abstract class TermQueryExpression extends QueryExpression implements Cloneable {
-
- protected Term term;
-
- public Term getTerm() {
- return this.term;
- }
-
- public void setTerm(Term term) {
- this.term = term;
- }
-
- public abstract TermQueryExpression clone();
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/query/WrapperQueryExpression.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/WrapperQueryExpression.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/WrapperQueryExpression.java
deleted file mode 100644
index a11c627..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/WrapperQueryExpression.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.query;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A QueryExpression which wrappers another QueryExpression
- * <p>
- */
-public abstract class WrapperQueryExpression extends QueryExpression {
-
- protected QueryExpression queryExpression;
-
- public WrapperQueryExpression() {
- super();
- }
-
- public WrapperQueryExpression(QueryExpression queryExpression) {
- this();
- this.queryExpression = queryExpression;
- }
-
- public QueryExpression getQueryExpression() {
- return queryExpression;
- }
-
- public void setQueryExpression(QueryExpression queryExpression) {
- this.queryExpression = queryExpression;
- }
-
- @Override
- public String toString() {
- return "(" + this.queryExpression + ")";
- }
-
- public abstract boolean isValidWithNoSubExpression();
-
- public abstract WrapperQueryExpression clone();
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/FilterAlgorithm.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/FilterAlgorithm.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/FilterAlgorithm.java
deleted file mode 100644
index c3b99e1..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/FilterAlgorithm.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.query.filter;
-
-//JDK imports
-import java.util.List;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * An algorithm interface for defining how QueryFilter filters query results
- * <p>
- */
-public abstract class FilterAlgorithm<FilterType> {
-
- public abstract List<FilterType> filter(List<FilterType> events);
-
-}
[11/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/TestJschSftpProtocol.java
----------------------------------------------------------------------
diff --git a/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/TestJschSftpProtocol.java b/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/TestJschSftpProtocol.java
deleted file mode 100644
index 2cdd2eb..0000000
--- a/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/TestJschSftpProtocol.java
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.sftp;
-
-//JUnit imports
-
-import org.apache.commons.io.FileUtils;
-import org.apache.mina.util.AvailablePortFinder;
-import org.apache.oodt.cas.protocol.ProtocolFile;
-import org.apache.oodt.cas.protocol.exceptions.ProtocolException;
-import org.apache.oodt.cas.protocol.sftp.auth.HostKeyAuthentication;
-import org.apache.oodt.cas.protocol.util.ProtocolFileFilter;
-
-import com.sshtools.daemon.SshDaemon;
-import com.sshtools.daemon.configuration.PlatformConfiguration;
-import com.sshtools.daemon.configuration.ServerConfiguration;
-import com.sshtools.daemon.configuration.XmlServerConfigurationContext;
-import com.sshtools.j2ssh.configuration.ConfigurationException;
-import com.sshtools.j2ssh.configuration.ConfigurationLoader;
-
-import org.mockito.Mockito;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
-import org.xml.sax.SAXException;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintStream;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.xml.parsers.ParserConfigurationException;
-
-import junit.framework.TestCase;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
-
-//JAVAX imports
-//OODT imports
-//SshTools imports
-//JUnit imports
-
-/**
- * Test class for {@link JschSftpProtocol}.
- *
- * @author bfoster
- */
-public class TestJschSftpProtocol extends TestCase {
-
- static TestXmlServerConfigurationContext context;
- static final Logger LOG = Logger.getLogger(TestJschSftpProtocol.class.getName());
- static Thread thread;
- File publicKeysDir;
-
- @Override
- public void setUp() {
- try {
- publicKeysDir = new File("src/test/resources/publicKeys");
- publicKeysDir.mkdirs();
- FileUtils.forceDeleteOnExit(publicKeysDir);
- FileUtils.copyFile(new File("src/test/resources/authorization.xml"), new File("src/test/resources/publicKeys/authorization.xml"));
- FileUtils.copyFile(new File("src/test/resources/server.xml"), new File("src/test/resources/publicKeys/server.xml"));
- FileUtils.copyFile(new File("src/test/resources/platform.xml"), new File("src/test/resources/publicKeys/platform.xml"));
- ConfigurationLoader.initialize(true, context = new TestXmlServerConfigurationContext());
- } catch (Exception e) {
- fail("Failed to initialize server configuration");
- }
-
- (thread = new Thread(new Runnable() {
- public void run() {
- try {
- SshDaemon.start();
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- }
- }
-
- })).start();
- }
-
- @Override
- public void tearDown() throws IOException {
- FileUtils.forceDelete(publicKeysDir);
- SshDaemon.stop("");
- }
-
- public void testCDandPWDandLS() throws IOException, ProtocolException {
- int port = context.getPort();
- File pubKeyFile = createPubKeyForPort(port);
- JschSftpProtocol sftpProtocol = spy(new JschSftpProtocol(port));
- Mockito.doAnswer(new Answer() {
- public Object answer(InvocationOnMock invocation) {
- return null;
- }}).when(sftpProtocol).connect("localhost", new HostKeyAuthentication("bfoster", "",
- pubKeyFile.getAbsoluteFile().getAbsolutePath()));
-
- sftpProtocol.connect("localhost", new HostKeyAuthentication("bfoster", "",
- pubKeyFile.getAbsoluteFile().getAbsolutePath()));
- ProtocolFile homeDir = sftpProtocol.pwd();
- ProtocolFile testDir = new ProtocolFile(homeDir, "sshTestDir", true);
- sftpProtocol.cd(testDir);
-
- Mockito.when(sftpProtocol.pwd()).thenReturn(new ProtocolFile(homeDir, "sshTestDir", true));
-
-
- assertEquals(testDir, sftpProtocol.pwd());
- List<ProtocolFile> lsResults = new ArrayList<ProtocolFile>(
- sftpProtocol.ls(new ProtocolFileFilter() {
- public boolean accept(ProtocolFile file) {
- return file.getName().equals("sshTestFile");
- }
- }));
- assertEquals(1, lsResults.size());
- ProtocolFile testFile = lsResults.get(0);
- ProtocolFile testnew = new ProtocolFile(testDir, "sshTestFile", false);
- assertEquals(new ProtocolFile(null, testDir.getPath()+"/sshTestFile", false), testFile);
- }
-
- public void testGET() throws ProtocolException, IOException {
- int port = context.getPort();
- File pubKeyFile = createPubKeyForPort(port);
- //JschSftpProtocol sftpProtocol = new JschSftpProtocol(port);
- JschSftpProtocol mockc = mock(JschSftpProtocol.class);
-
- Mockito.doAnswer(new Answer() {
- public Object answer(InvocationOnMock invocation) {
- return null;
- }}).when(mockc).connect("localhost", new HostKeyAuthentication("bfoster", "",
- pubKeyFile.getAbsoluteFile().getAbsolutePath()));
- mockc.connect("localhost", new HostKeyAuthentication("bfoster", "",
- pubKeyFile.getAbsoluteFile().getAbsolutePath()));
-
-
- File bogusFile = File.createTempFile("bogus", "bogus");
- final File tmpFile = new File(bogusFile.getParentFile(), "TestJschSftpProtocol");
- bogusFile.delete();
- tmpFile.mkdirs();
- mockc.cd(new ProtocolFile("sshTestDir", true));
- File testDownloadFile = new File(tmpFile, "testDownloadFile");
-
- Mockito.doAnswer(new Answer(){
- public Object answer(InvocationOnMock invocationOnMock) throws IOException {
-
- PrintWriter writer = new PrintWriter(tmpFile+"/testDownloadFile", "UTF-8");
- writer.print(readFile("src/test/resources/sshTestDir/sshTestFile"));
- writer.close();
-
- return null;
- }
- }).when(mockc).get(new ProtocolFile("sshTestFile", false), testDownloadFile);
-
-
- mockc.get(new ProtocolFile("sshTestFile", false), testDownloadFile);
-
- assertTrue(FileUtils.contentEquals(new File("src/test/resources/sshTestDir/sshTestFile"), testDownloadFile));
-
- FileUtils.forceDelete(tmpFile);
- }
-
- public String readFile(String path){
- BufferedReader buffReader = null;
- try{
- buffReader = new BufferedReader (new FileReader(path));
- String line = buffReader.readLine();
- StringBuilder build = new StringBuilder();
- while(line != null){
- build.append(line);
- build.append("\n");
- System.out.println(line);
- line = buffReader.readLine();
-
-
- }
- return build.toString();
- }catch(IOException ioe){
- LOG.log(Level.SEVERE, ioe.getMessage());
- }finally{
- try{
- buffReader.close();
- }catch(IOException ioe1){
- //Leave It
- }
-
- }
- return path;
- }
-
- private static class TestServerConfiguration extends ServerConfiguration {
-
- int commandPort = AvailablePortFinder.getNextAvailable(12222);
- int port = AvailablePortFinder.getNextAvailable(2022);
-
- public TestServerConfiguration(InputStream is) throws SAXException,
- ParserConfigurationException, IOException {
- super(is);
- }
-
- @Override
- public int getCommandPort() {
- return commandPort;
- }
-
- @Override
- public int getPort() {
- return port;
- }
- }
-
- private static class TestXmlServerConfigurationContext extends XmlServerConfigurationContext {
-
- private TestServerConfiguration serverConfig;
- private PlatformConfiguration platformConfig;
-
- public TestXmlServerConfigurationContext() {
- super();
- }
-
- @Override
- public void initialize() throws ConfigurationException {
- try {
- serverConfig = new TestServerConfiguration(ConfigurationLoader.loadFile("src/test/resources/publicKeys/server.xml"));
- } catch (Exception e) {
- throw new ConfigurationException(e.getMessage());
- }
- try {
- platformConfig = new PlatformConfiguration(ConfigurationLoader.loadFile("src/test/resources/publicKeys/platform.xml")) {};
- } catch (Exception e) {
- throw new ConfigurationException(e.getMessage());
- }
- }
-
- @Override
- public boolean isConfigurationAvailable(@SuppressWarnings("rawtypes") Class cls) {
- try {
- getConfiguration(cls);
- return true;
- } catch (Exception e) {
- return false;
- }
- }
-
- @Override
- public Object getConfiguration(@SuppressWarnings("rawtypes") Class cls) throws ConfigurationException {
- if (ServerConfiguration.class.equals(cls)) {
- return serverConfig;
- } else if (PlatformConfiguration.class.equals(cls)) {
- return platformConfig;
- } else {
- throw new ConfigurationException(cls.getName()
- + " configuration not available");
- }
- }
-
- public int getPort() {
- return serverConfig.getPort();
- }
- }
-
- private File createPubKeyForPort(int port) throws IOException {
- PrintStream ps = null;
- BufferedReader br = null;
- try {
- File publicKeyFile = new File(publicKeysDir, "sample-dsa.pub");
- br = new BufferedReader(new FileReader(new File("src/test/resources/sample-dsa.pub").getAbsoluteFile()));
- ps = new PrintStream(new FileOutputStream(publicKeyFile));
- String nextLine;
- while ((nextLine = br.readLine()) != null) {
- ps.println(nextLine.replace("2022", Integer.toString(port)));
- }
- return publicKeyFile;
- } finally {
- try { ps.close(); } catch (Exception ignored) {}
- try { br.close(); } catch (Exception ignored) {}
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/UnsupportedShellProcessProvider.java
----------------------------------------------------------------------
diff --git a/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/UnsupportedShellProcessProvider.java b/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/UnsupportedShellProcessProvider.java
deleted file mode 100644
index 9e784b8..0000000
--- a/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/UnsupportedShellProcessProvider.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.sftp;
-
-//JDK imports
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Map;
-
-//SshTools imports
-import com.sshtools.daemon.platform.NativeProcessProvider;
-import com.sshtools.j2ssh.io.DynamicBuffer;
-
-/**
- * This is a shell provider that prints a message saying that we don't support
- * shell access, and then closes the connection.
- */
-public final class UnsupportedShellProcessProvider extends
- NativeProcessProvider {
-
- private static final String MESSAGE = "This server does not provide shell access, only SFTP. Goodbye.\n";
-
- private DynamicBuffer stdin = new DynamicBuffer();
- private DynamicBuffer stderr = new DynamicBuffer();
- private DynamicBuffer stdout = new DynamicBuffer();
-
- @Override
- public boolean createProcess(final String command, final Map environment)
- throws IOException {
- return true;
- }
-
- @Override
- public String getDefaultTerminalProvider() {
- return "UnsupportedShell";
- }
-
- @Override
- public void kill() {
- try {
- stdin.getInputStream().close();
- stdin.getOutputStream().close();
- } catch (Exception ignored) {
- }
- try {
- stdout.getInputStream().close();
- stdout.getOutputStream().close();
- } catch (Exception ignored) {
- }
- try {
- stderr.getInputStream().close();
- stderr.getOutputStream().close();
- } catch (Exception ignored) {
- }
- }
-
- @Override
- public void start() throws IOException {
- stdin.getOutputStream().write(MESSAGE.getBytes());
- }
-
- @Override
- public boolean stillActive() {
- try {
- return stdin.getInputStream().available() > 0;
- } catch (IOException ex) {
- return false;
- }
- }
-
- @Override
- public boolean supportsPseudoTerminal(final String term) {
- return true;
- }
-
- @Override
- public boolean allocatePseudoTerminal(final String term, final int cols,
- final int rows, final int width, final int height, final String modes) {
- return true;
- }
-
- @Override
- public int waitForExitCode() {
- return 0;
- }
-
- public InputStream getInputStream() throws IOException {
- return stdin.getInputStream();
- }
-
- public OutputStream getOutputStream() throws IOException {
- return stdout.getOutputStream();
- }
-
- public InputStream getStderrInputStream() {
- return stderr.getInputStream();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/auth/TestHostKeyAuthentication.java
----------------------------------------------------------------------
diff --git a/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/auth/TestHostKeyAuthentication.java b/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/auth/TestHostKeyAuthentication.java
deleted file mode 100644
index 5dbb514..0000000
--- a/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/auth/TestHostKeyAuthentication.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.sftp.auth;
-
-//JUnit imports
-import junit.framework.TestCase;
-
-/**
- * Test class for {@link HostKeyAuthentication}.
- *
- * @author bfoster
- */
-public class TestHostKeyAuthentication extends TestCase {
-
- public void testInitialState() {
- HostKeyAuthentication auth = new HostKeyAuthentication("user", "pass", "file");
- assertEquals("user", auth.getUser());
- assertEquals("pass", auth.getPass());
- assertEquals("file", auth.getHostKeyFile());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/sftp/src/test/resources/authorization.xml
----------------------------------------------------------------------
diff --git a/protocol/sftp/src/test/resources/authorization.xml b/protocol/sftp/src/test/resources/authorization.xml
deleted file mode 100644
index da00e69..0000000
--- a/protocol/sftp/src/test/resources/authorization.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<!-- Sshtools User Authorization File -->
-<AuthorizedKeys>
- <!-- Enter authorized public key elements here -->
- <Key>sample-dsa.pub</Key>
-
-</AuthorizedKeys>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/sftp/src/test/resources/platform.xml
----------------------------------------------------------------------
diff --git a/protocol/sftp/src/test/resources/platform.xml b/protocol/sftp/src/test/resources/platform.xml
deleted file mode 100644
index b0f93af..0000000
--- a/protocol/sftp/src/test/resources/platform.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!--
-Platform configuration file - Determines the behaviour of platform specific services
--->
-<PlatformConfiguration>
- <!-- The process provider for executing and redirecting a process -->
- <NativeProcessProvider>org.apache.oodt.cas.protocol.sftp.UnsupportedShellProcessProvider</NativeProcessProvider>
- <!-- The authentication provider for authenticating users and obtaining user information -->
- <!--
- WARNING: the dummy provider here doesn't ask for any passwords so obviously it's
- extremely insecure. You should only use it for testing.
- -->
- <NativeAuthenticationProvider>org.apache.oodt.cas.protocol.sftp.DummyAuthenticationProvider</NativeAuthenticationProvider>
- <!-- The file system provider for SFTP -->
- <NativeFileSystemProvider>com.sshtools.daemon.vfs.VirtualFileSystem</NativeFileSystemProvider>
- <!-- Native settings which may be used by the process or authentication provider -->
- <!-- Add native settings here -->
- <!-- <NativeSetting Name="AuthenticateOnDomain" Value="."/> -->
-</PlatformConfiguration>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/sftp/src/test/resources/sample-dsa.key
----------------------------------------------------------------------
diff --git a/protocol/sftp/src/test/resources/sample-dsa.key b/protocol/sftp/src/test/resources/sample-dsa.key
deleted file mode 100644
index ad94854..0000000
--- a/protocol/sftp/src/test/resources/sample-dsa.key
+++ /dev/null
@@ -1,12 +0,0 @@
------BEGIN DSA PRIVATE KEY-----
-MIIBvAIBAAKBgQD/dvNwGfLUx8hRXmJRN/zEvlrUVgOPuYao0JQfcdwz4Zqi/kDq
-+4I/GsGphw8v/pI0g0N5jHiiGQ+apVoSOXoYgrW6YNKHIpmBvM1zVQWA33bAqq/+
-+k+9Bugp8xvAA5AXUrPdRKQiKYC5ECYX/lIDZCSgty6QrQSnhmAECdm6mQIVAO/1
-X4nkLhL4jwhOGMUmuTVOQxwJAoGBAMi/2mkZc1Aj7FQCJsv/j/Th9eYLYJ1JaeFm
-iYhfkggMfoKyfWlEEjll56UThZL+ZyC2WVUUWDuTrt77zVPUGxEFM2gwL9judLaq
-lV+rOFrwf5LcaQnSoNHWrkf2MUy+juinZFHN/2eI+mQXv0/07IQjbCDAH0U1rr97
-Qxw9Saa3AoGAVMOH1a6meQj4pzZZ9BEkFVVQAuC+DBqxZND2flxIMnO/Z9si1Znw
-0z0ClXXY5vpk1DQJ2FI60aufqYgg/2UhQNjTp37DKL6sk4aK25wwXLWbuaf6b9Ah
-IFwU+g5xSm0j12P40AqaNIhLoCv2FPXSHvnJDsZw3r703ITUB+hwlEwCFQCjIrDI
-YOzgRFkXJwfZCKVpo3L1JA==
------END DSA PRIVATE KEY-----
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/sftp/src/test/resources/sample-dsa.pub
----------------------------------------------------------------------
diff --git a/protocol/sftp/src/test/resources/sample-dsa.pub b/protocol/sftp/src/test/resources/sample-dsa.pub
deleted file mode 100644
index 9a1c9b6..0000000
--- a/protocol/sftp/src/test/resources/sample-dsa.pub
+++ /dev/null
@@ -1 +0,0 @@
-[localhost]:2022 ssh-dss AAAAB3NzaC1kc3MAAACBAP9283AZ8tTHyFFeYlE3/MS+WtRWA4+5hqjQlB9x3DPhmqL+QOr7gj8awamHDy/+kjSDQ3mMeKIZD5qlWhI5ehiCtbpg0ocimYG8zXNVBYDfdsCqr/76T70G6CnzG8ADkBdSs91EpCIpgLkQJhf+UgNkJKC3LpCtBKeGYAQJ2bqZAAAAFQDv9V+J5C4S+I8IThjFJrk1TkMcCQAAAIEAyL/aaRlzUCPsVAImy/+P9OH15gtgnUlp4WaJiF+SCAx+grJ9aUQSOWXnpROFkv5nILZZVRRYO5Ou3vvNU9QbEQUzaDAv2O50tqqVX6s4WvB/ktxpCdKg0dauR/YxTL6O6KdkUc3/Z4j6ZBe/T/TshCNsIMAfRTWuv3tDHD1JprcAAACAVMOH1a6meQj4pzZZ9BEkFVVQAuC+DBqxZND2flxIMnO/Z9si1Znw0z0ClXXY5vpk1DQJ2FI60aufqYgg/2UhQNjTp37DKL6sk4aK25wwXLWbuaf6b9AhIFwU+g5xSm0j12P40AqaNIhLoCv2FPXSHvnJDsZw3r703ITUB+hwlEw=
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/sftp/src/test/resources/server.xml
----------------------------------------------------------------------
diff --git a/protocol/sftp/src/test/resources/server.xml b/protocol/sftp/src/test/resources/server.xml
deleted file mode 100644
index b690761..0000000
--- a/protocol/sftp/src/test/resources/server.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<ServerConfiguration>
- <!-- this key needs generating by the provided keygen tool -->
- <ServerHostKey PrivateKeyFile="src/test/resources/sample-dsa.key"/>
- <!-- Port>2023</Port -->
- <!-- UserConfigDirectory>src/test/resources</UserConfigDirectory -->
- <!-- add other authentication methods as desired -->
- <AllowedAuthentication>password</AllowedAuthentication>
- <AllowedAuthentication>keyboard-interactive</AllowedAuthentication>
- <!-- You can specify more subsystems, or even a replacement SFTP subsystem -->
- <Subsystem Name="sftp" Type="class" Provider="com.sshtools.daemon.sftp.SftpSubsystemServer" />
-</ServerConfiguration>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/sftp/src/test/resources/sshTestDir/sshTestFile
----------------------------------------------------------------------
diff --git a/protocol/sftp/src/test/resources/sshTestDir/sshTestFile b/protocol/sftp/src/test/resources/sshTestDir/sshTestFile
deleted file mode 100644
index 2556d55..0000000
--- a/protocol/sftp/src/test/resources/sshTestDir/sshTestFile
+++ /dev/null
@@ -1,18 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-This is a
-test
-File
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/pom.xml
----------------------------------------------------------------------
diff --git a/pushpull/pom.xml b/pushpull/pom.xml
deleted file mode 100644
index a451ce2..0000000
--- a/pushpull/pom.xml
+++ /dev/null
@@ -1,181 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.oodt</groupId>
- <artifactId>oodt-core</artifactId>
- <version>1.1-SNAPSHOT</version>
- <relativePath>../core/pom.xml</relativePath>
- </parent>
- <artifactId>cas-pushpull</artifactId>
- <name>CAS Push-Pull-Framework</name>
- <!-- All dependencies should be listed in core/pom.xml and be ordered alphabetically by package and artifact.
- Once the dependency is in the core pom, it can then be used in other modules without the version tags.
- For example, within core/pom.xml:
-
- <dependency>
- <groupId>com.amazonaws</groupId>
- <artifactId>aws-java-sdk</artifactId>
- <version>1.7.4</version>
- </dependency>
-
- Elsewhere in the platform:
- <dependency>
- <groupId>com.amazonaws</groupId>
- <artifactId>aws-java-sdk</artifactId>
- </dependency>
-
- Where possible the same dependency version should be used across the whole platform but if required the version
- can be overridden in a specific pom and should have a comment explaing why the version has been overridden
- -->
- <dependencies>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <version>10.0.1</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.8.1</version>
- <scope>test</scope>
- </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-metadata</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.oodt</groupId>
- <artifactId>cas-protocol-api</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.oodt</groupId>
- <artifactId>cas-protocol-ftp</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.oodt</groupId>
- <artifactId>cas-protocol-http</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.oodt</groupId>
- <artifactId>cas-protocol-imaps</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.oodt</groupId>
- <artifactId>cas-protocol-sftp</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-all</artifactId>
- <version>1.3</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <version>1.9.5</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>oro</groupId>
- <artifactId>oro</artifactId>
- <version>2.0.8</version>
- </dependency>
- <dependency>
- <groupId>xmlrpc</groupId>
- <artifactId>xmlrpc</artifactId>
- <version>2.0.1</version>
- </dependency>
- </dependencies>
-
- <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.cas.pushpull.daemon.DaemonLauncher</mainClass>
- </manifest>
- </archive>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>single</goal>
- </goals>
- <phase>package</phase>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- <scm>
- <!--<connection>scm:svn:https://svn.apache.org/repos/asf/oodt/trunk/pushpull</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/oodt/trunk/pushpull</developerConnection>
- <url>http://svn.apache.org/viewvc/oodt/trunk/pushpull</url>-->
- <tag>0.13-SNAPSHOT</tag>
- </scm>
- <profiles>
- <profile>
- <id>audit</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>rat-maven-plugin</artifactId>
- <configuration>
- <excludes>
- <exclude>**/resources/examples/**/*</exclude>
- </excludes>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>check</goal>
- </goals>
- <phase>verify</phase>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-</project>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/assembly/assembly.xml
----------------------------------------------------------------------
diff --git a/pushpull/src/main/assembly/assembly.xml b/pushpull/src/main/assembly/assembly.xml
deleted file mode 100644
index 8f5c163..0000000
--- a/pushpull/src/main/assembly/assembly.xml
+++ /dev/null
@@ -1,85 +0,0 @@
-<?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.
--->
-<assembly>
- <id>dist</id>
- <formats>
- <format>tar.gz</format>
- <format>zip</format>
- </formats>
- <includeBaseDirectory>true</includeBaseDirectory>
- <baseDirectory>${project.artifactId}-${project.version}</baseDirectory>
- <includeSiteDirectory>false</includeSiteDirectory>
- <fileSets>
- <fileSet>
- <directory>${basedir}</directory>
- <outputDirectory>.</outputDirectory>
- <includes>
- <include>LICENSE.txt</include>
- <include>CHANGES.txt</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>${basedir}/src/main/bin</directory>
- <outputDirectory>bin</outputDirectory>
- <includes/>
- <fileMode>755</fileMode>
- </fileSet>
- <fileSet>
- <directory>${basedir}/src/main/resources</directory>
- <outputDirectory>etc</outputDirectory>
- <includes>
- <include>*.properties</include>
- <include>jssecacerts</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>${basedir}/src/main/resources/examples</directory>
- <outputDirectory>etc/examples</outputDirectory>
- <excludes/>
- </fileSet>
- <fileSet>
- <directory>${basedir}/src/main/resources</directory>
- <outputDirectory>logs</outputDirectory>
- <includes>
- <include>REMOVE.log</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>${basedir}/src/main/resources/policy</directory>
- <outputDirectory>policy</outputDirectory>
- <includes>
- <include>*.xml</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>target/site/apidocs</directory>
- <filtered>false</filtered>
- <outputDirectory>doc</outputDirectory>
- <excludes/>
- </fileSet>
- </fileSets>
- <dependencySets>
- <dependencySet>
- <outputDirectory>lib</outputDirectory>
- <unpack>false</unpack>
- <useProjectArtifact>true</useProjectArtifact>
- <useTransitiveDependencies>true</useTransitiveDependencies>
- <unpackOptions/>
- </dependencySet>
- </dependencySets>
-</assembly>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/bin/pushpull
----------------------------------------------------------------------
diff --git a/pushpull/src/main/bin/pushpull b/pushpull/src/main/bin/pushpull
deleted file mode 100644
index 62d32eb..0000000
--- a/pushpull/src/main/bin/pushpull
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/csh
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE.txt file distributed with
-# this work for additional information regarding copyright ownership. The ASF
-# licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-set LIB_DEPS
-foreach file (`find ../lib/*.jar`)
- set LIB_DEPS = "${file}:${LIB_DEPS}"
-end
-
-setenv PATH ${JAVA_HOME}/bin:${CAS_PP_HOME}/bin:/usr/bin:/bin:/usr/sbin:/sbin
-
-#execution -- do not set "java.ext.dirs" because it messes up search path for a sftp library
-${JAVA_HOME}/bin/java \
- -cp ${LIB_DEPS} -Dcom.sun.management.jmxremote \
- -Djava.util.logging.config.file=../etc/logging.properties \
- -Djavax.net.ssl.trustStore=${CAS_PP_RESOURCES}/jssecacerts \
- org.apache.oodt.cas.pushpull.daemon.DaemonLauncher \
- --rmiRegistryPort ${DAEMONLAUNCHER_PORT} \
- --propertiesFile ${CAS_PP_RESOURCES}/push_pull_framework.properties \
- --remoteSpecsFile ${CAS_PP_RESOURCES}/examples/RemoteSpecsFiles/RemoteSpecs.xml
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/bin/url-downloader
----------------------------------------------------------------------
diff --git a/pushpull/src/main/bin/url-downloader b/pushpull/src/main/bin/url-downloader
deleted file mode 100644
index 9c71713..0000000
--- a/pushpull/src/main/bin/url-downloader
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/sh
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE.txt file distributed with
-# this work for additional information regarding copyright ownership. The ASF
-# licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-$JAVA_HOME/bin/java -Djava.ext.dirs=../lib \
- -Djava.util.logging.config.file=../etc/logging.properties \
- org.apache.oodt.cas.protocol.http.HttpProtocol \
- --url $1 \
- --downloadToDir $2
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/Config.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/Config.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/Config.java
deleted file mode 100644
index 9eaa4c0..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/Config.java
+++ /dev/null
@@ -1,405 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.config;
-
-//OODT imports
-import org.apache.oodt.cas.pushpull.exceptions.ConfigException;
-import org.apache.oodt.cas.pushpull.objectfactory.PushPullObjectFactory;
-import org.apache.oodt.cas.pushpull.retrievalsystem.RemoteFileMetKeys;
-import org.apache.oodt.cas.filemgr.ingest.Ingester;
-import org.apache.oodt.cas.metadata.util.PropertiesUtils;
-
-//JDK imports
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * This class will parse a java .properties file for FileRetrievalSystem so that
- * information can be easily accessed through getter methods.
- *
- * @author bfoster
- *
- */
-public class Config implements ConfigMetKeys {
-
- private ProtocolInfo pi;
-
- private ParserInfo parserInfo;
-
- private Ingester ingester;
-
- private URL fmUrl;
-
- private String productTypeDetectionFile;
-
- private boolean useTracker;
-
- private boolean onlyDefinedTypes;
-
- private int recommendedThreadCount;
-
- private int maxFailedDownloads;
-
- private boolean writeMetFile;
-
- private String metFileExtension;
-
- private String[] listOfMetadataToOutput;
-
- private File baseStagingArea;
-
- /* our log stream */
- private static final Logger LOG = Logger.getLogger(Config.class.getName());
-
- /**
- * Constructor
- *
- */
- public Config() {
- pi = new ProtocolInfo();
- parserInfo = new ParserInfo();
- this.maxFailedDownloads = 10;
- this.recommendedThreadCount = 8;
- listOfMetadataToOutput = new String[] { RemoteFileMetKeys.PRODUCT_NAME,
- RemoteFileMetKeys.RETRIEVED_FROM_LOC,
- RemoteFileMetKeys.DATA_PROVIDER, RemoteFileMetKeys.FILE_SIZE,
- RemoteFileMetKeys.PRODUCT_TYPE };
- int i = 1;
- do {
- this.baseStagingArea = new File("./" + STAGING_AREA_PREFIX + "_"
- + i++);
- } while (this.baseStagingArea.exists());
- }
-
- /**
- * Opens the configuration file and adds its properties to System properties
- *
- * @return
- */
- public void loadConfigFile(File configFile) throws ConfigException {
-
- // load properties from configuration file
- try {
- System.getProperties().load(new FileInputStream(configFile));
- } catch (Exception e) {
- throw new ConfigException("Failed to load properties file : "
- + e.getMessage());
- }
-
- // parse properties and xml file specified in config file
- try {
- loadProperties();
- } catch (Exception e) {
- throw new ConfigException(
- "Failed to get properties from properties file : "
- + e.getMessage());
- }
- }
-
- public void setProtocolInfo(ProtocolInfo pi) {
- this.pi = pi;
- }
-
- public void setUseTracker(boolean useTracker) {
- this.useTracker = useTracker;
- }
-
- public void setIngester(Ingester ingester) {
- this.ingester = ingester;
- }
-
- public void setFmUrl(URL fmUrl){
- this.fmUrl = fmUrl;
- }
-
- public void setTempInfoFileExtension(String extension) {
- this.metFileExtension = extension;
- }
-
- public void setRecommendedThreadCount(int count) {
- this.recommendedThreadCount = count;
- }
-
- public void setMaxAllowedFailedDownloads(int max) {
- this.maxFailedDownloads = max;
- }
-
- public void setOnlyDownloadDefinedTypes(boolean onlyDefinedTypes) {
- this.onlyDefinedTypes = onlyDefinedTypes;
- }
-
- public void setBaseStagingArea(File baseStagingArea) {
- this.baseStagingArea = baseStagingArea;
- }
-
- public void setProductTypeDetectionFile(String filePath) {
- this.productTypeDetectionFile = filePath;
- }
-
- public void setWriteMetFile(boolean writeMetFile) {
- this.writeMetFile = writeMetFile;
- }
-
- /**
- * Parses the properties which were added to System properties by
- * loadConfigFile(). Stores info for access by getter methods
- *
- * @throws ConfigException
- * @throws InstantiationException
- * @throws IOException
- * @throws FileNotFoundException
- * @throws ClassNotFoundException
- * @throws ClassNotFoundException
- */
- void loadProperties() throws ConfigException {
- this.loadExternalConfigFiles();
- this.loadProtocolTypes();
- this.loadParserInfo();
- this.loadIngester();
- this.loadMiscVariables();
- this.loadProductTypeDetection();
- this.loadMetadataListToOutput();
- }
-
- void loadExternalConfigFiles() throws ConfigException {
- String[] externalConfigs = PropertiesUtils
- .getProperties(EXTERNAL_PROPERTIES_FILES);
- for (String externalConfig : externalConfigs) {
- try {
- System.getProperties().load(
- new FileInputStream(new File(externalConfig)));
- } catch (Exception e) {
- throw new ConfigException("Failed to load default config file "
- + externalConfig + " : " + e.getMessage());
- }
- }
- }
-
- void loadProtocolTypes() throws ConfigException {
- LOG.log(Level.INFO,
- "Associating protocol types with ProtocolFactories . . .");
- String[] protocolFactoryInfoFiles = PropertiesUtils
- .getProperties(PROTOCOL_FACTORY_INFO_FILES);
- for (String file : protocolFactoryInfoFiles) {
- try {
- pi.loadProtocolFactoryInfoFromFile(new File(file));
- } catch (Exception e) {
- throw new ConfigException(
- "Failed to load ProtocolFactory config file " + file
- + " : " + e.getMessage());
- }
- }
- }
-
- void loadParserInfo() throws ConfigException {
- LOG.log(Level.INFO, "Associating parsers with RetrievalMethods . . .");
- String[] parserInfoFiles = PropertiesUtils
- .getProperties(PARSER_INFO_FILES);
- for (String file : parserInfoFiles) {
- try {
- parserInfo.loadParserInfo(new File(file));
- } catch (Exception e) {
- throw new ConfigException("Failed to load parser info file "
- + file + " : " + e.getMessage());
- }
- }
- }
-
- void loadIngester() throws ConfigException {
- try {
- String fmUrlStr = PropertiesUtils.getProperties(INGESTER_FM_URL,
- new String[] { NO_FM_SPECIFIED })[0];
-
- if (fmUrlStr.equals(NO_FM_SPECIFIED)) {
- LOG
- .log(Level.INFO,
- "No file manager url specified: no ingester will be used");
- } else {
- String ingesterClass = PropertiesUtils
- .getProperties(INGESTER_CLASS)[0];
- String dataTransferClass = PropertiesUtils
- .getProperties(INGESTER_DATA_TRANSFER)[0];
- String cacheFactoryClass = System.getProperty(CACHE_FACTORY_CLASS);
-
- LOG.log(Level.INFO, "Configuring and building ingester: ["
- + ingesterClass + "]: data transfer: ["
- + dataTransferClass + "]: to ingest to file manager: ["
- + fmUrlStr + "]");
-
- if (cacheFactoryClass != null) {
- LOG.log(Level.INFO, "Configuring Ingester cache: ["
- + cacheFactoryClass + "]");
- }
-
- this.ingester = PushPullObjectFactory.createIngester(
- ingesterClass, cacheFactoryClass);
-
- this.fmUrl = safeGetUrlFromString(fmUrlStr);
-
- }
-
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- throw new ConfigException("Failed to load Ingester : "
- + e.getMessage());
- }
- }
-
- void loadProductTypeDetection() throws ConfigException {
- try {
- this.productTypeDetectionFile = PropertiesUtils
- .getProperties(TYPE_DETECTION_FILE)[0];
- LOG.log(Level.INFO, "Loading product type detection file: "
- + productTypeDetectionFile);
- } catch (Exception e) {
- throw new ConfigException(
- "Failed to load ProductTypeDetection file '"
- + productTypeDetectionFile + "' : "
- + e.getMessage());
- }
- }
-
- void loadMetadataListToOutput() {
- listOfMetadataToOutput = PropertiesUtils.getProperties(
- MET_LIST_TO_PRINT, new String[] {
- RemoteFileMetKeys.PRODUCT_NAME,
- RemoteFileMetKeys.RETRIEVED_FROM_LOC,
- RemoteFileMetKeys.DATA_PROVIDER,
- RemoteFileMetKeys.FILE_SIZE,
- RemoteFileMetKeys.PRODUCT_TYPE });
- }
-
- void loadMiscVariables() {
- onlyDefinedTypes = (PropertiesUtils.getProperties(
- ALLOW_ONLY_DEFINED_TYPES, new String[] { "false" })[0]
- .toLowerCase().equals("true"));
- useTracker = (PropertiesUtils.getProperties(USE_TRACKER,
- new String[] { "false" })[0].toLowerCase().equals("true"));
- this.recommendedThreadCount = Integer.parseInt(PropertiesUtils
- .getProperties(FILE_RET_SYSTEM_REC_THREAD_COUNT,
- new String[] { "8" })[0]);
- this.maxFailedDownloads = Integer.parseInt(PropertiesUtils
- .getProperties(FILE_RET_SYSTEM_MAX_ALLOWED_FAIL_DOWNLOADS,
- new String[] { "10" })[0]);
- metFileExtension = PropertiesUtils.getProperties(MET_FILE_EXT,
- new String[] { "info.tmp" })[0];
- this.writeMetFile = Boolean.getBoolean(WRITE_MET_FILE);
- String timeoutString = PropertiesUtils.getProperties(
- PROTOCOL_TIMEOUT_MS, new String[] { "600000" })[0];
- if (timeoutString == null) {
- timeoutString = "0";
- }
- pi.setDownloadTimeout(Long.parseLong(timeoutString));
- pi.setPageSize(Integer.parseInt(PropertiesUtils.getProperties(
- PROTOCOL_PAGE_SIZE, new String[] { "8" })[0]));
- this.baseStagingArea = new File(PropertiesUtils.getProperties(
- DATA_FILE_BASE_STAGING_AREA,
- new String[] { this.baseStagingArea.getPath() })[0]);
- }
-
- public ProtocolInfo getProtocolInfo() {
- return this.pi;
- }
-
- public Ingester getIngester() {
- return this.ingester;
- }
-
- public URL getFmUrl(){
- return this.fmUrl;
- }
-
- public boolean useTracker() {
- return useTracker;
- }
-
- public String getMetFileExtension() {
- return this.metFileExtension;
- }
-
- public String getProductTypeDetectionFile() {
- return this.productTypeDetectionFile;
- }
-
- public int getRecommendedThreadCount() {
- return this.recommendedThreadCount;
- }
-
- public int getMaxFailedDownloads() {
- return this.maxFailedDownloads;
- }
-
- public boolean onlyDownloadDefinedTypes() {
- return this.onlyDefinedTypes;
- }
-
- public String[] getListOfMetadataToOutput() {
- return this.listOfMetadataToOutput;
- }
-
- public ParserInfo getParserInfo() {
- return this.parserInfo;
- }
-
- public File getBaseStagingArea() {
- return this.baseStagingArea;
- }
-
- public boolean getWriteMetFile() {
- return this.writeMetFile;
- }
-
- public Config clone() {
- Config config = new Config();
- config.baseStagingArea = this.baseStagingArea;
- config.ingester = this.ingester;
- config.fmUrl = this.fmUrl;
- config.listOfMetadataToOutput = this.listOfMetadataToOutput;
- config.maxFailedDownloads = this.maxFailedDownloads;
- config.metFileExtension = this.metFileExtension;
- config.onlyDefinedTypes = this.onlyDefinedTypes;
- config.parserInfo = this.parserInfo;
- config.pi = this.pi;
- config.productTypeDetectionFile = this.productTypeDetectionFile;
- config.recommendedThreadCount = this.recommendedThreadCount;
- config.useTracker = this.useTracker;
- config.writeMetFile = this.writeMetFile;
- return config;
- }
-
- private static URL safeGetUrlFromString(String urlStr) {
- URL url = null;
-
- try {
- url = new URL(urlStr);
- } catch (MalformedURLException e) {
- LOG.log(Level.WARNING, "Unable to generate url from url string: ["
- + urlStr + "]: Message: " + e.getMessage());
- }
-
- return url;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/ConfigMetKeys.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/ConfigMetKeys.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/ConfigMetKeys.java
deleted file mode 100644
index bb32309..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/ConfigMetKeys.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.config;
-
-/**
- * @author mattmann
- * @version $Revision$
- *
- * <p>
- * Met keys for the PushPullFramework {@link Config}
- * </p>.
- */
-public interface ConfigMetKeys {
-
- String STAGING_AREA_PREFIX = "Staging_Area";
-
- String EXTERNAL_PROPERTIES_FILES = "org.apache.oodt.cas.pushpull.config.external.properties.files";
-
- String PROTOCOL_FACTORY_INFO_FILES = "org.apache.oodt.cas.pushpull.config.protocolfactory.info.files";
-
- String PARSER_INFO_FILES = "org.apache.oodt.cas.pushpull.config.parser.info.files";
-
- String INGESTER_CLASS = "org.apache.oodt.cas.filemgr.ingester";
-
- String INGESTER_DATA_TRANSFER = "org.apache.oodt.cas.filemgr.datatransfer.factory";
-
- String INGESTER_FM_URL = "org.apache.oodt.cas.filemgr.url";
-
- String NO_FM_SPECIFIED = "N/A";
-
- String CACHE_FACTORY_CLASS = "org.apache.oodt.cas.filemgr.ingest.cache.factory";
-
- String TYPE_DETECTION_FILE = "org.apache.oodt.cas.pushpull.config.type.detection.file";
-
- String MET_LIST_TO_PRINT = "org.apache.oodt.cas.pushpull.metadata.list.to.print";
-
- String ALLOW_ONLY_DEFINED_TYPES = "org.apache.oodt.cas.pushpull.allow.only.defined.types";
-
- String USE_TRACKER = "org.apache.oodt.cas.pushpull.crawler.use.tracker";
-
- String FILE_RET_SYSTEM_REC_THREAD_COUNT = "org.apache.oodt.cas.pushpull.file.retrieval.system.recommended.thread.count";
-
- String FILE_RET_SYSTEM_MAX_ALLOWED_FAIL_DOWNLOADS = "org.apache.oodt.cas.pushpull.file.retrieval.system.max.number.allowed.failed.downloads";
-
- String MET_FILE_EXT = "org.apache.oodt.cas.pushpull.met.file.extension";
-
- String PROTOCOL_TIMEOUT_MS = "org.apache.oodt.cas.pushpull.protocol.timeout.milliseconds";
-
- String PROTOCOL_PAGE_SIZE = "org.apache.oodt.cas.pushpull.protocol.page_size";
-
- String DATA_FILE_BASE_STAGING_AREA = "org.apache.oodt.cas.pushpull.data.files.base.staging.area";
-
- String WRITE_MET_FILE = "org.apache.oodt.cas.pushpull.write.met.file";
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/ConfigParserMetKeys.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/ConfigParserMetKeys.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/ConfigParserMetKeys.java
deleted file mode 100644
index 6d43ad3..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/ConfigParserMetKeys.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.config;
-
-/**
- * @author mattmann
- * @version $Revision$
- *
- * <p>
- * Met Keys used when parsing {@link Config} xml files
- * </p>.
- */
-public interface ConfigParserMetKeys {
-
- String RETRIEVAL_METHOD_TAG = "rtvlMethod";
-
- String CLASS_ATTR = "class";
-
- String PARSER_TAG = "parser";
-
- String PROTOCOL_TAG = "protocol";
-
- String TYPE_ATTR = "type";
-
- String PROTOCOL_FACTORY_TAG = "protocolFactory";
-
- String ALIAS_SPEC_TAG = "aliasSpec";
-
- String FILE_ATTR = "file";
-
- String DAEMON_TAG = "daemon";
-
- String ACTIVE_ATTR = "active";
-
- String ALIAS_ATTR = "alias";
-
- String RUN_INFO_TAG = "runInfo";
-
- String FIRSTRUN_DATETIME_ATTR = "firstRunDateTime";
-
- String PERIOD_ATTR = "period";
-
- String RUNONREBOOT_ATTR = "runOnReboot";
-
- String EPSILON_ATTR = "epsilon";
-
- String PROP_INFO_TAG = "propInfo";
-
- String DIR_ATTR = "dir";
-
- String PROP_FILES_TAG = "propFiles";
-
- String REG_EXP_ATTR = "regExp";
-
- String PARSER_ATTR = "parser";
-
- String DOWNLOAD_INFO_TAG = "downloadInfo";
-
- String RENAMING_CONV_ATTR = "renamingConv";
-
- String ALLOW_ALIAS_OVERRIDE_ATTR = "allowAliasOverride";
-
- String DELETE_FROM_SERVER_ATTR = "deleteFromServer";
-
- String PROP_FILE_TAG = "propFile";
-
- String PATH_ATTR = "path";
-
- String AFTER_USE_TAG = "afterUse";
-
- String DELETE_ON_SUCCESS_ATTR = "deleteOnSuccess";
-
- String MOVEON_TO_SUCCESS_ATTR = "moveToOnSuccess";
-
- String MOVEON_TO_FAIL_ATTR = "moveToOnFail";
-
- String DATA_INFO_TAG = "dataInfo";
-
- String QUERY_ELEM_ATTR = "queryElement";
-
- String STAGING_AREA_ATTR = "stagingArea";
-
- String SOURCE_TAG = "source";
-
- String HOST_ATTR = "host";
-
- String LOGIN_ATTR = "login";
-
- String USERNAME_TAG = "username";
-
- String PASSWORD_TAG = "password";
-
- String CD_TEST_DIR_TAG = "cdTestDir";
-
- String MAX_CONN_TAG = "maxConn";
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/DaemonInfo.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/DaemonInfo.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/DaemonInfo.java
deleted file mode 100644
index 34966eb..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/DaemonInfo.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.config;
-
-//JDK imports
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>Describe your class here</p>.
- */
-public class DaemonInfo {
-
- private static SimpleDateFormat utcFormat = new SimpleDateFormat(
- "yyyy-MM-dd'T'hh:mm:ss'Z'");
-
- private Date firstRunDateTime;
-
- private long timeIntervalInMilliseconds;
-
- private long epsilonInMilliseconds;
-
- private boolean runOnReboot;
-
- private PropFilesInfo pfi;
-
- private DataFilesInfo dfi;
-
- public DaemonInfo(String firstRunDateTimeString, String period,
- String epsilon, boolean runOnReboot, PropFilesInfo pfi,
- DataFilesInfo dfi) throws ParseException {
- this.runOnReboot = runOnReboot;
- if (firstRunDateTimeString != null
- && !firstRunDateTimeString.equals("")) {
- this.firstRunDateTime = utcFormat.parse(firstRunDateTimeString);
- } else {
- this.firstRunDateTime = new Date();
- }
- if (period != null && !period.equals("")) {
- this.timeIntervalInMilliseconds = Long.parseLong(period.substring(
- 0, period.length() - 1))
- * this.getMillisecondsInMetric((period.charAt(period
- .length() - 1) + "")
- .toLowerCase());
- } else {
- this.timeIntervalInMilliseconds = -1;
- }
- if (epsilon != null && !epsilon.equals("")) {
- this.epsilonInMilliseconds = Long.parseLong(epsilon.substring(0,
- epsilon.length() - 1))
- * this.getMillisecondsInMetric((epsilon.charAt(epsilon
- .length() - 1) + "")
- .toLowerCase());
- } else {
- this.epsilonInMilliseconds = -1;
- }
- this.pfi = pfi;
- this.dfi = dfi;
- }
-
- private long getMillisecondsInMetric(String stringMetric) {
- switch (stringMetric.charAt(0)) {
- case 'w':
- return 604800000;
- case 'd':
- return 86400000;
- case 'h':
- return 3600000;
- case 'm':
- return 60000;
- case 's':
- return 1000;
- default:
- return -1;
- }
- }
-
- public PropFilesInfo getPropFilesInfo() {
- return this.pfi;
- }
-
- public DataFilesInfo getDataFilesInfo() {
- return this.dfi;
- }
-
- public long getTimeIntervalInMilliseconds() {
- return this.timeIntervalInMilliseconds;
- }
-
- public long getEpsilonInMilliseconds() {
- return this.epsilonInMilliseconds;
- }
-
- public boolean runOnReboot() {
- return this.runOnReboot;
- }
-
- public Date getFirstRunDateTime() {
- return this.firstRunDateTime;
- }
-
- public String toString() {
- return "--------DaemonInfo--------\n" + " " + "First run date/time: "
- + this.firstRunDateTime + "\n" + " "
- + "Period in milliseconds: " + this.timeIntervalInMilliseconds
- + "\n" + " " + "Epsilon in milliseoncs: "
- + this.epsilonInMilliseconds + "\n" + " " + "Run on reboot: "
- + this.runOnReboot + "\n" + this.dfi + this.pfi + "\n";
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/DataFilesInfo.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/DataFilesInfo.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/DataFilesInfo.java
deleted file mode 100644
index 1b5ffb6..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/DataFilesInfo.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.config;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>Describe your class here</p>.
- */
-public class DataFilesInfo {
-
- private String queryMetadataElementName;
-
- private DownloadInfo di;
-
- public DataFilesInfo(String queryMetadataElementName, DownloadInfo di) {
- this.queryMetadataElementName = queryMetadataElementName;
- this.di = di;
- }
-
- public DownloadInfo getDownloadInfo() {
- return this.di;
- }
-
- public String getQueryMetadataElementName() {
- return this.queryMetadataElementName;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/DownloadInfo.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/DownloadInfo.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/DownloadInfo.java
deleted file mode 100644
index 5f08926..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/DownloadInfo.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.config;
-
-//OODT imports
-import org.apache.oodt.cas.pushpull.protocol.RemoteSite;
-
-//JDK imports
-import java.io.File;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class DownloadInfo {
-
- private RemoteSite remoteSite;
-
- private String renamingConv;
-
- private boolean deleteFromServer;
-
- private File stagingArea;
-
- private boolean allowAliasOverride;
-
- public DownloadInfo(RemoteSite remoteSite, String renamingConv,
- boolean deleteFromServer, File stagingArea,
- boolean allowAliasOverride) {
- this.remoteSite = remoteSite;
- this.renamingConv = renamingConv;
- this.deleteFromServer = deleteFromServer;
- this.stagingArea = stagingArea;
- this.allowAliasOverride = allowAliasOverride;
- }
-
- public RemoteSite getRemoteSite() {
- return this.remoteSite;
- }
-
- public String getRenamingConv() {
- return this.renamingConv;
- }
-
- public boolean deleteFromServer() {
- return this.deleteFromServer;
- }
-
- public File getStagingArea() {
- return this.stagingArea;
- }
-
- public boolean isAllowAliasOverride() {
- return this.allowAliasOverride;
- }
-
- public String toString() {
- return "DataFileInfo:\n" + " " + this.remoteSite + "\n" + " "
- + "RenamingConvension: " + this.renamingConv + "\n" + " "
- + "StagingArea: " + this.getStagingArea().getAbsolutePath()
- + "\n" + " " + "Delete files from server: "
- + this.deleteFromServer + "\n" + " "
- + "Allow alias override: " + this.allowAliasOverride + "\n";
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/ParserInfo.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/ParserInfo.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/ParserInfo.java
deleted file mode 100644
index 372a623..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/ParserInfo.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.config;
-
-//JDK imports
-import java.io.File;
-import java.io.FileInputStream;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-//OODT imports
-import org.apache.oodt.cas.pushpull.exceptions.ConfigException;
-import org.apache.oodt.cas.pushpull.filerestrictions.Parser;
-import org.apache.oodt.cas.pushpull.retrievalmethod.RetrievalMethod;
-import org.apache.oodt.cas.metadata.util.PathUtils;
-import org.apache.oodt.commons.xml.XMLUtils;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class ParserInfo implements ConfigParserMetKeys{
-
- private ConcurrentHashMap<String, String> parserToRetrievalMethodMap;
-
- /* our log stream */
- private static final Logger LOG = Logger.getLogger(ParserInfo.class
- .getName());
-
- public ParserInfo() {
- parserToRetrievalMethodMap = new ConcurrentHashMap<String, String>();
- }
-
- public void loadParserInfo(File xmlFile) throws ConfigException {
- try {
- NodeList rmList = XMLUtils.getDocumentRoot(new FileInputStream(xmlFile))
- .getElementsByTagName(RETRIEVAL_METHOD_TAG);
- for (int i = 0; i < rmList.getLength(); i++) {
-
- // get rm element
- Node rmNode = rmList.item(i);
-
- // get classpath for this rm
- String rmClasspath = PathUtils
- .replaceEnvVariables(((Element) rmNode)
- .getAttribute(CLASS_ATTR));
-
- // get all login info for this source
- NodeList parserList = ((Element) rmNode)
- .getElementsByTagName(PARSER_TAG);
- for (int j = 0; j < parserList.getLength(); j++) {
-
- // get a single login info
- Node parserNode = parserList.item(j);
- String parserClasspath = PathUtils
- .replaceEnvVariables(((Element) parserNode)
- .getAttribute(CLASS_ATTR));
-
- LOG.log(Level.INFO, "Assiging parser '" + parserClasspath
- + "' with retrievalmethod '" + rmClasspath + "'");
- this.parserToRetrievalMethodMap.put(parserClasspath,
- rmClasspath);
- }
- }
- } catch (Exception e) {
- throw new ConfigException("Failed to load Parser info : "
- + e.getMessage());
- }
- }
-
- public Class<RetrievalMethod> getRetrievalMethod(Parser parser)
- throws ClassNotFoundException {
- System.out.println(parser.getClass().getCanonicalName());
- return (Class<RetrievalMethod>) Class
- .forName(this.parserToRetrievalMethodMap.get(parser.getClass()
- .getCanonicalName()));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/PropFilesInfo.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/PropFilesInfo.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/PropFilesInfo.java
deleted file mode 100644
index 97cb18f..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/PropFilesInfo.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.config;
-
-//OODT imports
-import org.apache.oodt.cas.pushpull.filerestrictions.Parser;
-
-//JDK imports
-import java.io.File;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.LinkedList;
-import java.util.Map.Entry;
-import java.util.regex.Pattern;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>Describe your class here</p>.
- */
-public class PropFilesInfo {
-
- private File localDir;
-
- private boolean deleteOnSuccess;
-
- private File successLoc;
-
- private File failLoc;
-
- private LinkedList<RegExpAndParser> patterns;
-
- private ConcurrentHashMap<File, Parser> fileToParserMap;
-
- private DownloadInfo di;
-
- public PropFilesInfo(File localDir) {
- this.localDir = localDir;
- patterns = new LinkedList<RegExpAndParser>();
- }
-
- public void setDownloadInfo(DownloadInfo di,
- ConcurrentHashMap<File, Parser> fileToParserMap) {
- this.di = di;
- this.fileToParserMap = fileToParserMap;
- }
-
- public LinkedList<File> getDownloadInfoPropFiles() {
- LinkedList<File> returnList = new LinkedList<File>();
- for (Entry<File, Parser> entry : this.fileToParserMap.entrySet()) {
- returnList.add(entry.getKey());
- }
- return returnList;
- }
-
- public void setAfterUseEffects(File successLoc, File failLoc) {
- this.successLoc = successLoc;
- this.failLoc = failLoc;
- }
-
- public void addPropFiles(String regExp, Parser parser) {
- patterns.add(new RegExpAndParser(regExp, parser));
- }
-
- public Parser getParserForFile(File propFile) {
- Parser parser = this.fileToParserMap == null ? null
- : this.fileToParserMap.get(propFile);
- if (parser == null) {
- parser = this.getParserForFilename(propFile.getName());
- }
- return parser;
- }
-
- public Parser getParserForFilename(String propFilename) {
- for (RegExpAndParser pattern : patterns) {
- if (pattern.isAcceptedByPattern(propFilename)) {
- return pattern.getParser();
- }
- }
- return null;
- }
-
- public boolean needsToBeDownloaded() {
- return di != null;
- }
-
- public DownloadInfo getDownloadInfo() {
- return this.di;
- }
-
- public File getFinalDestination(boolean success) {
- return success ? this.getOnSuccessDir() : this.getOnFailDir();
- }
-
- public File getOnSuccessDir() {
- return (this.successLoc == null) ? this.localDir : this.successLoc;
- }
-
- public File getOnFailDir() {
- return (this.failLoc == null) ? this.localDir : this.failLoc;
- }
-
- public File getLocalDir() {
- return this.localDir;
- }
-
- public void setDeleteOnSuccess(boolean deleteOnSuccess) {
- this.deleteOnSuccess = deleteOnSuccess;
- }
-
- public boolean getDeleteOnSuccess() {
- return deleteOnSuccess;
- }
-
- public String toString() {
- return "PropFilesInfo\n" + " " + "Local directory: " + this.localDir
- + "\n" + " " + "Patterns: " + this.patterns + "\n" + " "
- + "Delete on success: " + this.deleteOnSuccess + "\n" + " "
- + "Move to directory on success: " + this.successLoc + "\n"
- + " " + "Move to directory on fail: " + this.failLoc + "\n"
- + " " + this.di + "\n";
- }
-
- private class RegExpAndParser {
- private String pattern;
-
- private Parser parser;
-
- public RegExpAndParser(String pattern, Parser parser) {
- this.pattern = pattern;
- this.parser = parser;
- }
-
- public boolean isAcceptedByPattern(String filename) {
- return Pattern.matches(pattern, filename);
- }
-
- public Parser getParser() {
- return this.parser;
- }
-
- public String getPattern() {
- return this.pattern;
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/ProtocolInfo.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/ProtocolInfo.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/ProtocolInfo.java
deleted file mode 100644
index eebafab..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/ProtocolInfo.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.config;
-
-//OODT imports
-import org.apache.oodt.cas.protocol.ProtocolFactory;
-import org.apache.oodt.cas.pushpull.exceptions.ConfigException;
-import org.apache.oodt.cas.metadata.util.PathUtils;
-import org.apache.oodt.commons.xml.XMLUtils;
-
-//JDK imports
-import java.io.File;
-import java.io.FileInputStream;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.LinkedList;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class ProtocolInfo implements ConfigParserMetKeys {
-
- private long timeout;
-
- private int pgSize;
-
- private static final int DEFAULT_PG_SIZE = 8;
-
- private ConcurrentHashMap<String, LinkedList<Class<ProtocolFactory>>> protocolClassReference;
-
- /* our log stream */
- private static final Logger LOG = Logger.getLogger(ProtocolInfo.class
- .getName());
-
- public ProtocolInfo() {
- timeout = 0;
- pgSize = DEFAULT_PG_SIZE;
- protocolClassReference = new ConcurrentHashMap<String, LinkedList<Class<ProtocolFactory>>>();
- }
-
- public void loadProtocolFactoryInfoFromFile(File protocolFactoryInfo)
- throws ConfigException {
- try {
- NodeList sourceList = XMLUtils.getDocumentRoot(new FileInputStream(protocolFactoryInfo))
- .getElementsByTagName(PROTOCOL_TAG);
- for (int i = 0; i < sourceList.getLength(); i++) {
-
- // get source element
- Node sourceNode = sourceList.item(i);
-
- // get host of this source
- String type = PathUtils
- .replaceEnvVariables(((Element) sourceNode)
- .getAttribute(TYPE_ATTR));
-
- // get all login info for this source
- NodeList loginList = ((Element) sourceNode)
- .getElementsByTagName(PROTOCOL_FACTORY_TAG);
- for (int j = 0; j < loginList.getLength(); j++) {
-
- // get a single login info
- Node loginNode = loginList.item(j);
- String protocolFactoryClass = PathUtils
- .replaceEnvVariables(((Element) loginNode)
- .getAttribute(CLASS_ATTR));
-
- this.addClassForType(type, protocolFactoryClass);
- }
- }
- } catch (Exception e) {
- throw new ConfigException(
- "Failed to load ProtocolFactory info for protocol types : "
- + e.getMessage());
- }
- }
-
- public void addClassForType(String type,
- Class<ProtocolFactory> protocolFactoryClass) {
- LinkedList<Class<ProtocolFactory>> protocolClasses;
- if ((protocolClasses = protocolClassReference.get(type)) == null) {
- protocolClasses = new LinkedList<Class<ProtocolFactory>>();
- protocolClassReference.put(type.toLowerCase(), protocolClasses);
- }
- protocolClasses.add(protocolFactoryClass);
- LOG.log(Level.INFO, "Assiging protocol '" + type.toLowerCase()
- + "' with class '" + protocolFactoryClass + "'");
- }
-
- public void addClassForType(String type, String protocolFactoryClass)
- throws ClassNotFoundException {
- this.addClassForType(type, (Class<ProtocolFactory>) Class
- .forName(protocolFactoryClass));
- }
-
- public void addClassForType(String type,
- Class<ProtocolFactory>[] protocolFactoryClasses) {
- for (Class<ProtocolFactory> clazz : protocolFactoryClasses) {
- this.addClassForType(type, clazz);
- }
- }
-
- public void addClassForType(String type, String[] protocolFactoryClasses)
- throws ClassNotFoundException {
- for (String clazz : protocolFactoryClasses) {
- this.addClassForType(type, (Class<ProtocolFactory>) Class
- .forName(clazz));
- }
- }
-
- public void setDownloadTimeout(long timeout) {
- this.timeout = timeout;
- }
-
- public void setPageSize(int pgSize) {
- if (pgSize != -1) {
- this.pgSize = pgSize;
- } else {
- this.pgSize = Integer.MAX_VALUE;
- }
- }
-
- public LinkedList<Class<ProtocolFactory>> getProtocolClassesForProtocolType(
- String type) {
- return protocolClassReference.get(type.toLowerCase());
- }
-
- public long getDownloadTimeout() {
- return timeout;
- }
-
- public int getPageSize() {
- return pgSize;
- }
-
- public ProtocolInfo clone() {
- ProtocolInfo pi = new ProtocolInfo();
- pi.protocolClassReference = this.protocolClassReference;
- pi.timeout = this.timeout;
- pi.pgSize = this.pgSize;
- return pi;
- }
-}
[03/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/Expression.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/Expression.java b/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/Expression.java
deleted file mode 100644
index 6aece62..0000000
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/Expression.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.xmlps.queryparser;
-
-/**
- *
- * The abstract interface for our expression tree.
- */
-public interface Expression {
-
- /**
- * Defines how to turn this Expression into a String-readable query to an
- * underlying SQL database.
- *
- * @return A String-readable version of this Expression.
- */
- String evaluate();
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/GreaterThanEqualsExpression.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/GreaterThanEqualsExpression.java b/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/GreaterThanEqualsExpression.java
deleted file mode 100644
index c5ce179..0000000
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/GreaterThanEqualsExpression.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.xmlps.queryparser;
-
-/**
- *
- * Greater than or equals expression.
- */
-public class GreaterThanEqualsExpression extends RelOpExpression implements
- ParseConstants {
-
- public GreaterThanEqualsExpression(String lhs, Expression literal) {
- super(SQL_GREATER_THAN_OR_EQUAL_TO, lhs, literal);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/GreaterThanExpression.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/GreaterThanExpression.java b/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/GreaterThanExpression.java
deleted file mode 100644
index 42582ef..0000000
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/GreaterThanExpression.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.xmlps.queryparser;
-
-/**
- *
- * Greater than expression.
- */
-public class GreaterThanExpression extends RelOpExpression implements
- ParseConstants {
-
- public GreaterThanExpression(String lhs, Expression literal) {
- super(SQL_GREATER_THAN, lhs, literal);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/HandlerQueryParser.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/HandlerQueryParser.java b/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/HandlerQueryParser.java
deleted file mode 100644
index 9e59747..0000000
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/HandlerQueryParser.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.xmlps.queryparser;
-
-//JDK imports
-import org.apache.oodt.xmlps.mapping.Mapping;
-import org.apache.oodt.xmlps.mapping.MappingField;
-import org.apache.oodt.xmlquery.QueryElement;
-
-import java.util.List;
-import java.util.Stack;
-
-//OODT imports
-
-/**
- *
- * Parsers the {@link org.apache.oodt.xmlquery.XMLQuery} and its @link XMLQuery#getWhereElementSet()}
- * into an {@link Expression} tree.
- */
-public class HandlerQueryParser implements ParseConstants {
-
- /**
- * Calls {@link #parse(Stack, Mapping)} with a null mapping.
- *
- * @param queryStack The {@link org.apache.oodt.xmlquery.XMLQuery#getWhereElementSet()}.
- * @return The parsed {@link Expression} tree.
- */
- public static Expression parse(Stack<QueryElement> queryStack) {
- return parse(queryStack, null);
- }
-
- /**
- *
- * Parses the {@link org.apache.oodt.xmlquery.XMLQuery#getWhereElementSet()} using the provided
- * <param>map</param>.
- *
- * @param queryStack The {@link org.apache.oodt.xmlquery.XMLQuery#getWhereElementSet()}
- * @param map The provided ontological mapping.
- * @return The parsed {@link Expression} tree.
- */
- public static Expression parse(Stack<QueryElement> queryStack, Mapping map) {
-
- QueryElement qe;
-
- if (!queryStack.empty()) {
- qe = (QueryElement) queryStack.pop();
- } else {
- return null;
- }
-
- if (qe.getRole().equalsIgnoreCase(XMLQUERY_LOGOP)) {
-
- String logOpType = qe.getValue();
- if (logOpType.equalsIgnoreCase(XMLQUERY_AND)) {
- return new AndExpression(parse(queryStack, map), parse(queryStack, map));
- } else if (logOpType.equalsIgnoreCase(XMLQUERY_OR)) {
- return new OrExpression(parse(queryStack, map), parse(queryStack, map));
- } else {
- return null;
- }
-
- } else if (qe.getRole().equalsIgnoreCase(XMLQUERY_RELOP)) {
- String relOpType = qe.getValue();
- QueryElement rhsQE = (QueryElement) queryStack.pop();
- QueryElement lhsQE = (QueryElement) queryStack.pop();
-
- String rhsVal = (String) rhsQE.getValue();
- String lhsVal = (String) lhsQE.getValue();
-
- if (map != null) {
- // convert the right hand side, using
- // the local name
- MappingField fld = map.getFieldByLocalName(lhsVal);
- if (fld != null) {
- if (fld.isString()) {
- rhsVal = "'" + rhsVal + "'";
- }
- }
- }
-
- if (relOpType.equalsIgnoreCase(XMLQUERY_EQUAL)) {
- return new EqualsExpression(lhsVal, new Literal(rhsVal));
- } else if (relOpType.equalsIgnoreCase(XMLQUERY_LIKE)) {
- return new ContainsExpression(lhsVal, new WildcardLiteral(rhsVal));
- } else if (relOpType.equalsIgnoreCase(XMLQUERY_GREATER_THAN)) {
- return new GreaterThanExpression(lhsVal, new Literal(rhsVal));
- } else if (relOpType.equalsIgnoreCase(XMLQUERY_GREATER_THAN_OR_EQUAL_TO)) {
- return new GreaterThanEqualsExpression(lhsVal, new Literal(rhsVal));
- } else if (relOpType.equalsIgnoreCase(XMLQUERY_LESS_THAN)) {
- return new LessThanExpression(lhsVal, new Literal(rhsVal));
- } else if (relOpType.equalsIgnoreCase(XMLQUERY_LESS_THAN_OR_EQUAL_TO)) {
- return new LessThanEqualsExpression(lhsVal, new Literal(rhsVal));
- } else {
- return null;
- }
-
- } else if (qe.getRole().equalsIgnoreCase(XMLQUERY_LITERAL)) {
- return new Literal(qe.getValue());
- } else {
- return null;
- }
-
- }
-
- public static Stack<QueryElement> createQueryStack(List<QueryElement> l) {
-
- Stack<QueryElement> ret = new Stack<QueryElement>();
-
- for (QueryElement aL : l) {
- ret.push(aL);
- }
-
- return ret;
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/LessThanEqualsExpression.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/LessThanEqualsExpression.java b/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/LessThanEqualsExpression.java
deleted file mode 100644
index 46e6975..0000000
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/LessThanEqualsExpression.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.xmlps.queryparser;
-
-/**
- *
- * <p>
- * A less than or equals expression.
- * </p>.
- */
-public class LessThanEqualsExpression extends RelOpExpression implements
- ParseConstants {
-
- public LessThanEqualsExpression(String lhs, Expression literal) {
- super(SQL_LESS_THAN_OR_EQUAL_TO, lhs, literal);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/LessThanExpression.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/LessThanExpression.java b/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/LessThanExpression.java
deleted file mode 100644
index 2184f19..0000000
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/LessThanExpression.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.xmlps.queryparser;
-
-/**
- *
- * <p>
- * A less than expression.
- * </p>.
- */
-public class LessThanExpression extends RelOpExpression implements
- ParseConstants {
-
- public LessThanExpression(String lhs, Expression literal) {
- super(SQL_LESS_THAN, lhs, literal);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/Literal.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/Literal.java b/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/Literal.java
deleted file mode 100644
index 4ac3de5..0000000
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/Literal.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.xmlps.queryparser;
-
-/**
- *
- * A value literal.
- */
-public class Literal implements Expression{
-
- protected String val;
-
- public Literal(String val){
- this.val = val;
- }
-
- /* (non-Javadoc)
- * @see org.apache.oodt.xmlps.queryparser.Expression#evaluate()
- */
- public String evaluate() {
- return val;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/LogOpExpression.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/LogOpExpression.java b/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/LogOpExpression.java
deleted file mode 100644
index ae5a29f..0000000
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/LogOpExpression.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.xmlps.queryparser;
-
-/**
- *
- * A logical expression with a left-hand side
- * and right hind-side {@link Expression}.
- *
- */
-public class LogOpExpression implements Expression {
-
- private String logop;
-
- private Expression lhs;
-
- private Expression rhs;
-
-
-
- public LogOpExpression(String logop, Expression lhs, Expression rhs) {
- this.lhs = lhs;
- this.rhs = rhs;
- this.logop = logop;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.oodt.xmlps.queryparser.Expression#evaluate()
- */
- public String evaluate() {
- return "(" + lhs.evaluate() + " " + logop + " " + rhs.evaluate() + ")";
- }
-
- /**
- * @return the lhs
- */
- public Expression getLhs() {
- return lhs;
- }
-
- /**
- * @param lhs the lhs to set
- */
- public void setLhs(Expression lhs) {
- this.lhs = lhs;
- }
-
- /**
- * @return the rhs
- */
- public Expression getRhs() {
- return rhs;
- }
-
- /**
- * @param rhs the rhs to set
- */
- public void setRhs(Expression rhs) {
- this.rhs = rhs;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/OrExpression.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/OrExpression.java b/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/OrExpression.java
deleted file mode 100644
index ff5531e..0000000
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/OrExpression.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.xmlps.queryparser;
-
-/**
- *
- * An Or expression.
- */
-public class OrExpression extends LogOpExpression implements ParseConstants{
-
- public OrExpression(Expression lhs, Expression rhs) {
- super(SQL_OR, lhs, rhs);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/ParseConstants.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/ParseConstants.java b/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/ParseConstants.java
deleted file mode 100644
index b26de5c..0000000
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/ParseConstants.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.xmlps.queryparser;
-
-/**
- *
- * Constant met keys used in parsing the XMLQuery.
- */
-public interface ParseConstants {
-
- String XMLQUERY_LOGOP = "LOGOP";
-
- String XMLQUERY_AND = "AND";
-
- String XMLQUERY_OR = "OR";
-
- String XMLQUERY_RELOP = "RELOP";
-
- String XMLQUERY_EQUAL = "EQ";
-
- String XMLQUERY_LIKE = "LIKE";
-
- String XMLQUERY_GREATER_THAN = "GT";
-
- String XMLQUERY_GREATER_THAN_OR_EQUAL_TO = "GE";
-
- String XMLQUERY_LESS_THAN = "LT";
-
- String XMLQUERY_LESS_THAN_OR_EQUAL_TO = "LE";
-
- String XMLQUERY_LITERAL = "LITERAL";
-
-
- String SQL_LIKE = "LIKE";
-
- String SQL_EQUAL = "=";
-
- String SQL_AND = "AND";
-
- String SQL_OR = "OR";
-
- String SQL_GREATER_THAN_OR_EQUAL_TO = ">=";
-
- String SQL_GREATER_THAN = ">";
-
- String SQL_LESS_THAN = "<";
-
- String SQL_LESS_THAN_OR_EQUAL_TO = "<=";
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/RelOpExpression.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/RelOpExpression.java b/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/RelOpExpression.java
deleted file mode 100644
index 9be99ff..0000000
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/RelOpExpression.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.xmlps.queryparser;
-
-/**
- *
- * A relational operator.
- */
-public class RelOpExpression implements Expression {
-
- private String relop;
-
- private Expression literal;
-
- private String lhs;
-
- public RelOpExpression(String relop, String lhs, Expression literal) {
- this.relop = relop;
- this.lhs = lhs;
- this.literal = literal;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.oodt.xmlps.queryparser.Expression#evaluate()
- */
- public String evaluate() {
- return lhs + " " + relop + " " + literal.evaluate();
- }
-
- /**
- * @return the lhs
- */
- public String getLhs() {
- return lhs;
- }
-
- /**
- * @param lhs the lhs to set
- */
- public void setLhs(String lhs) {
- this.lhs = lhs;
- }
-
- /**
- * @return the literal
- */
- public Expression getLiteral() {
- return literal;
- }
-
- /**
- * @param literal the literal to set
- */
- public void setLiteral(Expression literal) {
- this.literal = literal;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/WildcardLiteral.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/WildcardLiteral.java b/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/WildcardLiteral.java
deleted file mode 100644
index 2f91b9c..0000000
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/WildcardLiteral.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.xmlps.queryparser;
-
-/**
- *
- * A wildcard literal.
- */
-public class WildcardLiteral extends Literal {
-
- /**
- * @param val
- */
- public WildcardLiteral(String val) {
- super(val);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.oodt.xmlps.queryparser.Literal#evaluate()
- */
- @Override
- public String evaluate() {
- if(val.startsWith("'")){
- return "'%"+val.substring(1, val.length()-1)+"%'";
- }
- else {
- return "%" + val + "%";
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/main/java/org/apache/oodt/xmlps/structs/CDEResult.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/structs/CDEResult.java b/xmlps/src/main/java/org/apache/oodt/xmlps/structs/CDEResult.java
deleted file mode 100644
index 1ed8732..0000000
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/structs/CDEResult.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.xmlps.structs;
-
-//OODT imports
-
-import org.apache.oodt.xmlps.mapping.Mapping;
-import org.apache.oodt.xmlps.mapping.MappingField;
-import org.apache.oodt.xmlps.mapping.funcs.MappingFunc;
-import org.apache.oodt.xmlquery.QueryElement;
-import org.apache.oodt.xmlquery.Result;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Vector;
-import java.util.concurrent.ConcurrentHashMap;
-
-//JDK imports
-
-/**
- * A {@link Result} that wraps a {@link ResultSet} and returns rows as Strings,
- * applying {@link MappingFuncs} if a {@link Mapping} is provided, and appending
- * constant fields if a {@link List} of {@link CDEValue}s is provided.
- */
-public class CDEResult extends Result {
-
- private static final long serialVersionUID = 1L;
-
- private static final String ROW_TERMINATOR = "$";
-
- private final ResultSet rs;
- private final Connection con;
- private Mapping mapping;
- private List<CDEValue> constValues;
- private List<QueryElement> orderedFields;
-
- public CDEResult(ResultSet rs, Connection con) {
- this.rs = rs;
- this.con = con;
- setMimeType("text/plain");
- }
-
- public void setOrderedFields(List<QueryElement> orderedFields){
- this.orderedFields = orderedFields;
- }
-
- public void setMapping(Mapping mapping) {
- this.mapping = mapping;
- }
-
- public void setConstValues(List<CDEValue> constValues) {
- this.constValues = constValues;
- }
-
- @Override
- public InputStream getInputStream() throws IOException {
- if (rs == null || con == null) {
- throw new IOException("InputStream not ready, ResultSet or Connection is null!");
- }
- return new CDEResultInputStream(this);
- }
-
- @Override
- public long getSize() {
- return -1;
- }
-
- public void close() throws SQLException {
- if (rs != null) {
- rs.close();
- }
- if (con != null) {
- con.close();
- }
- }
-
- public String getNextRowAsString() throws SQLException {
- if (rs.next()) {
- CDERow row = createCDERow();
- if (mapping != null) {
- applyMappingFuncs(row);
- }
- if (this.constValues != null && ((this.orderedFields == null) || (this.orderedFields.size() == 0))){
- addConstValues(row);
- }
- // if there is some kind of configurable response writer,
- // here would be a nice place to put it...
- return row.toString() + ROW_TERMINATOR;
- }
- return null;
- }
-
- private CDERow createCDERow() throws SQLException {
- CDERow row = new CDERow();
- ResultSetMetaData met = rs.getMetaData();
- int count = met.getColumnCount();
- Map<String, CDEValue> dbValMap = new HashMap<String, CDEValue>();
- Map<String, CDEValue> constValMap = cdeListToMap(this.constValues);
- List<CDEValue> orderedDbVals = new Vector<CDEValue>();
-
- for (int i = 1; i <= count; i++) {
- // since the SQL query was built with "SELECT ${fieldlocalname} as ${fieldname}"
- // we know that ResultSet column names equal CDE field names
- // and appear in the correct order as well
- String fieldLocalColName = met.getColumnLabel(i);
- String colValue = rs.getString(i);
- CDEValue val = new CDEValue(fieldLocalColName, colValue);
- dbValMap.put(fieldLocalColName, val);
- orderedDbVals.add(val);
- }
-
- // now have the constant values, and the db values, order the row
- if(this.orderedFields != null){
- for(QueryElement qe: this.orderedFields){
- String qeCdeVal = this.mapping.getFieldByLocalName(qe.getValue()).getName();
- if(dbValMap.containsKey(qeCdeVal)){
- row.getVals().add(dbValMap.get(qeCdeVal));
- }
- else if(constValMap.containsKey(qeCdeVal)){
- row.getVals().add(constValMap.get(qeCdeVal));
- }
- }
- }
- else {
- row.getVals().addAll(orderedDbVals);
- }
-
-
- return row;
- }
-
- private void applyMappingFuncs(CDERow row) {
- for (CDEValue value : row.getVals()) {
- MappingField fld = mapping.getFieldByName(value.getCdeName());
- if (fld != null) {
- for (MappingFunc func : fld.getFuncs()) {
- CDEValue newValue = func.translate(value);
- value.setVal(newValue.getVal());
- }
- }
- }
- }
-
- private void addConstValues(CDERow row) {
- row.getVals().addAll(constValues);
- }
-
- private Map<String, CDEValue> cdeListToMap(List<CDEValue> vals){
- Map<String, CDEValue> map = new HashMap<String, CDEValue>();
- if(vals != null){
- for(CDEValue val: vals){
- map.put(val.getCdeName(), val);
- }
- }
-
- return map;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/main/java/org/apache/oodt/xmlps/structs/CDEResultInputStream.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/structs/CDEResultInputStream.java b/xmlps/src/main/java/org/apache/oodt/xmlps/structs/CDEResultInputStream.java
deleted file mode 100644
index 4d358aa..0000000
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/structs/CDEResultInputStream.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.xmlps.structs;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.sql.SQLException;
-
-class CDEResultInputStream extends InputStream {
-
- private final CDEResult res;
- private ByteArrayInputStream rowStream;
-
- public CDEResultInputStream(CDEResult res) {
- this.res = res;
- }
-
- private boolean fetchNextRow() throws IOException {
- String s = null;
- try {
- s = res.getNextRowAsString();
- } catch (SQLException ignored) {
- }
- if (rowStream != null) {
- rowStream.close();
- }
- rowStream = s == null ? null : new ByteArrayInputStream(s.getBytes("UTF-8"));
- return rowStream != null;
- }
-
- private boolean ensureOpen() throws IOException {
- if (rowStream == null || rowStream.available() <= 0) {
- return fetchNextRow();
- }
- return true;
- }
-
- @Override
- public int read() throws IOException {
- return ensureOpen() ? rowStream.read() : -1;
- }
-
- @Override
- public int read(byte[] b, int off, int len) throws IOException {
- if (!ensureOpen()) {
- return -1;
- }
-
- if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) > b.length)
- || ((off + len) < 0)) {
- throw new IndexOutOfBoundsException();
- } else if (len == 0) {
- return 0;
- }
-
- int total = 0;
- int n = rowStream.read(b, off, len);
- total += n;
- while (n != -1 && total < len) {
- if (!fetchNextRow()) {
- return total;
- }
- n = rowStream.read(b, off + total, len - total);
- total += n;
- }
- return total;
- }
-
- @Override
- public void close() throws IOException {
- if (rowStream != null) {
- rowStream.close();
- }
- rowStream = null;
-
- try {
- res.close();
- } catch (SQLException e) {
- throw new IOException(e);
- }
- }
-
- @Override
- public synchronized int available() throws IOException {
- if (rowStream == null) {
- return 0;
- }
- return rowStream.available();
- }
-
- @Override
- public synchronized void mark(int readlimit) {
- throw new UnsupportedOperationException("Mark not supported");
- }
-
- @Override
- public synchronized void reset() throws IOException {
- throw new UnsupportedOperationException("Reset not supported");
- }
-
- @Override
- public boolean markSupported() {
- return false;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/main/java/org/apache/oodt/xmlps/structs/CDERow.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/structs/CDERow.java b/xmlps/src/main/java/org/apache/oodt/xmlps/structs/CDERow.java
deleted file mode 100644
index f7b92e0..0000000
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/structs/CDERow.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.xmlps.structs;
-
-//JDK imports
-import java.util.List;
-import java.util.Vector;
-
-
-/**
- *
- * <p>
- * A row of {@link CDEValue}s, returned
- * from a query against a Product Server.
- * </p>.
- */
-public class CDERow {
-
- private List<CDEValue> vals;
-
- private static final String COL_SEPARATOR = "\t";
-
- public CDERow() {
- vals = new Vector<CDEValue>();
- }
-
- public String toString() {
- StringBuilder rStr = new StringBuilder();
- if (vals != null && vals.size() > 0) {
- for (CDEValue v : vals) {
- rStr.append(v.getVal()).append(COL_SEPARATOR);
- }
-
- rStr.deleteCharAt(rStr.length() - 1);
- }
-
- return rStr.toString();
- }
-
- /**
- * @return the vals
- */
- public List<CDEValue> getVals() {
- return vals;
- }
-
- /**
- * @param vals
- * the vals to set
- */
- public void setVals(List<CDEValue> vals) {
- this.vals = vals;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/main/java/org/apache/oodt/xmlps/structs/CDEValue.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/structs/CDEValue.java b/xmlps/src/main/java/org/apache/oodt/xmlps/structs/CDEValue.java
deleted file mode 100644
index 43a8400..0000000
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/structs/CDEValue.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.xmlps.structs;
-
-/**
- *
- * <p>
- * A cde name and a value returned from a query against a Product Server
- * </p>.
- */
-public class CDEValue {
-
- private String cdeName;
-
- private String val;
-
- public CDEValue() {
-
- }
-
- public CDEValue(String cdeName, String val) {
- this.cdeName = cdeName;
- this.val = val;
- }
-
- /**
- * @return the cdeName
- */
- public String getCdeName() {
- return cdeName;
- }
-
- /**
- * @param cdeName
- * the cdeName to set
- */
- public void setCdeName(String cdeName) {
- this.cdeName = cdeName;
- }
-
- /**
- * @return the val
- */
- public String getVal() {
- return val;
- }
-
- /**
- * @param val
- * the val to set
- */
- public void setVal(String val) {
- this.val = val;
- }
-
- public String toString(){
- return "[cdeName="+this.cdeName+",val="+this.val+"]";
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/main/java/org/apache/oodt/xmlps/util/GenericCDEObjectFactory.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/util/GenericCDEObjectFactory.java b/xmlps/src/main/java/org/apache/oodt/xmlps/util/GenericCDEObjectFactory.java
deleted file mode 100644
index ad1534a..0000000
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/util/GenericCDEObjectFactory.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.xmlps.util;
-
-//JDK imports
-import org.apache.oodt.xmlps.mapping.funcs.MappingFunc;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-//OODT imports
-
-/**
- *
- * <p>
- * An object factory for creating CDE objects.
- * </p>.
- */
-public final class GenericCDEObjectFactory {
-
- /* our log stream */
- private static final Logger LOG = Logger
- .getLogger(GenericCDEObjectFactory.class.getName());
-
- private GenericCDEObjectFactory() throws InstantiationException {
- throw new InstantiationException("Don't construct object factories!");
- }
-
- public static MappingFunc getMappingFuncFromClassName(String className) {
- MappingFunc func;
- Class funcClazz;
- try {
- funcClazz = Class.forName(className);
- func = (MappingFunc) funcClazz.newInstance();
- return func;
- } catch (ClassNotFoundException e) {
- LOG.log(Level.SEVERE, e.getMessage());
- LOG.log(Level.WARNING, "Unable to load class: [" + className
- + "]: class not found! message: " + e.getMessage(), e);
- return null;
- } catch (InstantiationException e) {
- LOG.log(Level.SEVERE, e.getMessage());
- LOG.log(Level.WARNING, "Unable to load class: [" + className
- + "]: cannot instantiate! message: " + e.getMessage(), e);
- return null;
- } catch (IllegalAccessException e) {
- LOG.log(Level.SEVERE, e.getMessage());
- LOG.log(Level.WARNING, "Unable to load class: [" + className
- + "]: illegal access! message: " + e.getMessage(), e);
- return null;
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/main/java/org/apache/oodt/xmlps/util/XMLQueryHelper.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/util/XMLQueryHelper.java b/xmlps/src/main/java/org/apache/oodt/xmlps/util/XMLQueryHelper.java
deleted file mode 100644
index c414102..0000000
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/util/XMLQueryHelper.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.xmlps.util;
-
-//OODT imports
-import org.apache.oodt.xmlquery.XMLQuery;
-
-/**
- *
- * <p>
- * Helper methods to handle those pesky {@link XMLQuery} objects.
- * </p>.
- */
-public final class XMLQueryHelper implements XMLQueryKeys{
-
- public static XMLQuery getDefaultQueryFromQueryString(String query) {
- return new XMLQuery(query/* keywordQuery */, ""/* id */,
- ""/* title */, ""/* desc */, ""/* ddId */,
- ""/* resultModeId */, ""/* propType */, ""/* propLevels */,
- XMLQuery.DEFAULT_MAX_RESULTS/* maxResults */);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/main/java/org/apache/oodt/xmlps/util/XMLQueryKeys.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/util/XMLQueryKeys.java b/xmlps/src/main/java/org/apache/oodt/xmlps/util/XMLQueryKeys.java
deleted file mode 100644
index 137e54b..0000000
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/util/XMLQueryKeys.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.xmlps.util;
-
-/**
- *
- * <p>Met Keys for dealing with {@link org.apache.oodt.xmlquery.XMLQuery}s</p>.
- */
-public interface XMLQueryKeys {
-
- String ROLE_LITERAL = "LITERAL";
-
- String ROLE_ELEMNAME = "elemName";
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/test/java/org/apache/oodt/xmlps/mapping/TestMappingReader.java
----------------------------------------------------------------------
diff --git a/xmlps/src/test/java/org/apache/oodt/xmlps/mapping/TestMappingReader.java b/xmlps/src/test/java/org/apache/oodt/xmlps/mapping/TestMappingReader.java
deleted file mode 100644
index d0b37ca..0000000
--- a/xmlps/src/test/java/org/apache/oodt/xmlps/mapping/TestMappingReader.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.xmlps.mapping;
-
-//APACHE imports
-
-import org.apache.oodt.xmlps.mapping.funcs.MappingFunc;
-import org.apache.oodt.xmlps.structs.CDEValue;
-
-import java.io.InputStream;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import junit.framework.TestCase;
-
-/**
- * Test suite for XMLPS xml map file reader.
- */
-public class TestMappingReader extends TestCase {
- private static Logger LOG = Logger.getLogger(TestMappingReader.class.getName());
- private static final String expectedName = "Test Query Handler";
-
- private static final String expectedId = "urn:oodt:xmlps:testps";
-
- private static final int expectedFields = 43;
-
- private static final String SPECIMEN_CONTACT_EMAIL_TEXT = "SPECIMEN_CONTACT-EMAIL_TEXT";
-
- private static final String SPECIMEN_COLLECTED_CODE = "SPECIMEN_COLLECTED_CODE";
-
- private static final String SPECIMEN_TISSUE_ORGAN_SITE_CODE = "SPECIMEN_TISSUE_ORGAN-SITE_CODE";
-
- private static final String CONTACT_PERSON_EMAIL = "Brendan.Phalan@med.nyu.edu";
-
- private static final String expectedDefaultTable = "baseline";
-
- private static final String expectedJoinFld = "patient_id";
-
- public TestMappingReader() {
-
- }
-
- public void testReadTables() {
- Mapping mapping = getMappingOrFail();
- assertNotNull(mapping);
-
- assertEquals(1, mapping.getNumTables());
- assertNull(mapping.getTableByName("baseline"));
- assertNotNull(mapping.getTableByName("specimen"));
- assertNotNull(mapping.getDefaultTable());
- assertEquals(expectedDefaultTable, mapping.getDefaultTable());
- assertEquals(expectedJoinFld, mapping.getTableByName("specimen")
- .getJoinFieldName());
- }
-
- public void testReadBasicInfo() {
- Mapping mapping = getMappingOrFail();
-
- assertNotNull(mapping);
- assertEquals(expectedName, mapping.getName());
- assertEquals(expectedId, mapping.getId());
- }
-
- public void testReadFields() {
- Mapping mapping = getMappingOrFail();
- assertNotNull(mapping);
- assertEquals(expectedFields, mapping.getNumFields());
- containsSpecimenContactEmailTextOrFail(mapping);
- containsSpecimenCollectedCodeOrFail(mapping);
-
- }
-
- public void testReadFuncs() {
- Mapping mapping = getMappingOrFail();
- assertNotNull(mapping);
- assertTrue(mapping.getNumFields() > 0);
-
- MappingField funcField = mapping
- .getFieldByName(SPECIMEN_TISSUE_ORGAN_SITE_CODE);
- assertNotNull(funcField);
-
- assertNotNull(funcField.getFuncs());
- assertEquals(funcField.getFuncs().size(), 1);
-
- MappingFunc func = funcField.getFuncs().get(0);
- CDEValue val = new CDEValue("test", "16");
- CDEValue result = func.translate(val);
- assertNotNull(result);
- assertEquals(result.getVal(), "1");
- val.setVal("235");
- result = func.translate(val);
- assertEquals(result.getVal(), "235");
- }
-
- public void testMappingFieldGetLocalName() {
- Mapping mapping = getMappingOrFail("test-same-col-name-ps.xml");
-
- MappingField fieldOnly = mapping.getFieldByName("field_only");
- assertEquals("defaultTable.field_only", fieldOnly.getLocalName());
-
- MappingField fieldWithTable = mapping.getFieldByName("field_with_table");
- assertEquals("anotherTable.field_db", fieldWithTable.getLocalName());
-
- MappingField fieldUseDefault = mapping.getFieldByName("field_use_default");
- assertEquals("defaultTable.field_db", fieldUseDefault.getLocalName());
- }
-
- private void containsSpecimenCollectedCodeOrFail(Mapping mapping) {
-
- MappingField fld = mapping.getFieldByName(SPECIMEN_COLLECTED_CODE);
- assertNotNull(fld);
- assertTrue(fld.getType().equals(FieldType.DYNAMIC));
- assertFalse(fld.getType().equals(FieldType.CONSTANT));
- assertEquals("specimen_collected", fld.getDbName());
- assertEquals("specimen", fld.getTableName());
-
- }
-
- private void containsSpecimenContactEmailTextOrFail(Mapping mapping) {
- MappingField fld = mapping.getFieldByName(SPECIMEN_CONTACT_EMAIL_TEXT);
- assertNotNull(fld);
- assertEquals(fld.getConstantValue(), CONTACT_PERSON_EMAIL);
- assertTrue(fld.getType().equals(FieldType.CONSTANT));
- assertFalse(fld.getType().equals(FieldType.DYNAMIC));
- assertTrue(fld.getScope().equals(FieldScope.RETURN));
- assertFalse(fld.getScope().equals(FieldScope.QUERY));
-
- }
-
- private Mapping getMappingOrFail() {
- return getMappingOrFail("test-ps.xml");
- }
-
- private Mapping getMappingOrFail(String mapfile) {
- Mapping mapping = null;
-
- InputStream configFileIs = TestMappingReader.class
- .getResourceAsStream(mapfile);
-
- try {
- mapping = MappingReader.getMapping(configFileIs);
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- fail(e.getMessage());
- }
-
- return mapping;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/test/java/org/apache/oodt/xmlps/product/TestXMLPSProductHandler.java
----------------------------------------------------------------------
diff --git a/xmlps/src/test/java/org/apache/oodt/xmlps/product/TestXMLPSProductHandler.java b/xmlps/src/test/java/org/apache/oodt/xmlps/product/TestXMLPSProductHandler.java
deleted file mode 100644
index a798d26..0000000
--- a/xmlps/src/test/java/org/apache/oodt/xmlps/product/TestXMLPSProductHandler.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.xmlps.product;
-
-//JDK imports
-import java.util.List;
-import java.util.Set;
-
-//APACHE imports
-import org.apache.oodt.xmlps.mapping.DatabaseTable;
-import org.apache.oodt.xmlps.util.XMLQueryHelper;
-import org.apache.oodt.xmlquery.QueryElement;
-import org.apache.oodt.xmlquery.XMLQuery;
-
-//Junit imports
-import junit.framework.TestCase;
-
-/**
- * Tests the XMLPS product handler.
- */
-public class TestXMLPSProductHandler extends TestCase {
-
- private static final String expectedSpecimenFldName = "specimen.specimen_collected";
-
- private XMLPSProductHandler handler;
-
- private static final String specimenCollectedCodeField = "SPECIMEN_COLLECTED_CODE";
-
- private static final String studyProtocolIdField = "STUDY_PROTOCOL_ID";
-
- private static final String unconstrainedQuery = "RETURN = STUDY_PARTICIPANT_ID";
-
- private static final String queryStr = specimenCollectedCodeField
- + " = 3 AND " + studyProtocolIdField + " = 71 AND RETURN = "
- + specimenCollectedCodeField;
-
- public void setUp() {
- System.setProperty("org.apache.oodt.xmlps.xml.mapFilePath",
- "./src/test/resources/test-ps.xml");
-
- try {
- handler = new XMLPSProductHandler();
- } catch (InstantiationException e) {
- fail("Can't construct test suite: exception building test handler");
- }
- }
-
- public void testAllowUnConstrainedQuery(){
- XMLQuery query = XMLQueryHelper
- .getDefaultQueryFromQueryString(unconstrainedQuery);
-
-
- assertNotNull(query);
- assertNotNull(query.getWhereElementSet());
- assertTrue(query.getWhereElementSet().size() == 0);
- assertNotNull(query.getSelectElementSet());
- assertTrue(query.getSelectElementSet().size() == 1);
-
- try{
- handler.translateToDomain(query.getSelectElementSet(), true);
- }
- catch(Exception e){
- fail(e.getMessage());
- }
-
- try{
- handler.queryAndPackageResults(query);
- }
- catch(Exception e){
- fail(e.getMessage());
- }
-
- }
-
- public void testDomainTranslationWhereSet() {
- XMLQuery query = XMLQueryHelper
- .getDefaultQueryFromQueryString(queryStr);
-
- assertNotNull(query);
- assertNotNull(query.getWhereElementSet());
- assertEquals(7, query.getWhereElementSet().size());
-
- try {
- handler.translateToDomain(query.getWhereElementSet(), false);
- } catch (Exception e) {
- fail(e.getMessage());
- }
- List<QueryElement> elemNames = handler
- .getElemNamesFromQueryElemSet(query.getWhereElementSet());
- assertNotNull(elemNames);
- assertEquals(1, elemNames.size()); // only 1 b/c one field is constant
-
- boolean gotSpecCollected = false;
- for (QueryElement elem : elemNames) {
- if (elem.getValue().equals("specimen.specimen_collected")) {
- gotSpecCollected = true;
- }
-
- }
-
- assertTrue(gotSpecCollected);
-
- }
-
- public void testDomainTranslationSelectSet() {
-
- XMLQuery query = XMLQueryHelper
- .getDefaultQueryFromQueryString(queryStr);
-
- assertNotNull(query);
- assertNotNull(query.getSelectElementSet());
- assertEquals(1, query.getSelectElementSet().size());
- try {
- handler.translateToDomain(query.getSelectElementSet(), true);
- } catch (Exception e) {
- fail(e.getMessage());
- }
- assertNotNull(query.getSelectElementSet());
- assertEquals(1, query.getSelectElementSet().size());
- assertNotNull(query.getSelectElementSet().get(0));
- QueryElement elem = (QueryElement) query.getSelectElementSet().get(0);
- assertNotNull(elem.getValue());
- assertEquals("Expected: [" + expectedSpecimenFldName + "]: got: ["
- + elem.getValue() + "]", elem.getValue(),
- expectedSpecimenFldName);
-
- }
-
- public void testGetRequiredTables() {
- System.setProperty("org.apache.oodt.xmlps.xml.mapFilePath",
- "./src/test/resources/test-required-tables-ps.xml");
-
- try {
- handler = new XMLPSProductHandler();
- } catch (InstantiationException e) {
- fail(e.getMessage());
- }
-
- String queryStr = "RETURN = id AND RETURN = id_1 AND RETURN = id_2 AND RETURN = id_3 AND RETURN = id_4";
- XMLQuery query = XMLQueryHelper.getDefaultQueryFromQueryString(queryStr);
-
- List<QueryElement> where = query.getWhereElementSet();
- List<QueryElement> select = query.getSelectElementSet();
-
- try {
- handler.translateToDomain(where, false);
- handler.translateToDomain(select, true);
- } catch (Exception e) {
- fail(e.getMessage());
- }
-
- List<QueryElement> whereNames = handler.getElemNamesFromQueryElemSet(where);
- List<QueryElement> selectNames = handler.getElemNamesFromQueryElemSet(select);
-
- Set<DatabaseTable> tables = handler.getRequiredTables(whereNames, selectNames);
-
- assertEquals(7, tables.size());
- assertTrue(tables.contains(handler.mapping.getTableByName("joinToDefault")));
- assertTrue(tables.contains(handler.mapping.getTableByName("joinToExtraDefault")));
- assertTrue(tables.contains(handler.mapping.getTableByName("joinToExtraJoin")));
- assertTrue(tables.contains(handler.mapping.getTableByName("joinToExtraOther")));
- assertTrue(tables.contains(handler.mapping.getTableByName("extraDefault")));
- assertTrue(tables.contains(handler.mapping.getTableByName("extraOther")));
- assertTrue(tables.contains(handler.mapping.getTableByName("other")));
- assertTrue(!tables.contains(handler.mapping.getTableByName("another")));
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/test/java/org/apache/oodt/xmlps/profile/TestXMLPSProfileHandler.java
----------------------------------------------------------------------
diff --git a/xmlps/src/test/java/org/apache/oodt/xmlps/profile/TestXMLPSProfileHandler.java b/xmlps/src/test/java/org/apache/oodt/xmlps/profile/TestXMLPSProfileHandler.java
deleted file mode 100644
index 818d842..0000000
--- a/xmlps/src/test/java/org/apache/oodt/xmlps/profile/TestXMLPSProfileHandler.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.xmlps.profile;
-
-//APACHE imports
-import org.apache.oodt.xmlps.util.XMLQueryHelper;
-import org.apache.oodt.xmlquery.XMLQuery;
-
-//Junit imports
-import junit.framework.TestCase;
-
-/**
- * Tests the XMLPS profile handler.
- */
-public class TestXMLPSProfileHandler extends TestCase {
-
- private static XMLPSProfileHandler handler;
-
- private static final String unconstrainedQuery = "RETURN = STUDY_PARTICIPANT_ID";
-
- public TestXMLPSProfileHandler() {
- System.setProperty("org.apache.oodt.xmlps.profile.xml.mapFilePath",
- "./src/test/resources/test-ps.xml");
-
- try {
- handler = new XMLPSProfileHandler();
- } catch (InstantiationException e) {
- fail("Can't construct test suite: exception building test handler");
- }
- }
-
- public void testAllowUnConstrainedQuery() {
- XMLQuery query = XMLQueryHelper
- .getDefaultQueryFromQueryString(unconstrainedQuery);
-
- assertNotNull(query);
- assertNotNull(query.getWhereElementSet());
- assertTrue(query.getWhereElementSet().size() == 0);
- assertNotNull(query.getSelectElementSet());
- assertTrue(query.getSelectElementSet().size() == 1);
-
- try {
- handler.translateToDomain(query.getSelectElementSet(), true);
- } catch (Exception e) {
- fail(e.getMessage());
- }
-
- try {
- handler.queryAndPackageProfiles(query);
- } catch (Exception e) {
- fail(e.getMessage());
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/test/java/org/apache/oodt/xmlps/queryparser/TestHandlerQueryParser.java
----------------------------------------------------------------------
diff --git a/xmlps/src/test/java/org/apache/oodt/xmlps/queryparser/TestHandlerQueryParser.java b/xmlps/src/test/java/org/apache/oodt/xmlps/queryparser/TestHandlerQueryParser.java
deleted file mode 100644
index 4591927..0000000
--- a/xmlps/src/test/java/org/apache/oodt/xmlps/queryparser/TestHandlerQueryParser.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.xmlps.queryparser;
-
-//APACHE imports
-import org.apache.oodt.xmlps.mapping.Mapping;
-import org.apache.oodt.xmlps.mapping.MappingField;
-import org.apache.oodt.xmlps.queryparser.Expression;
-import org.apache.oodt.xmlps.queryparser.HandlerQueryParser;
-import org.apache.oodt.xmlps.util.XMLQueryHelper;
-import org.apache.oodt.xmlquery.QueryElement;
-import org.apache.oodt.xmlquery.XMLQuery;
-
-//JDK imports
-import java.util.List;
-import java.util.Stack;
-
-//Junit imports
-import junit.framework.TestCase;
-
-/**
- * Tests the XMLPS query handler parser.
- */
-public class TestHandlerQueryParser extends TestCase {
-
- public TestHandlerQueryParser() {
- }
-
- public void testParseQuery() {
- String queryStr = "A = B AND C = D";
- String expected = "(C = D AND A = B)";
-
- XMLQuery query = XMLQueryHelper.getDefaultQueryFromQueryString(queryStr);
- assertNotNull(query);
- Stack<QueryElement> queryStack = HandlerQueryParser.createQueryStack(query
- .getWhereElementSet());
- assertNotNull(queryStack);
- Expression parsedQuery = HandlerQueryParser.parse(queryStack);
- assertNotNull(parsedQuery);
- assertEquals(expected, parsedQuery.evaluate());
- }
-
- public void testParseWildcardWithMapping(){
- String queryStr = "bar LIKE 'FOO'";
- String expected = "bar LIKE '%FOO%'";
- Mapping mapping = new Mapping();
- MappingField mf = new MappingField();
- mf.setDbName("bar");
- mf.setName("foo");
- mf.setString(true);
- mapping.addField("foo", mf);
-
- XMLQuery query = XMLQueryHelper.getDefaultQueryFromQueryString(queryStr);
- assertNotNull(query);
- Stack<QueryElement> queryStack = HandlerQueryParser.createQueryStack(query
- .getWhereElementSet());
- assertNotNull(queryStack);
- Expression parsedQuery = HandlerQueryParser.parse(queryStack, mapping);
- assertNotNull(parsedQuery);
- assertEquals(expected, parsedQuery.evaluate());
- }
-
- private Mapping createFooBarMapping() {
- Mapping m = new Mapping();
- MappingField foof = new MappingField();
- foof.setName("foo");
- foof.setDbName("foo");
- foof.setString(true);
- MappingField barf = new MappingField();
- barf.setName("bar");
- barf.setDbName("bar");
- barf.setString(true);
- m.addField("foo", foof);
- m.addField("bar", barf);
- return m;
- }
-
- public void testParseLiteralQuotesWithParen() {
- Mapping m = createFooBarMapping();
-
- String q = "(foo = 'yes' OR bar = 'no') AND RETURN = foo AND RETURN = bar";
- String expected = "(bar = 'no' OR foo = 'yes')";
-
- XMLQuery query = XMLQueryHelper.getDefaultQueryFromQueryString(q);
- assertNotNull(query);
- Stack<QueryElement> where = HandlerQueryParser.createQueryStack(query.getWhereElementSet());
- assertNotNull(where);
- List<QueryElement> select = query.getSelectElementSet();
- assertNotNull(select);
-
- Expression parsed = HandlerQueryParser.parse(where, m);
- assertNotNull(parsed);
- assertEquals(expected, parsed.evaluate());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/test/java/org/apache/oodt/xmlps/structs/TestCDEResult.java
----------------------------------------------------------------------
diff --git a/xmlps/src/test/java/org/apache/oodt/xmlps/structs/TestCDEResult.java b/xmlps/src/test/java/org/apache/oodt/xmlps/structs/TestCDEResult.java
deleted file mode 100644
index 3cf23b3..0000000
--- a/xmlps/src/test/java/org/apache/oodt/xmlps/structs/TestCDEResult.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.xmlps.structs;
-
-import static org.easymock.EasyMock.expect;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
-
-import junit.framework.TestCase;
-
-import org.easymock.EasyMock;
-import org.easymock.IMocksControl;
-
-public class TestCDEResult extends TestCase {
-
- private static final String ID = "123";
- private static final String LAST = "doe";
- private static final String FIRST = "john";
- private static final String DOB = "1980-01-01 00:00:00.0";
-
- private static final String ID1 = "321";
- private static final String LAST1 = "smith";
- private static final String FIRST1 = "jane";
- private static final String DOB1 = "1990-01-01 00:00:00.0";
-
- private static final String FS = "\t";
- private static final String RS = "$";
-
- private ResultSet rs;
- private Connection con;
- private ResultSetMetaData rsmet;
- private CDEResult result;
- private IMocksControl ctrl;
-
- @Override
- protected void setUp() throws Exception {
- ctrl = EasyMock.createNiceControl();
- rs = ctrl.createMock(ResultSet.class);
- con = ctrl.createMock(Connection.class);
- rsmet = ctrl.createMock(ResultSetMetaData.class);
- expect(rs.next()).andReturn(true);
- expect(rsmet.getColumnCount()).andReturn(4).anyTimes();
- expect(rs.getMetaData()).andReturn(rsmet).anyTimes();
- expect(rs.getString(1)).andReturn(ID);
- expect(rs.getString(2)).andReturn(LAST);
- expect(rs.getString(3)).andReturn(FIRST);
- expect(rs.getString(4)).andReturn(DOB);
- expect(rs.next()).andReturn(true);
- expect(rs.getString(1)).andReturn(ID1);
- expect(rs.getString(2)).andReturn(LAST1);
- expect(rs.getString(3)).andReturn(FIRST1);
- expect(rs.getString(4)).andReturn(DOB1);
- expect(rs.next()).andReturn(false);
- ctrl.replay();
- result = new CDEResult(rs,con);
- }
-
- public void testGetInputStream() {
- InputStream in = null;
- try {
- in = result.getInputStream();
- } catch (IOException e) {
- fail("Could not get inputstream: " + e.getMessage());
- }
- assertNotNull(in);
- assertEquals(CDEResultInputStream.class, in.getClass());
-
- boolean thrown = false;
- try {
- in = new CDEResult(null, con).getInputStream();
- } catch (IOException e) {
- thrown = true;
- }
- assertTrue("InputStream should throw IOException with null ResultSet!", thrown);
-
- thrown = false;
- try {
- in = new CDEResult(rs, null).getInputStream();
- } catch (IOException e) {
- thrown = true;
- }
- assertTrue("InputStream should throw IOException with null Connection!", thrown);
- }
-
- public void testGetNextRowAsString() {
- try {
- assertEquals(ID + FS + LAST + FS + FIRST + FS + DOB + RS, result.getNextRowAsString());
- assertEquals(ID1 + FS + LAST1 + FS + FIRST1 + FS + DOB1 + RS, result.getNextRowAsString());
- } catch (SQLException e) {
- fail("Could not get next row: " + e.getMessage());
- }
- }
-
- public void testGetMimeType() {
- assertEquals("text/plain", result.getMimeType());
- }
-
- public void testGetSize() {
- assertEquals(-1, result.getSize());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/test/java/org/apache/oodt/xmlps/structs/TestCDEResultInputStream.java
----------------------------------------------------------------------
diff --git a/xmlps/src/test/java/org/apache/oodt/xmlps/structs/TestCDEResultInputStream.java b/xmlps/src/test/java/org/apache/oodt/xmlps/structs/TestCDEResultInputStream.java
deleted file mode 100644
index fd01cc5..0000000
--- a/xmlps/src/test/java/org/apache/oodt/xmlps/structs/TestCDEResultInputStream.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.xmlps.structs;
-
-import static org.easymock.EasyMock.expect;
-
-import java.io.IOException;
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-
-import junit.framework.TestCase;
-
-import org.easymock.EasyMock;
-import org.easymock.IMocksControl;
-
-public class TestCDEResultInputStream extends TestCase {
-
- private static final String ID = "123";
- private static final String LAST = "doe";
- private static final String FIRST = "john";
- private static final String DOB = "1980-01-01 00:00:00.0";
-
- private static final String ID1 = "321";
- private static final String LAST1 = "smith";
- private static final String FIRST1 = "jane";
- private static final String DOB1 = "1990-01-01 00:00:00.0";
-
- private static final String FS = "\t";
- private static final String RS = "$";
-
- private ResultSet rs;
- private Connection con;
- private ResultSetMetaData rsmet;
- private CDEResult result;
- private CDEResultInputStream in;
- private IMocksControl ctrl;
-
- @Override
- protected void setUp() throws Exception {
- ctrl = EasyMock.createNiceControl();
- rs = ctrl.createMock(ResultSet.class);
- con = ctrl.createMock(Connection.class);
- rsmet = ctrl.createMock(ResultSetMetaData.class);
- expect(rs.next()).andReturn(true);
- expect(rsmet.getColumnCount()).andReturn(4).anyTimes();
- expect(rs.getMetaData()).andReturn(rsmet).anyTimes();
- expect(rs.getString(1)).andReturn(ID);
- expect(rs.getString(2)).andReturn(LAST);
- expect(rs.getString(3)).andReturn(FIRST);
- expect(rs.getString(4)).andReturn(DOB);
- expect(rs.next()).andReturn(true);
- expect(rs.getString(1)).andReturn(ID1);
- expect(rs.getString(2)).andReturn(LAST1);
- expect(rs.getString(3)).andReturn(FIRST1);
- expect(rs.getString(4)).andReturn(DOB1);
- expect(rs.next()).andReturn(false);
- ctrl.replay();
- result = new CDEResult(rs,con);
- in = new CDEResultInputStream(result);
- }
-
- @Override
- protected void tearDown() throws Exception {
- in.close();
- }
-
- public void testRead() {
- String expected = ID + FS + LAST + FS + FIRST + FS + DOB + RS;
- String expected1 = ID1 + FS + LAST1 + FS + FIRST1 + FS + DOB1 + RS;
- try {
- for (int i = 0; i < expected.length(); i++) {
- assertEquals((int)expected.charAt(i), in.read());
- }
- for (int i = 0; i < expected1.length(); i++) {
- assertEquals((int)expected1.charAt(i), in.read());
- }
- assertEquals(-1, in.read());
- } catch (IOException e) {
- fail("IOException: " + e.getMessage());
- }
- }
-
- public void testReadCharArrayIntInt() {
- byte[] buf = new byte[128];
- int n;
- int length;
- String expected;
-
- try {
- expected = ID + FS + LAST;
- length = expected.length();
- n = in.read(buf, 0, length);
- assertEquals(length, n);
- assertEquals(expected, new String(buf, 0, n));
-
- expected = FS + FIRST;
- length = expected.length();
- n = in.read(buf, 0, length);
- assertEquals(length, n);
- assertEquals(expected, new String(buf, 0, n));
-
- expected = FS + DOB.substring(0, length-1);
- length = expected.length();
- n = in.read(buf, 0, length);
- assertEquals(length, n);
- assertEquals(expected, new String(buf, 0, n));
-
- expected = DOB.substring(4) + RS + ID1 + FS + LAST1 + FS + FIRST1 + FS + DOB1 + RS;
- length = buf.length;
- n = in.read(buf, 0, length);
- assertEquals(expected.length(), n);
- assertEquals(expected, new String(buf, 0, n));
-
- n = in.read(buf, 0, 10);
- assertEquals(-1, n);
- } catch (IOException e) {
- fail("IOException: " + e.getMessage());
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/test/resources/loging.properties
----------------------------------------------------------------------
diff --git a/xmlps/src/test/resources/loging.properties b/xmlps/src/test/resources/loging.properties
deleted file mode 100644
index 215e4a5..0000000
--- a/xmlps/src/test/resources/loging.properties
+++ /dev/null
@@ -1,34 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-# Specify the handlers to create in the root logger
-# (all loggers are children of the root logger)
-# The following creates one handlers
-handlers = java.util.logging.ConsoleHandler
-
-# Set the default logging level for the root logger
-.level = ALL
-
-# Set the default logging level for new ConsoleHandler instances
-java.util.logging.ConsoleHandler.level = ALL
-
-# Set the default formatter for new ConsoleHandler instances
-java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
-
-# Set the default logging level
-# disable output of INFO messages from product handler
-org.apache.oodt.xmlps.product.level = SEVERE
-org.apache.oodt.xmlps.profile.level = SEVERE
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/test/resources/test-ps.xml
----------------------------------------------------------------------
diff --git a/xmlps/src/test/resources/test-ps.xml b/xmlps/src/test/resources/test-ps.xml
deleted file mode 100644
index c073fc3..0000000
--- a/xmlps/src/test/resources/test-ps.xml
+++ /dev/null
@@ -1,120 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-<oodt:ps xmlns:oodt="http://oodt.jpl.nasa.gov/xmlps/1.0" name="Test Query Handler" id="urn:oodt:xmlps:testps">
-<tables default="baseline">
- <table name="specimen" join="patient_id" tofld="participant_num"/>
-</tables>
-
- <!--
- field:
-
- type (required): dyanmic or constant. If you choose dynamic, then the field
- value is read from the row in the ResultSet returned
- from the database. If constant, then each returned row
- from the ResultSet is annotated with the value specified
- in the 'value' attribute.
-
- dbname (optional): the name of the field within the underlying db. If not
- specified, then assumed to be name
-
- name (required): the name of the attribute that you want returned
- in the product server.
-
- table (optional): if provided, then the attribute a is selected as
- 'table'.'a',and then returned. If omitted, the attribute
- is assumed to come from the default table returned from the
- PS query.
-
- value (optional): is necessary to provide if type='constant' is selected.
-
- scope (optional): limits the scope of a field's existance: acceptable values
- are "query", which signifies that the field is only applicable when
- translating queries: and "return", which signifies the field is only
- applicable as a return field when converting database results into ERNEResults.
-
- -->
- <field type="dynamic" dbname="specimen_collected" table="specimen"
- name="SPECIMEN_COLLECTED_CODE" appendTableName="true"/>
- <field type="constant" name="STUDY_SITE_ID" value="71" />
- <field type="constant" name="STUDY_PROTOCOL_ID" value="XX" />
- <field type="dynamic" dbname="" name="STUDY_PARTICIPANT_ID" />
- <field type="constant" name="SPECIMEN_STUDY-DESIGN_CODE"
- value="prospective" />
- <field type="constant" name="SPECIMEN_CONTACT_NAME-TEXT"
- value="Brendan Phalan" />
- <field type="constant" name="SPECIMEN_CONTACT-EMAIL_TEXT"
- value="Brendan.Phalan@med.nyu.edu" scope="return"/>
- <field type="constant" name="BASELINE_DEMOGRAPHICS-GENDER_CODE"
- value="1" />
- <field type="constant" name="BASELINE_DEMOGRAPHICS-ETHNIC_CODE"
- value="1" />
- <field type="constant" name="BASELINE_DEMOGRAPHICS_RACE_CODE"
- value="1" />
- <field type="dynamic" name="BASELINE_DEMOGRAPHICS-RACE_OTHER_TEXT" />
- <field type="dynamic" name="BASELINE_DEMOGRAPHICS-BIRTH-YEAR_TEXT" />
- <field type="dynamic" name="BASELINE_SMOKE-REGULAR_1YEAR_CODE" />
- <field type="dynamic"
- name="BASELINE_SMOKE-HX_BEGIN-AGE-REGULAR_VALUE" />
- <field type="dynamic" name="BASELINE_SMOKE-HX_AVERAGE-DAY_VALUE" />
- <field type="dynamic" name="BASELINE_SMOKE-HX_QUIT-AGE_VALUE" />
- <field type="dynamic" name="BASELINE_CANCER-CONFIRMATION_CODE" />
- <field type="constant" name="BASELINE_CANCER-ICD9-CODE"
- value="UNKNOWN" />
- <field type="constant" name="BASELINE_CANCER-DIAGNOSIS_YEAR_TEXT"
- value="UNKNOWN" />
- <field type="constant" name="BASELINE_CANCER-AGE-DIAGNOSIS_VALUE"
- value="UNKNOWN" />
- <field type="dynamic"
- name="BASELINE_FAMILY_CANCER-CONFIRMATION_CODE" />
- <field type="dynamic" name="BASELINE_FAMILY_CANCER-LOCATION_CODE" />
- <field type="constant"
- name="BASELINE_FAMILY_CANCER-LOCATION-OTHER_TEXT" value="UNKNOWN" />
- <field type="dynamic" name="SPECIMEN_COLLECTION_TEXT" />
- <field type="dynamic" name="SPECIMEN_STORED_CODE" />
- <field type="dynamic" name="SPECIMEN_FINAL-STORE_CODE" />
- <field type="constant" name="SPECIMEN_FINAL-STORE-OTHER_TEXT"
- value="UNKNOWN" />
- <field type="dynamic" name="SPECIMEN_DAY-COLLECTED_VALUE" />
- <field type="constant" name="SPECIMEN_DAY-CA-DIAGNOSIS_VALUE"
- value="UNKNOWN" />
- <field type="dynamic" name="SPECIMEN_AGE-COLLECTED_VALUE" />
- <field type="dynamic" name="SPECIMEN_AMOUNT-STORED_VALUE" />
- <field type="constant" name="SPECIMEN_AMOUNT-STORED-UNIT_CODE"
- value="1" />
- <field type="dynamic" name="SPECIMEN_AMOUNT_REMAINING_VALUE" />
- <field type="dynamic" name="SPECIMEN_AMOUNT_REMAINING_UNIT_CODE" />
- <field type="dynamic" name="SPECIMEN_CONCENTRATION_VALUE" />
- <field type="dynamic" name="SPECIMEN_AVAILABLE_CODE" />
- <field type="dynamic" name="SPECIMEN_TISSUE_ORGAN-SITE_CODE">
- <translate>
- <func class="org.apache.oodt.xmlps.mapping.funcs.ReplaceFunc" orig="16" with="1" />
- </translate>
- </field>
- <field type="constant" name="SPECIMEN_TISSUE-ORGAN-SITE-OTHER_TEXT"
- value="UNKNOWN" />
- <field type="constant" name="SPECIMEN_TISSUE_DEGREE-INVASIVE_CODE"
- value="UNKNOWN" />
- <field type="constant"
- name="SPECIMEN_TISSUE_DEGREE-INVASIVE-TUMOR_CODE" value="UNKNOWN" />
- <field type="constant" name="SPECIMEN_BONE-MARROW_BLAST_VALUE"
- value="UNKNOWN" />
- <field type="constant" name="SPECIMEN_SPUTUM_PRESERVATIVE_CODE"
- value="UNKNOWN" />
- <field type="constant"
- name="SPECIMEN_SPUTUM-PRESERVATIVE-OTHER_TEXT" value="UNKOWN" />
-</oodt:ps>
\ No newline at end of file
[10/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/RemoteSpecs.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/RemoteSpecs.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/RemoteSpecs.java
deleted file mode 100644
index 9e25a25..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/RemoteSpecs.java
+++ /dev/null
@@ -1,364 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.pushpull.config;
-
-import org.apache.oodt.cas.metadata.util.PathUtils;
-import org.apache.oodt.cas.pushpull.exceptions.ConfigException;
-import org.apache.oodt.cas.pushpull.filerestrictions.Parser;
-import org.apache.oodt.cas.pushpull.filerestrictions.renamingconventions.RenamingConvention;
-import org.apache.oodt.cas.pushpull.objectfactory.PushPullObjectFactory;
-import org.apache.oodt.cas.pushpull.protocol.RemoteSite;
-import org.apache.oodt.commons.xml.XMLUtils;
-
-import com.google.common.base.Strings;
-
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.net.URL;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.LinkedList;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-
-/**
- * Remote Site Crawling specifications.
- *
- * @author bfoster (Brian Foster)
- */
-public class RemoteSpecs implements ConfigParserMetKeys {
- private static Logger LOG = Logger.getLogger(RemoteSpecs.class.getName());
- LinkedList<Parser> parsers;
-
- LinkedList<RenamingConvention> renamingConvs;
-
- LinkedList<DaemonInfo> daemonInfoList;
-
- SiteInfo siteInfo;
-
- public RemoteSpecs() {
- this.parsers = new LinkedList<Parser>();
- this.renamingConvs = new LinkedList<RenamingConvention>();
- daemonInfoList = new LinkedList<DaemonInfo>();
- siteInfo = new SiteInfo();
- }
-
- public void loadRemoteSpecs(File remoteSpecsFile) throws ConfigException {
- try {
-
- Element root = XMLUtils.getDocumentRoot(
- new FileInputStream(remoteSpecsFile)).getDocumentElement();
- NodeList aliasSpecList = root.getElementsByTagName(ALIAS_SPEC_TAG);
- for (int i = 0; i < aliasSpecList.getLength(); i++) {
- this.parseAndStoreLoginInfo(new File(PathUtils
- .replaceEnvVariables(((Element) aliasSpecList.item(i))
- .getAttribute(FILE_ATTR))));
- }
-
- // get DAEMON elements
- NodeList daemonList = root.getElementsByTagName(DAEMON_TAG);
- for (int i = 0; i < daemonList.getLength(); i++) {
- Node daemonNode = daemonList.item(i);
-
- // check if set to active (skip otherwise)
- if (PathUtils.replaceEnvVariables(
- ((Element) daemonNode).getAttribute(ACTIVE_ATTR))
- .equals("no")) {
- continue;
- }
-
- DaemonInfo di = null;
-
- // get site alias
- String siteAlias = PathUtils
- .replaceEnvVariables(((Element) daemonNode)
- .getAttribute(ALIAS_ATTR));
- RemoteSite dataFilesRemoteSite = this.siteInfo
- .getSiteByAlias(siteAlias);
- if (dataFilesRemoteSite == null) {
- throw new ConfigException("Alias '" + siteAlias
- + "' in SiteInfo file '"
- + remoteSpecsFile.getAbsolutePath()
- + "' has not been defined");
- }
-
- // get RUNINFO element
- NodeList runInfoList = ((Element) daemonNode)
- .getElementsByTagName(RUN_INFO_TAG);
- String firstRunDateTimeString = null, period = null, epsilon = null;
- boolean runOnReboot = false;
- if (runInfoList.getLength() > 0) {
- Element runInfo = (Element) runInfoList.item(0);
- firstRunDateTimeString = runInfo
- .getAttribute(FIRSTRUN_DATETIME_ATTR);
- period = runInfo.getAttribute(PERIOD_ATTR);
- runOnReboot = (runInfo.getAttribute(RUNONREBOOT_ATTR)
- .toLowerCase().equals("yes"));
- epsilon = runInfo.getAttribute(EPSILON_ATTR);
- if (epsilon.equals("")) {
- epsilon = "0s";
- }
- }
-
- // get PROPINFO elements
- NodeList propInfoList = ((Element) daemonNode)
- .getElementsByTagName(PROP_INFO_TAG);
- LinkedList<PropFilesInfo> pfiList = new LinkedList<PropFilesInfo>();
- PropFilesInfo pfi;
- if (propInfoList.getLength() > 0) {
- Node propInfoNode = propInfoList.item(0);
-
- // get directory where the property files are
- File propertyFilesDir = new File(PathUtils
- .replaceEnvVariables(((Element) propInfoNode)
- .getAttribute(DIR_ATTR)));
-
- pfi = new PropFilesInfo(propertyFilesDir);
-
- // get PROPFILES elements
- NodeList propFilesList = ((Element) propInfoNode)
- .getElementsByTagName(PROP_FILES_TAG);
- String propFilesRegExp = null;
- if (propFilesList.getLength() > 0) {
- for (int k = 0; k < propFilesList.getLength(); k++) {
- Node propFilesNode = propFilesList.item(k);
- propFilesRegExp = ((Element) propFilesNode)
- .getAttribute(REG_EXP_ATTR);
- pfi
- .addPropFiles(
- propFilesRegExp,
- PushPullObjectFactory
- .createNewInstance((Class<Parser>) Class
- .forName(PathUtils
- .replaceEnvVariables(((Element) propFilesNode)
- .getAttribute(PARSER_ATTR)))));
- }
- } else {
- throw new ConfigException(
- "No propFiles element specified for deamon with alias '"
- + siteAlias + "' in RemoteSpecs file '"
- + remoteSpecsFile.getAbsolutePath()
- + "'");
- }
-
- // get DOWNLOADINFO element if given
- NodeList downloadInfoList = ((Element) propInfoNode)
- .getElementsByTagName(DOWNLOAD_INFO_TAG);
- if (downloadInfoList.getLength() > 0) {
- Node downloadInfo = downloadInfoList.item(0);
- String propFilesAlias = PathUtils
- .replaceEnvVariables(((Element) downloadInfo)
- .getAttribute(ALIAS_ATTR));
- String propFilesRenamingConv = ((Element) downloadInfo)
- .getAttribute(RENAMING_CONV_ATTR);
- boolean allowAliasOverride = PathUtils
- .replaceEnvVariables(
- ((Element) downloadInfo)
- .getAttribute(ALLOW_ALIAS_OVERRIDE_ATTR))
- .equals("yes");
- boolean deleteFromServer = PathUtils
- .replaceEnvVariables(
- ((Element) downloadInfo)
- .getAttribute(DELETE_FROM_SERVER_ATTR))
- .equals("yes");
- RemoteSite propFilesRemoteSite = this.siteInfo
- .getSiteByAlias(propFilesAlias);
- if (propFilesRemoteSite == null) {
- throw new ConfigException("Alias '"
- + propFilesAlias
- + "' in RemoteSpecs file '"
- + remoteSpecsFile.getAbsolutePath()
- + "' has not been defined");
- }
- String regExp = ((Element) downloadInfo)
- .getAttribute(REG_EXP_ATTR);
- if (regExp.equals("")) {
- regExp = propFilesRegExp;
- }
- NodeList propsList = ((Element) propInfoNode)
- .getElementsByTagName(PROP_FILE_TAG);
- ConcurrentHashMap<File, Parser> propFileToParserMap = new ConcurrentHashMap<File, Parser>();
- for (int p = 0; p < propsList.getLength(); p++) {
- Element propElem = (Element) propsList.item(p);
- propFileToParserMap
- .put(
- new File(
- PathUtils
- .replaceEnvVariables(propElem
- .getAttribute(PATH_ATTR))),
- PushPullObjectFactory
- .createNewInstance((Class<Parser>) Class
- .forName(PathUtils
- .replaceEnvVariables(propElem
- .getAttribute(PARSER_ATTR)))));
- }
- pfi.setDownloadInfo(new DownloadInfo(
- propFilesRemoteSite, propFilesRenamingConv,
- deleteFromServer, propertyFilesDir,
- allowAliasOverride), propFileToParserMap);
- }
-
- // get AFTERUSE element
- NodeList afterUseList = ((Element) propInfoNode)
- .getElementsByTagName(AFTER_USE_TAG);
- if (afterUseList.getLength() > 0) {
- Element afterUse = (Element) afterUseList.item(0);
- File onSuccessDir = new File(PathUtils
- .replaceEnvVariables(afterUse
- .getAttribute(MOVEON_TO_SUCCESS_ATTR)));
- File onFailDir = new File(PathUtils
- .replaceEnvVariables(afterUse
- .getAttribute(MOVEON_TO_FAIL_ATTR)));
- pfi.setAfterUseEffects(onSuccessDir, onFailDir);
- boolean deleteOnSuccess = Boolean.parseBoolean(PathUtils
- .replaceEnvVariables(afterUse
- .getAttribute(DELETE_ON_SUCCESS_ATTR)));
- pfi.setDeleteOnSuccess(deleteOnSuccess);
- }
-
- } else {
- throw new ConfigException(
- "No propInfo element specified for deamon with alias '"
- + siteAlias + "' in RemoteSpecs file '"
- + remoteSpecsFile.getAbsolutePath() + "'");
- }
-
- // get DATAINFO elements
- NodeList dataInfoList = ((Element) daemonNode)
- .getElementsByTagName(DATA_INFO_TAG);
- DataFilesInfo dfi = null;
- if (dataInfoList.getLength() > 0) {
- Node dataInfo = dataInfoList.item(0);
- String queryElement = ((Element) dataInfo)
- .getAttribute(QUERY_ELEM_ATTR);
- if (Strings.isNullOrEmpty(queryElement)) {
- queryElement = null;
- } else {
- queryElement = PathUtils.replaceEnvVariables(queryElement);
- }
- String renamingConv = ((Element) dataInfo)
- .getAttribute(RENAMING_CONV_ATTR);
- if (Strings.isNullOrEmpty(renamingConv)) {
- renamingConv = null;
- }
- boolean allowAliasOverride = PathUtils.replaceEnvVariables(
- ((Element) dataInfo)
- .getAttribute(ALLOW_ALIAS_OVERRIDE_ATTR))
- .equals("yes");
- File stagingArea = new File(PathUtils
- .replaceEnvVariables(((Element) dataInfo)
- .getAttribute(STAGING_AREA_ATTR)));
- boolean deleteFromServer = PathUtils.replaceEnvVariables(
- ((Element) dataInfo)
- .getAttribute(DELETE_FROM_SERVER_ATTR))
- .equals("yes");
- dfi = new DataFilesInfo(queryElement, new DownloadInfo(
- dataFilesRemoteSite, renamingConv,
- deleteFromServer, stagingArea, allowAliasOverride));
- } else {
- throw new ConfigException(
- "No dataInfo element specified for deamon with alias '"
- + siteAlias + "' in RemoteSpecs file '"
- + remoteSpecsFile.getAbsolutePath() + "'");
- }
-
- daemonInfoList.add(new DaemonInfo(firstRunDateTimeString,
- period, epsilon, runOnReboot, pfi, dfi));
- }
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- throw new ConfigException("Failed to load crawl elements : "
- + e.getMessage());
- }
- }
-
- void parseAndStoreLoginInfo(File loginInfoFile) throws ConfigException {
- try {
- NodeList sourceList = XMLUtils.getDocumentRoot(new FileInputStream(loginInfoFile))
- .getElementsByTagName(SOURCE_TAG);
- for (int i = 0; i < sourceList.getLength(); i++) {
-
- // get source element
- Node sourceNode = sourceList.item(i);
-
- // get host of this source
- String host = PathUtils
- .replaceEnvVariables(((Element) sourceNode)
- .getAttribute(HOST_ATTR));
-
- // get all login info for this source
- NodeList loginList = ((Element) sourceNode)
- .getElementsByTagName(LOGIN_ATTR);
- for (int j = 0; j < loginList.getLength(); j++) {
-
- // get a single login info
- Node loginNode = loginList.item(j);
- String type = PathUtils
- .replaceEnvVariables(((Element) loginNode)
- .getAttribute(TYPE_ATTR));
- String alias = PathUtils
- .replaceEnvVariables(((Element) loginNode)
- .getAttribute(ALIAS_ATTR));
- String username = null, password = null, cdTestDir = null;
- int maxConnections = -1;
-
- // parse this login info
- NodeList loginInfo = loginNode.getChildNodes();
- for (int k = 0; k < loginInfo.getLength(); k++) {
-
- // get a single login info element
- Node node = loginInfo.item(k);
-
- // determine what element type it is
- if (node.getNodeName().equals(USERNAME_TAG)) {
- username = PathUtils.replaceEnvVariables(
- XMLUtils.getSimpleElementText((Element) node, true));
- } else if (node.getNodeName().equals(PASSWORD_TAG)) {
- password = PathUtils.replaceEnvVariables(
- XMLUtils.getSimpleElementText((Element) node, true));
- } else if (node.getNodeName().equals(CD_TEST_DIR_TAG)) {
- cdTestDir = PathUtils.replaceEnvVariables(
- XMLUtils.getSimpleElementText((Element) node, true));
- } else if (node.getNodeName().equals(MAX_CONN_TAG)) {
- maxConnections = Integer.parseInt(PathUtils.replaceEnvVariables(
- XMLUtils.getSimpleElementText((Element) node, true)));
- }
- }
-
- this.siteInfo.addSite(new RemoteSite(alias, new URL(type
- + "://" + host), username, password, cdTestDir, maxConnections));
- }
- }
- } catch (Exception e) {
- throw new ConfigException("Failed to load external source info : "
- + e.getMessage(), e);
- }
- }
-
- public LinkedList<DaemonInfo> getDaemonInfoList() {
- return this.daemonInfoList;
- }
-
- public SiteInfo getSiteInfo() {
- return this.siteInfo;
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/SiteInfo.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/SiteInfo.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/SiteInfo.java
deleted file mode 100644
index 63ed83c..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/SiteInfo.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.config;
-
-//JDK imports
-import org.apache.oodt.cas.pushpull.protocol.RemoteSite;
-
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.LinkedList;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-//OODT imports
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class SiteInfo {
-
- /* our log stream */
- private final static Logger LOG = Logger.getLogger(SiteInfo.class
- .getName());
-
- private ConcurrentHashMap<String, RemoteSite> aliasAndRemoteSite;
-
- public SiteInfo() {
- aliasAndRemoteSite = new ConcurrentHashMap<String, RemoteSite>();
- }
-
- public void addSite(RemoteSite rs) {
- this.aliasAndRemoteSite.put(rs.getAlias(), rs);
- }
-
- public RemoteSite getSiteByAlias(String alias) {
- return this.aliasAndRemoteSite.get(alias);
- }
-
- public LinkedList<RemoteSite> getPossibleRemoteSites(String alias, URL url,
- String username, String password) {
- LinkedList<RemoteSite> remoteSites = new LinkedList<RemoteSite>();
- if (alias != null) {
- RemoteSite rs = this.aliasAndRemoteSite.get(alias);
- if (rs != null) {
- remoteSites.add(rs);
- } else if (url != null && username != null & password != null) {
- remoteSites.add(new RemoteSite(alias, url, username, password));
- }
- } else if (url != null) {
- Set<Entry<String, RemoteSite>> set = this.aliasAndRemoteSite
- .entrySet();
- for (Entry<String, RemoteSite> entry : set) {
- RemoteSite rs = entry.getValue();
- try {
- if (rs.getURL().toURI().equals(url.toURI())
- && (username == null || rs.getUsername().equals(
- username))
- && (password == null || rs.getPassword().equals(
- password))) {
- remoteSites.add(rs);
- }
- } catch (URISyntaxException e) {
- LOG.log(Level.SEVERE, "Could not convert URL to URI Message: "+e.getMessage());
- }
- }
- if (remoteSites.size() == 0) {
- if (username != null && password != null) {
- remoteSites.add(new RemoteSite(url.toString(), url,
- username, password));
- }
- }
- } else if (username != null) {
- Set<Entry<String, RemoteSite>> set = this.aliasAndRemoteSite
- .entrySet();
- for (Entry<String, RemoteSite> entry : set) {
- RemoteSite rs = entry.getValue();
- if (rs.getUsername().equals(username)
- && (password == null || rs.getPassword().equals(
- password))) {
- remoteSites.add(rs);
- }
- }
- } else if (password != null) {
- Set<Entry<String, RemoteSite>> set = this.aliasAndRemoteSite
- .entrySet();
- for (Entry<String, RemoteSite> entry : set) {
- RemoteSite rs = entry.getValue();
- if (rs.getPassword().equals(password)) {
- remoteSites.add(rs);
- }
- }
- }
- return remoteSites;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/Daemon.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/Daemon.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/Daemon.java
deleted file mode 100644
index 3e12268..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/Daemon.java
+++ /dev/null
@@ -1,576 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.daemon;
-
-//OODT imports
-import org.apache.oodt.cas.pushpull.config.Config;
-import org.apache.oodt.cas.pushpull.config.DaemonInfo;
-import org.apache.oodt.cas.pushpull.config.SiteInfo;
-import org.apache.oodt.cas.pushpull.protocol.RemoteSite;
-import org.apache.oodt.cas.pushpull.retrievalsystem.RetrievalSetup;
-
-//JDK imports
-import java.io.File;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.lang.management.ManagementFactory;
-import java.net.MalformedURLException;
-import java.rmi.AlreadyBoundException;
-import java.rmi.Naming;
-import java.rmi.NotBoundException;
-import java.rmi.RemoteException;
-import java.rmi.registry.LocateRegistry;
-import java.rmi.server.UnicastRemoteObject;
-import java.util.Date;
-import java.util.GregorianCalendar;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-//JMX imports
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-/**
- * Controls the execution times of the Crawler it is given. The Crawler is
- * specified by the properties file passed in. A Crawler will be created per the
- * properties file and executed at six hour intervals. This class can be
- * controlled by CrawlDaemonController after is has been started up.
- *
- * @author bfoster
- */
-public class Daemon extends UnicastRemoteObject implements DaemonRmiInterface,
- DaemonMBean {
-
- private static final long serialVersionUID = 7660972939723142802L;
-
- private DaemonListener daemonListener;
-
- /* our log stream */
- private static final Logger LOG = Logger.getLogger(Daemon.class.getName());
-
- /**
- * Keeps track of whether the Crawler is running or not
- */
- private boolean isRunning;
-
- /**
- * If set to false the CrawlDaemon will terminate after the Crawler finishes
- * crawling its current site.
- */
- private boolean keepRunning;
-
- /**
- * The time at which the Constructor is called
- */
- private long daemonCreationTime;
-
- /**
- * The total time during which the Crawl is actually running -- wait() time
- * is not included.
- */
- private long daemonTotalRuntime;
-
- /**
- * Total number of times the Crawler has been run
- */
- private int numberOfCrawls;
-
- private File propFilesDir;
-
- private int daemonID;
-
- private RetrievalSetup rs;
-
- private Config config;
-
- private DaemonInfo daemonInfo;
-
- private MBeanServer mbs;
-
- private int rmiRegPort;
-
- /**
- * Constructor
- *
- * @throws RemoteException
- * @throws RemoteException
- * @throws InstantiationException
- * @throws IOException
- * @throws SecurityException
- */
- public Daemon(int rmiRegPort, int daemonID, Config config,
- DaemonInfo daemonInfo, SiteInfo siteInfo) throws RemoteException {
- super();
-
- this.rmiRegPort = rmiRegPort;
- this.daemonID = daemonID;
- rs = new RetrievalSetup(config, siteInfo);
- this.config = config;
- this.daemonInfo = daemonInfo;
-
- daemonCreationTime = System.currentTimeMillis();
- daemonTotalRuntime = 0;
- numberOfCrawls = 0;
- isRunning = false;
-
- try {
- registerRMIServer();
- } catch (Exception e) {
- LOG.log(Level.SEVERE, "Failed to bind to RMI server : "
- + e.getMessage());
- }
-
- try {
- // registry CrawlDaemon as MBean so it can be used with jconsole
- mbs = ManagementFactory.getPlatformMBeanServer();
- ObjectName name = new ObjectName(
- "org.apache.oodt.cas.pushpull.daemon:type=Daemon"
- + this.getDaemonID());
- mbs.registerMBean(this, name);
- } catch (Exception e) {
- LOG.log(Level.SEVERE,
- "Failed to register CrawlDaemon as a MBean Object : "
- + e.getMessage());
- }
- }
-
- public String getName() {
- return "Daemon" + this.getDaemonID();
- }
-
- private void registerRMIServer() throws RemoteException {
- try {
- Naming.bind("//localhost:" + this.rmiRegPort + "/daemon"
- + this.getDaemonID(), this);
- LOG.log(Level.INFO, "Created Daemon ID = " + this.getDaemonID()
- + " on RMI registry port " + this.rmiRegPort);
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- throw new RemoteException("Failed to bind Daemon with ID = "
- + this.getDaemonID() + " to RMI registry at port "
- + this.rmiRegPort);
- }
- }
-
- public void registerDaemonListener(DaemonListener daemonListener) {
- this.daemonListener = daemonListener;
- this.daemonListener.wasRegisteredWith(this);
- }
-
- /**
- * Loads and executes the Crawler specified by the properties file. It will
- * crawl the URLs specified in the properties file in the sequence
- * given--one at a time.
- *
- * @throws DirStructException
- */
- public void startDaemon() {
- new Thread(new Runnable() {
-
- public void run() {
-
- // check if Daemon should sleep first
- long timeTilNextRun;
- if ((timeTilNextRun = Daemon.this.calculateTimeTilNextRun()) != 0
- && !(Daemon.this.beforeToday(daemonInfo
- .getFirstRunDateTime()) && daemonInfo
- .runOnReboot())) {
- sleep(timeTilNextRun);
- }
-
- for (keepRunning = true; keepRunning;) {
- long startTime = System.currentTimeMillis();
-
- // get permission to run
- Daemon.this.notifyDaemonListenerOfStart();
- if (!keepRunning) {
- Daemon.this.notifyDaemonListenerOfFinish();
- System.out.println("BREAKING OUT");
- break;
- }
-
- // run
- Daemon.this.isRunning = true;
-
- try {
- rs.retrieveFiles(daemonInfo.getPropFilesInfo(),
- daemonInfo.getDataFilesInfo());
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- } finally {
- numberOfCrawls++;
- }
-
- Daemon.this.isRunning = false;
-
- // calculate performance and sleep
- Daemon.this.notifyDaemonListenerOfFinish();
- Daemon.this.calculateAndStoreElapsedTime(startTime);
- if (Daemon.this.keepRunning
- && daemonInfo.getTimeIntervalInMilliseconds() >= 0) {
- sleep(Daemon.this.calculateTimeTilNextRun());
- } else {
- break;
- }
- }
- LOG.log(Level.INFO, "Daemon with ID = "
- + Daemon.this.getDaemonID() + " on RMI registry port "
- + Daemon.this.rmiRegPort + " is shutting down");
- Daemon.this.unregister();
- }
- }).start();
- }
-
- private void unregister() {
- try {
- // unregister CrawlDaemon from RMI registry
- Naming.unbind("//localhost:" + this.rmiRegPort + "/daemon"
- + this.getDaemonID());
- this.mbs.unregisterMBean(new ObjectName(
- "org.apache.oodt.cas.pushpull.daemon:type=Daemon"
- + this.getDaemonID()));
- UnicastRemoteObject.unexportObject(this, true);
- this.daemonListener.wasUnregisteredWith(this);
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- }
- }
-
- public int getDaemonID() {
- return Integer.parseInt(this.rmiRegPort + "" + this.daemonID);
- }
-
- private long calculateTimeTilNextRun() {
- GregorianCalendar now = new GregorianCalendar();
- GregorianCalendar gcStartDateTime = new GregorianCalendar();
- gcStartDateTime.setTime(daemonInfo.getFirstRunDateTime());
- long diff = now.getTimeInMillis() - gcStartDateTime.getTimeInMillis();
- if (Math.abs(diff) <= daemonInfo.getEpsilonInMilliseconds()) {
- return 0;
- } else if (diff < 0) {
- return gcStartDateTime.getTimeInMillis() - now.getTimeInMillis();
- } else if (daemonInfo.getTimeIntervalInMilliseconds() == 0) {
- return 0;
- } else {
- int numOfPeriods = (int) (diff / daemonInfo
- .getTimeIntervalInMilliseconds());
- long nextRunTime = gcStartDateTime.getTimeInMillis()
- + ((numOfPeriods + 1) * daemonInfo
- .getTimeIntervalInMilliseconds());
- return nextRunTime - now.getTimeInMillis();
- }
- }
-
- private boolean beforeToday(Date date) {
- return date.before(new Date(System.currentTimeMillis()));
- }
-
- private void notifyDaemonListenerOfStart() {
- if (this.daemonListener != null) {
- this.daemonListener.daemonStarting(this);
- }
- }
-
- private void notifyDaemonListenerOfFinish() {
- if (this.daemonListener != null) {
- this.daemonListener.daemonFinished(this);
- }
- }
-
- private void sleep(long length) {
- if (length > 0) {
- LOG.log(Level.INFO, "Daemon with ID = " + this.getDaemonID()
- + " on RMI registry port " + this.rmiRegPort
- + " is going to sleep until "
- + new Date(System.currentTimeMillis() + length));
- synchronized (this) {
- try {
- wait(length);
- } catch (InterruptedException ignored) {
- }
- }
- }
- }
-
- private long calculateAndStoreElapsedTime(long startTime) {
- long elapsedTime = System.currentTimeMillis() - startTime;
- daemonTotalRuntime += elapsedTime;
- return elapsedTime;
- }
-
- public synchronized void pauseDaemon() {
- try {
- LOG.log(Level.INFO, "Daemon with ID = " + this.getDaemonID()
- + " on RMI registry port " + this.rmiRegPort
- + " has been stopped");
- this.wait(0);
- } catch (Exception ignored) {
- }
- LOG.log(Level.INFO, "Daemon with ID = " + this.getDaemonID()
- + " on RMI registry port " + this.rmiRegPort + " has resumed");
- }
-
- /**
- * Wakes up the CrawlDaemon if it is sleeping
- */
- public synchronized void resume() {
- notify();
- }
-
- /**
- * Will terminate the CrawlDaemon. If its Crawler is crawling a site when
- * this method is called, the terminate won't take place until after the
- * Crawler has complete crawling that site.
- */
- public synchronized void quit() {
- keepRunning = false;
- resume();
- }
-
- /**
- * Can be used to determine if Crawler is presently running
- *
- * @return true if Crawler is runnning
- * @uml.property name="isRunning"
- */
- public boolean isRunning() {
- return isRunning;
- }
-
- /**
- * Average runtime for the Crawler
- *
- * @return average runtime for the Crawler
- */
- public long getAverageRunTime() {
- return daemonTotalRuntime / numberOfCrawls;
- }
-
- /**
- * Gets the total crawling time of the Crawler
- *
- * @return Total crawling time of Crawler
- */
- public long getMillisCrawling() {
- return daemonTotalRuntime;
- }
-
- /**
- * Gets the time between the start of Crawler executions
- *
- * @return Time interval between Crawler start times
- */
- public long getTimeInterval() {
- return daemonInfo.getTimeIntervalInMilliseconds();
- }
-
- /**
- * Gets the total number of times the Crawler has been run
- *
- * @return The number of times Crawler has run
- */
- public int getNumCrawls() {
- return numberOfCrawls;
- }
-
- public String[] downloadedFilesInStagingArea() {
- return this.daemonInfo.getDataFilesInfo().getDownloadInfo()
- .getStagingArea().list(new FilenameFilter() {
- public boolean accept(File dir, String name) {
- return !name.startsWith("Downloading_")
- && !(name.endsWith("info.tmp") || name
- .endsWith("cas"));
- }
- });
- }
-
- public String[] downloadingFilesInStagingArea() {
- return this.daemonInfo.getDataFilesInfo().getDownloadInfo()
- .getStagingArea().list(new FilenameFilter() {
- public boolean accept(File dir, String name) {
- return name.startsWith("Downloading_")
- && !(name.endsWith("info.tmp") || name
- .endsWith("cas"));
- }
- });
- }
-
- public int numberOfFilesDownloadingInStagingArea() {
- return this.downloadingFilesInStagingArea().length;
- }
-
- public int numberOfFilesDownloadedInStagingArea() {
- return this.downloadedFilesInStagingArea().length;
- }
-
- // ***************DaemonInfo******************
- public long getTimeIntervalInMilliseconds() {
- return this.daemonInfo.getTimeIntervalInMilliseconds();
- }
-
- public long getEpsilonInMilliseconds() {
- return this.daemonInfo.getEpsilonInMilliseconds();
- }
-
- public boolean getRunOnReboot() {
- return this.daemonInfo.runOnReboot();
- }
-
- public Date getFirstRunDateTime() {
- return this.daemonInfo.getFirstRunDateTime();
- }
-
- // ***************DaemonInfo******************
-
- // ***************DataFilesInfo*******************
- public String getDataFilesRemoteSite() {
- RemoteSite remoteSite = this.daemonInfo.getDataFilesInfo()
- .getDownloadInfo().getRemoteSite();
- return (remoteSite == null) ? "" : remoteSite.toString();
- }
-
- public String getDataFilesRenamingConv() {
- return this.daemonInfo.getDataFilesInfo().getDownloadInfo()
- .getRenamingConv();
- }
-
- public boolean getDeleteDataFilesFromServer() {
- return this.daemonInfo.getDataFilesInfo().getDownloadInfo()
- .deleteFromServer();
- }
-
- public String getQueryMetadataElementName() {
- String element = this.daemonInfo.getDataFilesInfo()
- .getQueryMetadataElementName();
- if (element == null || element.equals("")) {
- element = "Filename";
- }
- return this.daemonInfo.getDataFilesInfo().getQueryMetadataElementName();
- }
-
- public File getDataFilesStagingArea() {
- return this.daemonInfo.getDataFilesInfo().getDownloadInfo()
- .getStagingArea();
- }
-
- public boolean getAllowAliasOverride() {
- return this.daemonInfo.getDataFilesInfo().getDownloadInfo()
- .isAllowAliasOverride();
- }
-
- // **************DataFilesInfo********************
-
- // **************PropFilesInfo********************
- public String getPropertyFilesRemoteSite() {
- RemoteSite remoteSite = this.daemonInfo.getPropFilesInfo()
- .getDownloadInfo().getRemoteSite();
- return (remoteSite == null) ? "" : remoteSite.toString();
- }
-
- public String getPropertyFilesRenamingConv() {
- return this.daemonInfo.getPropFilesInfo().getDownloadInfo()
- .getRenamingConv();
- }
-
- public boolean getDeletePropertyFilesFromServer() {
- return this.daemonInfo.getPropFilesInfo().getDownloadInfo()
- .deleteFromServer();
- }
-
- public String getPropertyFilesOnSuccessDir() {
- File successDir = this.daemonInfo.getPropFilesInfo().getOnSuccessDir();
- return successDir == null ? "" : successDir.getAbsolutePath();
- }
-
- public String getPropertyFilesOnFailDir() {
- File failDir = this.daemonInfo.getPropFilesInfo().getOnFailDir();
- return failDir == null ? "" : failDir.getAbsolutePath();
- }
-
- public File getPropertyFilesLocalDir() {
- return this.daemonInfo.getPropFilesInfo().getLocalDir();
- }
-
- // **************PropFilesInfo********************
-
- /**
- * Gets the time in milliseconds for when the CrawlDaemon constructor was
- * invoked.
- *
- * @return
- * @uml.property name="daemonCreationTime"
- */
- public long getDaemonCreationTime() {
- return daemonCreationTime;
- }
-
- public boolean getHasBeenToldToQuit() {
- return !this.keepRunning;
- }
-
- public String toString() {
- return this.getName();
- }
-
- /**
- * Starts the program
- *
- * @param args
- * Not Used
- * @throws IOException
- * @throws SecurityException
- */
- public static void main(String[] args) {
- try {
-
- int rmiPort = -1;
- boolean waitForCrawlNotification = false;
-
- for (int i = 0; i < args.length; ++i) {
- if (args[i].equals("--rmiPort")) {
- rmiPort = Integer.parseInt(args[++i]);
- } else if (args[i].equals("--waitForNotification")) {
- waitForCrawlNotification = true;
- }
- }
-
- LocateRegistry.createRegistry(rmiPort);
-
- try {
- // registry CrawlDaemon as MBean so it can be used with jconsole
- MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
- ObjectName name = new ObjectName(
- "org.apache.oodt.cas.pushpull.daemon:type=Daemon");
- } catch (Exception e) {
- LOG.log(Level.SEVERE,
- "Failed to register CrawlDaemon as a MBean Object : "
- + e.getMessage());
- }
-
- } catch (Exception e) {
- LOG.log(Level.SEVERE, "Failed to create CrawlDaemon : "
- + e.getMessage());
- } finally {
- // terminate the CrawlDaemon
- LOG.log(Level.INFO, "Terminating CrawlDaemon");
- }
-
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonController.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonController.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonController.java
deleted file mode 100644
index 40b7ca9..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonController.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.daemon;
-
-//JDK imports
-
-import java.rmi.Naming;
-import java.rmi.RemoteException;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * @author bfoster
- *
- * <p>
- * After the CrawlDaemon has been started, this class can control the
- * CrawlDaemon through webserver communication, thus it can be control from
- * computers other than the one it is executing on. This class has control over
- * pausing, resuming, and killing the CrawlDaemon process. It also has the
- * ability of getting the status on several variables within the CrawlDaemon
- * class. See CrawlDaemon for more info.
- * </p>.
- */
-public class DaemonController {
- private static Logger LOG = Logger.getLogger(DaemonController.class.getName());
- private DaemonRmiInterface daemon;
-
- /**
- * Constructor -- initializes the XmlRpcClient
- *
- * @throws InstantiationException
- */
- public DaemonController(String rmiUrl) {
- try {
- daemon = (DaemonRmiInterface) Naming.lookup(rmiUrl);
- System.out.println(!daemon.getHasBeenToldToQuit());
- } catch (Exception e) {
- LOG.log(Level.SEVERE, e.getMessage());
- }
- }
-
- /**
- * Get the average time for each run of the Crawler controlled by the
- * CrawlDaemons
- *
- * @return Average runtime of Crawler
- * @throws RemoteException
- * @throws XmlRpcCommunicationException
- * Error communicating with server
- */
- public long getAverageRunTime() throws RemoteException {
- return daemon.getAverageRunTime();
- }
-
- /**
- * Gets the total milliseconds for which the Crawler in CrawlDaemon has been
- * crawling since the CrawlDaemon was created.
- *
- * @return The total milliseconds which the Crawler has been crawling
- * @throws RemoteException
- * @throws XmlRpcCommunicationException
- * Error communicating with server
- */
- public long getMillisCrawling() throws RemoteException {
- return daemon.getMillisCrawling();
- }
-
- /**
- * Gets the time between the start of each scheduled run.
- *
- * @return The time between the start of each execution of the Crawler
- * controlled by the CrawlDaemon
- * @throws RemoteException
- * @throws XmlRpcCommunicationException
- * Error communicating with server
- */
- public long getWaitInterval() throws RemoteException {
- return daemon.getTimeInterval();
- }
-
- /**
- * Gets the numbers of times the Crawler has been run by the CrawlDaemon
- *
- * @return The of times Crawler has executed
- * @throws RemoteException
- * @throws XmlRpcCommunicationException
- * Error communicating with server
- */
- public int getNumCrawls() throws RemoteException {
- return daemon.getNumCrawls();
- }
-
- /**
- * Used to determine if the Crawler in the CrawlDaemon is running
- *
- * @return true is Crawler is running
- * @throws RemoteException
- * @throws XmlRpcCommunicationException
- * Error communicating with server
- */
- public boolean isRunning() throws RemoteException {
- return daemon.isRunning();
- }
-
- /**
- * Wakes the CrawlDaemon up and tells it to start crawling again. If stop()
- * was called, this method will have the CrawlDaemon continue from where it
- * left off. This method will also wake up the CrawlDaemon from its sleep
- * between scheduled runs.
- *
- * @throws RemoteException
- * @throws XmlRpcCommunicationException
- * Error communicating with server
- */
- public void resume() throws RemoteException {
- daemon.resume();
- }
-
- public void quit() throws RemoteException {
- daemon.quit();
- }
-
- /**
- * Gets the time in milliseconds of when the CrawlDaemon was created
- *
- * @return The time the CrawlDaemon was created
- * @throws RemoteException
- * @throws XmlRpcCommunicationException
- * Error communicating with server
- */
- public long getDaemonCreationTime() throws RemoteException {
- return daemon.getDaemonCreationTime();
- }
-
- /**
- * Driver method -- starts the CrawlDaemonController
- *
- * @param args
- * See documentation
- * @throws Exception
- * On error! :)
- */
- public static void main(String[] args) throws RemoteException {
- String avgCrawlOperation = "--getAverageRunTime\n";
- String getMilisCrawlOperation = "--getMilisCrawling\n";
- String getNumCrawlsOperation = "--getNumCrawls\n";
- String getWaitIntervalOperation = "--getWaitInterval\n";
- String isRunningOperation = "--isRunning\n";
- String stopOperation = "--stop\n";
- String usage = "CrawlController --url <url to xml rpc service> "
- + "--operation [<operation> [params]]\n" + "operations:\n"
- + avgCrawlOperation + getMilisCrawlOperation
- + getNumCrawlsOperation + getWaitIntervalOperation
- + isRunningOperation + stopOperation;
- String operation = null, url = null;
-
- for (int i = 0; i < args.length; i++) {
- if (args[i].equals("--operation")) {
- operation = args[++i];
- } else if (args[i].equals("--url")) {
- url = args[++i];
- }
- }
- if (operation == null) {
- System.err.println(usage);
- System.exit(1);
- }
-
- // create the controller
- DaemonController controller = new DaemonController(url);
- if (operation.equals("--getAverageRunTime")) {
- double avgCrawlTime = controller.getAverageRunTime();
- System.out.println("Average Crawl Time: [" + avgCrawlTime + "]");
- } else if (operation.equals("--getMilisCrawling")) {
- long crawlTime = controller.getMillisCrawling();
- System.out.println("Total Crawl Time: [" + crawlTime
- + "] miliseconds");
- } else if (operation.equals("--getNumCrawls")) {
- int numCrawls = controller.getNumCrawls();
- System.out.println("Num Crawls: [" + numCrawls + "]");
- } else if (operation.equals("--getWaitInterval")) {
- long waitInterval = controller.getWaitInterval();
- System.out.println("Wait Interval: [" + waitInterval + "]");
- } else if (operation.equals("--isRunning")) {
- boolean running = controller.isRunning();
- System.out.println(running ? "Yes" : "No");
- } else {
- throw new IllegalArgumentException("Unknown Operation!");
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonLauncher.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonLauncher.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonLauncher.java
deleted file mode 100644
index c9a45d6..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonLauncher.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.daemon;
-
-//OODT imports
-import org.apache.oodt.cas.pushpull.config.Config;
-import org.apache.oodt.cas.pushpull.config.DaemonInfo;
-import org.apache.oodt.cas.pushpull.config.RemoteSpecs;
-
-//JDK imports
-import java.io.File;
-import java.lang.management.ManagementFactory;
-import java.rmi.registry.LocateRegistry;
-import java.util.LinkedList;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-//JMX imports
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>Describe your class here</p>.
- */
-public class DaemonLauncher implements DaemonLauncherMBean {
-
- /* our log stream */
- private static final Logger LOG = Logger.getLogger(DaemonLauncher.class
- .getName());
-
- private Config config;
-
- private RemoteSpecs rs;
-
- private int rmiRegistryPort;
-
- private int nextDaemonId;
-
- private DaemonManager dm;
-
- private LinkedList<Daemon> activeDaemonList;
-
- private LinkedList<File> sitesFiles;
-
- private File propertiesFile;
-
- private MBeanServer mbs;
-
- public DaemonLauncher(int rmiRegistryPort, File propertiesFile,
- LinkedList<File> sitesFiles) {
- this.rmiRegistryPort = rmiRegistryPort;
- nextDaemonId = 0;
- dm = new DaemonManager();
- activeDaemonList = new LinkedList<Daemon>();
- this.sitesFiles = sitesFiles;
- this.propertiesFile = propertiesFile;
- registerJMX();
- this.configure();
- }
-
- private void registerJMX() {
- try {
- LocateRegistry.createRegistry(this.rmiRegistryPort);
- mbs = ManagementFactory.getPlatformMBeanServer();
- ObjectName name = new ObjectName(
- "org.apache.oodt.cas.pushpull.daemon:type=DaemonLauncher"
- + this.rmiRegistryPort);
- mbs.registerMBean(this, name);
- } catch (Exception e) {
- LOG.log(Level.SEVERE,
- "Failed to register DaemonLauncher as a MBean Object : "
- + e.getMessage());
- }
- }
-
- private synchronized void configure() {
- try {
- LOG.log(Level.INFO, "Configuring DaemonLauncher. . .");
- config = new Config();
- config.loadConfigFile(propertiesFile);
- rs = new RemoteSpecs();
- for (File sitesFile : sitesFiles) {
- LOG
- .log(Level.INFO, "Loading SiteInfo file '" + sitesFile
- + "'");
- rs.loadRemoteSpecs(sitesFile);
- }
- } catch (Exception e) {
- LOG.log(Level.SEVERE, "Failed to configure DaemonLauncher : "
- + e.getMessage());
- }
- }
-
- public synchronized void launchDaemons() {
- LOG.log(Level.INFO, "Launching Daemons . . .");
- for (DaemonInfo daemonInfo : rs.getDaemonInfoList()) {
- int curDaemonID = this.getNextDaemonId();
- try {
- Daemon daemon = new Daemon(this.rmiRegistryPort, curDaemonID,
- this.config, daemonInfo, rs.getSiteInfo());
- LOG.log(Level.INFO, "Creating Daemon with ID = " + curDaemonID);
- daemon.registerDaemonListener(dm);
- daemon.startDaemon();
- activeDaemonList.add(daemon);
- } catch (Exception e) {
- LOG.log(Level.SEVERE, "Failed to create Daemon with ID = "
- + curDaemonID + " : " + e.getMessage());
- }
- }
- }
-
- private synchronized int getNextDaemonId() {
- while (this.dm.getUsedIDs().contains(++this.nextDaemonId)) {
-
- }
- return this.nextDaemonId;
- }
-
- public void refreshDaemons() {
- this.killAllDaemons();
-
- LOG.log(Level.INFO, "Refreshing Daemons . . .");
- this.configure();
- launchDaemons();
- }
-
- public synchronized void killAllDaemons() {
- LOG.log(Level.INFO, "Killing current Daemons . . .");
- this.nextDaemonId = 0;
- for (Daemon daemon : this.activeDaemonList) {
- if (!daemon.getHasBeenToldToQuit()) {
- daemon.quit();
- }
- }
- activeDaemonList.clear();
- }
-
- public String[] viewDaemonWaitingList() {
- return this.dm.getQueueList();
- }
-
- public synchronized void quit() {
- this.killAllDaemons();
- this.notify();
- }
-
- public static void main(String[] args) {
-
- int rmiRegPort = -1;
- File propertiesFile = null;
- LinkedList<File> sitesFiles = new LinkedList<File>();
-
- for (int i = 0; i < args.length; ++i) {
- if (args[i].equals("--rmiRegistryPort")) {
- rmiRegPort = Integer.parseInt(args[++i]);
- } else if (args[i].equals("--propertiesFile")) {
- propertiesFile = new File(args[++i]);
- } else if (args[i].equals("--remoteSpecsFile")) {
- sitesFiles.add(new File(args[++i]));
- }
- }
-
- DaemonLauncher daemonLauncher = new DaemonLauncher(rmiRegPort,
- propertiesFile, sitesFiles);
-
- daemonLauncher.launchDaemons();
- synchronized (daemonLauncher) {
- try {
- daemonLauncher.wait();
- } catch (Exception ignored) {
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonLauncherMBean.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonLauncherMBean.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonLauncherMBean.java
deleted file mode 100644
index 880316b..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonLauncherMBean.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.daemon;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>Describe your class here</p>.
- */
-public interface DaemonLauncherMBean {
-
- void killAllDaemons();
-
- void refreshDaemons();
-
- void quit();
-
- String[] viewDaemonWaitingList();
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonListener.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonListener.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonListener.java
deleted file mode 100644
index 40f4cf8..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonListener.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.daemon;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public interface DaemonListener {
-
- void wasRegisteredWith(Daemon daemon);
-
- void wasUnregisteredWith(Daemon daemon);
-
- void daemonStarting(Daemon daemon);
-
- void daemonFinished(Daemon daemon);
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonMBean.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonMBean.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonMBean.java
deleted file mode 100644
index a133bdd..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonMBean.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.daemon;
-
-//JDK imports
-import java.io.File;
-import java.util.Date;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public interface DaemonMBean {
-
- /**
- * Will terminate the CrawlDaemon. If its Crawler is crawling a site when
- * this method is called, the terminate won't take place until after the
- * Crawler has complete crawling that site.
- *
- * @return
- */
- void quit();
-
- /**
- * Can be used to determine if Crawler is presently running
- *
- * @return true if Crawler is runnning
- * @uml.property name="isRunning"
- */
- boolean isRunning();
-
- boolean getHasBeenToldToQuit();
-
- long getTimeIntervalInMilliseconds();
-
- long getEpsilonInMilliseconds();
-
- boolean getRunOnReboot();
-
- Date getFirstRunDateTime();
-
- String[] downloadedFilesInStagingArea();
-
- String[] downloadingFilesInStagingArea();
-
- int numberOfFilesDownloadedInStagingArea();
-
- int numberOfFilesDownloadingInStagingArea();
-
- String getDataFilesRemoteSite();
-
- String getDataFilesRenamingConv();
-
- boolean getDeleteDataFilesFromServer();
-
- String getQueryMetadataElementName();
-
- File getDataFilesStagingArea();
-
- boolean getAllowAliasOverride();
-
- String getPropertyFilesRemoteSite();
-
- String getPropertyFilesRenamingConv();
-
- boolean getDeletePropertyFilesFromServer();
-
- String getPropertyFilesOnSuccessDir();
-
- String getPropertyFilesOnFailDir();
-
- File getPropertyFilesLocalDir();
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonManager.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonManager.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonManager.java
deleted file mode 100644
index 04de6dc..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonManager.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.daemon;
-
-//JDK imports
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class DaemonManager implements DaemonListener {
-
- private LinkedList<Daemon> waitingList;
-
- private HashSet<Integer> usedIDs;
-
- private Daemon runningDaemon;
-
- /* our log stream */
- private static final Logger LOG = Logger.getLogger(DaemonManager.class
- .getName());
-
- public DaemonManager() {
- waitingList = new LinkedList<Daemon>();
- usedIDs = new HashSet<Integer>();
- runningDaemon = null;
- }
-
- public synchronized boolean hasRunningDaemons() {
- return this.waitingList.size() > 0 || this.runningDaemon != null;
- }
-
- public synchronized void clearWaitingList() {
- this.waitingList.clear();
- }
-
- public synchronized void wasRegisteredWith(Daemon daemon) {
- this.usedIDs.add(daemon.getDaemonID());
- }
-
- public synchronized void wasUnregisteredWith(Daemon daemon) {
- this.usedIDs.remove(Integer.valueOf(daemon.getDaemonID()));
- }
-
- public void daemonStarting(Daemon daemon) {
- if (!this.setAsRunning(daemon)) {
- daemon.pauseDaemon();
- }
- }
-
- public void daemonFinished(Daemon daemon) {
- if (daemon.equals(this.runningDaemon)) {
- this.startNextOnWaitingList();
- } else {
- this.waitingList.remove(daemon);
- }
- }
-
- public synchronized HashSet<Integer> getUsedIDs() {
- return this.usedIDs;
- }
-
- private synchronized boolean setAsRunning(Daemon daemon) {
- if (runningDaemon == null) {
- runningDaemon = daemon;
- LOG.log(Level.INFO, "Daemon with ID = " + daemon.getDaemonID()
- + " was given permission to run");
- return true;
- } else {
- LOG.log(Level.INFO, "Daemon with ID = " + daemon.getDaemonID()
- + " was added to the DaemonManager's waiting list");
- waitingList.add(daemon);
- return false;
- }
- }
-
- private synchronized void startNextOnWaitingList() {
- if (waitingList.size() > 0) {
- runningDaemon = waitingList.removeFirst();
- LOG.log(Level.INFO, "Daemon with ID = "
- + runningDaemon.getDaemonID()
- + " was given permission to run");
- runningDaemon.resume();
- } else {
- runningDaemon = null;
- }
- }
-
- public synchronized String[] getQueueList() {
- String[] queue = new String[this.waitingList.size()];
- int counter = 0;
- for (Daemon daemon : this.waitingList) {
- queue[counter++] = daemon.getName();
- }
- return queue;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonRmiInterface.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonRmiInterface.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonRmiInterface.java
deleted file mode 100644
index 1cb5f53..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonRmiInterface.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.daemon;
-
-//JDK imports
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>Describe your class here</p>.
- */
-public interface DaemonRmiInterface extends Remote {
-
- /**
- * Wakes up the CrawlDaemon if it is sleeping
- *
- * @return Always true -- done because of XmlRpc communication
- */
- void resume() throws RemoteException;
-
- /**
- * Will terminate the CrawlDaemon. If its Crawler is crawling a site when
- * this method is called, the terminate won't take place until after the
- * Crawler has complete crawling that site.
- *
- * @return
- */
- void quit() throws RemoteException;
-
- /**
- * Can be used to determine if Crawler is presently running
- *
- * @return true if Crawler is runnning
- * @uml.property name="isRunning"
- */
- boolean isRunning() throws RemoteException;
-
- /**
- * Average runtime for the Crawler
- *
- * @return average runtime for the Crawler
- */
- long getAverageRunTime() throws RemoteException;
-
- /**
- * Gets the total crawling time of the Crawler
- *
- * @return Total crawling time of Crawler
- */
- long getMillisCrawling() throws RemoteException;
-
- /**
- * Gets the time between the start of Crawler executions
- *
- * @return Time interval between Crawler start times
- */
- long getTimeInterval() throws RemoteException;
-
- /**
- * Gets the total number of times the Crawler has been run
- *
- * @return The number of times Crawler has run
- */
- int getNumCrawls() throws RemoteException;
-
- /**
- * Gets the time in milliseconds for when the CrawlDaemon constructor was
- * invoked.
- *
- * @return
- * @uml.property name="daemonCreationTime"
- */
- long getDaemonCreationTime() throws RemoteException;
-
- boolean getHasBeenToldToQuit() throws RemoteException;
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/AlreadyInDatabaseException.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/AlreadyInDatabaseException.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/AlreadyInDatabaseException.java
deleted file mode 100644
index 988a2f5..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/AlreadyInDatabaseException.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.exceptions;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class AlreadyInDatabaseException extends PushPullFrameworkException {
-
- private static final long serialVersionUID = 5268322663053758675L;
-
- public AlreadyInDatabaseException() {
- super();
- }
-
- public AlreadyInDatabaseException(String msg) {
- super(msg);
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/ConfigException.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/ConfigException.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/ConfigException.java
deleted file mode 100644
index 508444c..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/ConfigException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.exceptions;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class ConfigException extends PushPullFrameworkException {
-
- private static final long serialVersionUID = 2756721958068217752L;
-
- public ConfigException() {
- super();
- }
-
- public ConfigException(String message) {
- super(message);
- }
-
- public ConfigException(String message, Throwable t) {
- super(message, t);
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/CrawlDaemonException.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/CrawlDaemonException.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/CrawlDaemonException.java
deleted file mode 100644
index 245f81f..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/CrawlDaemonException.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.exceptions;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class CrawlDaemonException extends PushPullFrameworkException {
-
- private static final long serialVersionUID = 4813134079371402218L;
-
- public CrawlDaemonException() {
- super();
- }
-
- public CrawlDaemonException(String message) {
- super(message);
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/CrawlerException.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/CrawlerException.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/CrawlerException.java
deleted file mode 100644
index 96d3579..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/CrawlerException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.exceptions;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class CrawlerException extends PushPullFrameworkException {
-
- private static final long serialVersionUID = 6812263687830031390L;
-
- public CrawlerException() {
- super();
- }
-
- public CrawlerException(String msg) {
- super(msg);
- }
-
- public CrawlerException(String msg, Throwable t) {
- super(msg, t);
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/FileRestrictionsException.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/FileRestrictionsException.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/FileRestrictionsException.java
deleted file mode 100644
index 72beffa..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/FileRestrictionsException.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.exceptions;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class FileRestrictionsException extends PushPullFrameworkException {
-
- private static final long serialVersionUID = 2429807743624154441L;
-
- public FileRestrictionsException() {
- super();
- }
-
- public FileRestrictionsException(String msg) {
- super(msg);
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/MetExtractorException.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/MetExtractorException.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/MetExtractorException.java
deleted file mode 100644
index b85d48f..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/MetExtractorException.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.exceptions;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class MetExtractorException extends PushPullFrameworkException {
-
- private static final long serialVersionUID = -5075869090098570091L;
-
- public MetExtractorException() {
- super();
- }
-
- public MetExtractorException(String msg) {
- super(msg);
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/MethodException.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/MethodException.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/MethodException.java
deleted file mode 100644
index bc7d933..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/MethodException.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.exceptions;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class MethodException extends PushPullFrameworkException {
-
- private static final long serialVersionUID = -8717114929851891812L;
-
- public MethodException() {
- super();
- }
-
- public MethodException(String msg) {
- super(msg);
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/ParserException.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/ParserException.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/ParserException.java
deleted file mode 100644
index 30df44a..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/ParserException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.exceptions;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class ParserException extends PushPullFrameworkException {
-
- private static final long serialVersionUID = 4654971837246731057L;
-
- public ParserException() {
- super();
- }
-
- public ParserException(String msg) {
- super(msg);
- }
-
- public ParserException(String msg, Throwable t) {
- super(msg, t);
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/ProtocolDeletionError.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/ProtocolDeletionError.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/ProtocolDeletionError.java
deleted file mode 100644
index 15eda47..0000000
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/exceptions/ProtocolDeletionError.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.cas.pushpull.exceptions;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class ProtocolDeletionError extends ProtocolException {
-
- private static final long serialVersionUID = 2209601187397273414L;
-
- public ProtocolDeletionError() {
- super();
- }
-
- public ProtocolDeletionError(String msg) {
- super(msg);
- }
-}
[44/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/classes/CasBrowser.class.php
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/classes/CasBrowser.class.php b/balance/modules/cas-browser/classes/CasBrowser.class.php
deleted file mode 100644
index 583a6c8..0000000
--- a/balance/modules/cas-browser/classes/CasBrowser.class.php
+++ /dev/null
@@ -1,455 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- *
- * $Id$
- *
- * CAS-Browser Module
- *
- * This module provides applications a means for browsing a CAS File
- * Manager catalog and obtaining products from a CAS File Manager repository.
- *
- * For complete functionality, the following configuration variables
- * are expected to be present in the module's config.ini file:
- *
- * browser_filemgr_url - filemanager host (e.g.: http://somehost:9000)
- * browser_filemgr_path - filemanager url on server (e.g.: /)
- * browser_datadeliv_url - the base url to use when downloading products
- *
- * NOTE: This module has a dependency upon the CAS-Filemgr PHP classes
- * (https://svn.apache.org/repos/asf/oodt/trunk/filemgr/src/main/php)
- *
- * To build this dependency, check out the above project and then:
- * 1) cd into the checked out project (you should see a package.xml file)
- * 2) pear package
- * 3) (sudo) pear install --force CAS_Filemgr...tar.gz
- *
- * @author ahart
- * @author resneck
- *
- */
-// Require CAS Filemgr Classes
-require_once("CAS/Filemgr/BooleanQueryCriteria.class.php");
-require_once("CAS/Filemgr/Element.class.php");
-require_once("CAS/Filemgr/Metadata.class.php");
-require_once("CAS/Filemgr/Product.class.php");
-require_once("CAS/Filemgr/ProductType.class.php");
-require_once("CAS/Filemgr/ProductPage.class.php");
-require_once("CAS/Filemgr/Query.class.php");
-require_once("CAS/Filemgr/RangeQueryCriteria.class.php");
-require_once("CAS/Filemgr/TermQueryCriteria.class.php");
-require_once("CAS/Filemgr/XmlRpcFilemgrClient.class.php");
-require_once(dirname(__FILE__) . "/Utils.class.php");
-
-
-class CasBrowser {
-
- const VIS_INTERPRET_HIDE = 'hide';
- const VIS_INTERPRET_SHOW = 'show';
- const VIS_AUTH_ANONYMOUS = false;
- const VIS_AUTH_AUTHENTICATED = true;
- const VIS_ALL = 'all';
- const VIS_LIMIT = 'limit';
- const VIS_NONE = 'deny';
- const VIS_DENY = 'deny';
-
- public $client;
-
- public function __construct() {
- try {
- $this->client = new CAS_Filemgr_XmlRpcFilemgrClient(
- App::Get()->settings['browser_filemgr_url'],
- App::Get()->settings['browser_filemgr_path']);
- } catch (Exception $e) {
- App::Get()->fatal("Unable to instantiate a connection to "
- . App::Get()->settings['browser_filemgr_url']
- . App::Get()->settings['browser_filemgr_path']);
- }
- }
-
- public function getClient() {
- return $this->client;
- }
-
- /**
- * Use the rules in element-ordering.ini to determine the display order
- * for product type metadata elements. See element-ordering.ini for more
- * information on how to specify element order rules.
- *
- * @param integer $productTypeId The id of the product type to get met for
- * @param array $metadataTouse An optional array of metadata key/vals to sort. If
- * this is not provided, the product type metadata will be used.
- */
- public function getSortedMetadata($productTypeId,$metadataToUse = null, $orderingAttribute) {
-
- if (!is_array($metadataToUse)) {
- $pt = $this->client
- ->getProductTypeById($productTypeId)
- ->toAssocArray();
- $metadataAsArray = $pt['typeMetadata'];
- } else {
- $metadataAsArray = $metadataToUse;
- }
-
- $orderingPolicyFilePath = dirname(dirname(__FILE__)) . '/element-ordering.ini';
- if (file_exists($orderingPolicyFilePath)) {
- $orderPolicy = parse_ini_file($orderingPolicyFilePath,true);
-
- $first = isset($orderPolicy[$productTypeId][$orderingAttribute . '.element.ordering.first'])
- ? $orderPolicy[$productTypeId][$orderingAttribute . '.element.ordering.first']
- : $orderPolicy['*'][$orderingAttribute . '.element.ordering.first'];
- $last = isset($orderPolicy[$productTypeId][$orderingAttribute . '.element.ordering.last'])
- ? $orderPolicy[$productTypeId][$orderingAttribute . '.element.ordering.last']
- : $orderPolicy['*'][$orderingAttribute . '.element.ordering.last'];
-
- // Using the odering policy, determine the order in which the metadata will be listed
- return $this->sortMetadata($metadataAsArray,$first,$last);
- } else {
- return $metadataAsArray;
- }
- }
-
- /**
- * Retreives the set of metadata for the provided productTypeId that should be visible
- * to the current user. This function also applies the sorting policy (if it is defined)
- * specified in element.ordering.ini.
- *
- * @param string $productTypeId - the unique productType identifier
- */
- public function getVisibleMetadataForProductType($productTypeId) {
- // Get the metadata for the product type
- $pt = $this->client
- ->getProductTypeById($productTypeId)
- ->toAssocArray();
-
- // Determine which metadata should be visible to the current user
- $visibleMetadata = $this->getVisibleMetadata($pt['typeMetadata'], $productTypeId);
-
- // Sort the visible metadata according to the ordering policy
- $result = $this->getSortedMetadata($productTypeId,$visibleMetadata, 'pt');
-
- return $result;
- }
-
-
- /**
- * Retrieves the set of metadata for the provided productId that should be visible to
- * the current user
- *
- * @param string $productId - the unique product identifier
- * @param boolean $authState - whether or not the current user is authenticated
- */
- public function getVisibleMetadataForProduct($productId) {
- $p = $this->client->getProductById($productId);
- $productTypeInfo = $p->getType()->toAssocArray();
- $productTypeId = $productTypeInfo[App::Get()->settings['browser_pt_id_key']];
- $productMetadata = $this->client->getMetadata($p);
-
- // Determine which metadata should be visible to the current user
- $visibleMetadata = $this->getVisibleMetadata($productMetadata->toAssocArray(), $productTypeId);
-
- // Sort the visible metadata according to the ordering policy
- $result = $this->getSortedMetadata($productTypeId,$visibleMetadata, 'p');
-
- return $result;
- }
-
-
- /**
- * Determine the visibility level for the current product type and current user.
- * The level returned is one of VIS_ALL,VIS_LIMIT,VIS_NONE
- *
- * @param string $productTypeId - the unique product type identifier
- */
- public function getProductTypeVisibilityLevel( $productTypeId ) {
- // If the configuration explicitly states that this dataset is to be ignored,
- // ignore it:
- if (in_array($productTypeId,App::Get()->settings['browser_dataset_ignores'])) {
- return CasBrowser::VIS_NONE;
- }
-
- // Get the metadata for the product type
- $typeInfo = $this->client
- ->getProductTypeById($productTypeId)
- ->toAssocArray();
-
- if ( App::Get()->getAuthenticationProvider() ) {
-
- // Does the product type define a metadata element matching
- // the `browser_data_access_key` config setting?
- $accessKeyExists = isset($typeInfo['typeMetadata'][App::Get()->settings['browser_data_access_key']]);
-
- // Obtain the groups for the current resource
- $resourceGroups = ($accessKeyExists)
- ? $typeInfo['typeMetadata'][App::Get()->settings['browser_data_access_key']]
- : array();
-
- return $this->getResourceVisibility($resourceGroups,
- App::Get()->settings['browser_pt_auth_policy']);
- } else {
- // No authentication provider, everything is public
- return CasBrowser::VIS_ALL;
- }
- }
-
- public function getProductVisibilityLevel( $productId ) {
-
- $product = $this->client->getProductById( $productId );
- $productMetadata = $this->client->getMetadata($product);
-
- // Get metadata for product and productType as associative arrays
- $productTypeInfo = $product->getType()->toAssocArray();
- $productInfo = $productMetadata->toAssocArray();
-
- if ( App::Get()->getAuthenticationProvider() ) {
-
- // Does the product type define a metadata element matching
- // the `browser_data_access_key` config setting?
- $accessKeyExists = isset($productInfo[App::Get()->settings['browser_data_access_key']]);
-
- // Obtain the groups for the current resource
- $resourceGroups = ($accessKeyExists)
- ? $productInfo[App::Get()->settings['browser_data_access_key']]
- : array();
-
- return $this->getResourceVisibility($resourceGroups,
- App::Get()->settings['browser_p_auth_policy']);
- } else {
- // No authentication provider, everything is public
- return CasBrowser::VIS_ALL;
- }
- }
-
-
- /**
- * Internal helper function for sorting(ordering) a metadata array according to policy.
- *
- * @param array $unsortedMetadata An associative array of unsorted metadta key/(multi)values
- * @param array $sortFirst A scalar array of metadata keys that must be ordered first
- * @param array $sortLast A scalar array of metadata keys that must be ordered last
- * @returns array An associative array of sorted(ordered) metadata key/(multi)values
- */
- protected function sortMetadata($unsortedMetadata,$sortFirst,$sortLast) {
- $orderedMetadata = array();
- foreach ($sortFirst as $key) {
- if (isset($unsortedMetadata[$key])) {
- $orderedMetadata[$key] = $unsortedMetadata[$key];
- unset($unsortedMetadata[$key]);
- }
- }
- $lastMetadata = array();
- foreach ($sortLast as $key) {
- if (isset($unsortedMetadata[$key])) {
- $lastMetadata[$key] = $unsortedMetadata[$key];
- unset($unsortedMetadata[$key]);
- }
- }
- $orderedMetadata += $unsortedMetadata;
- $orderedMetadata += $lastMetadata;
-
- return $orderedMetadata;
- }
-
- /**
- * Internal helper function for, given an array of metadata, a productTypeID, and an indication of whether or not the
- * current user is authenticated, returning the subset of metadata that should be visible to
- * the user.
- *
- * @param array $metadataAsArray
- * @param string $productTypeId
- * @param boolean $longinState - one of VIS_AUTH_AUTHENTICATED|VIS_AUTH_ANONYMOUS
- */
- protected function getVisibleMetadata($metadataAsArray, $productTypeId) {
-
- // Determine whether the user is authenticated
- $authState = (($ap = App::Get()->getAuthenticationProvider()) && $ap->isLoggedIn());
-
- $visibilityPolicyFilePath = dirname(dirname(__FILE__)) . '/element-visibility.ini';
- if (file_exists($visibilityPolicyFilePath)) {
- $visibilityPolicy = parse_ini_file($visibilityPolicyFilePath,true);
-
- $interpretation = $visibilityPolicy['interpretation.policy'];
- $globalVisibilityPolicy = $visibilityPolicy['*'];
- $productTypeVisibilityPolicy = isset($visibilityPolicy[$productTypeId])
- ? $visibilityPolicy[$productTypeId]
- : array("visibility.always" => array(),
- "visibility.anonymous" => array(),
- "visibility.authenticated" => array());
-
- // The visibility of a given metadata element is dependent upon
- // (1) the authentication status of the user (VIS_AUTH_AUTHENTICATED|VIS_AUTH_ANONYMOUS)
- // (2) the interpretation of the visibility policy (VIS_INTERPRET_SHOW|VIS_INTERPRET_HIDE)
- //
- // Using these values, determine which metadata to display:
- switch ($interpretation) {
- // If the policy defines only those metadata which should be hidden:
- case self::VIS_INTERPRET_HIDE:
- $displayMet = $metadataAsArray; // everything is shown unless explicitly hidden via the policy
- foreach ($globalVisibilityPolicy['visibility.always'] as $elm) // iterate through the global 'always hide' array...
- unset($displayMet[$elm]); // and remove all listed elements
- foreach ($productTypeVisibilityPolicy['visibility.always'] as $elm) // now iterate through the product-type 'always hide' array...
- unset($displayMet[$elm]); // and remove all listed elements
-
- // Determine what to hide given the user's login state
- switch ($authState) { // check the login status of the user
- case self::VIS_AUTH_ANONYMOUS: // if the user is anonymous...
- foreach($globalVisibilityPolicy['visibility.anonymous'] as $elm) // iterate through the global 'anonymous hide' array...
- unset($displayMet[$elm]); // and remove all listed elements
- foreach ($productTypeVisibilityPolicy['visibility.anonymous'] as $elm) // now iterate through the product-type 'anonymous hide' array...
- unset($displayMet[$elm]); // and remove all listed elements
- break; // done.
- case self::VIS_AUTH_AUTHENTICATED: // if the user is authenticated...
- foreach($globalVisibilityPolicy['visibility.authenticated'] as $elm) // iterate through the global 'authenticated hide' array...
- unset($displayMet[$elm]); // and remove all listed elements
- foreach ($productTypeVisibilityPolicy['visibility.authenticated'] as $elm) // now iterate through the product-type 'authenticated hide' array...
- unset($displayMet[$elm]); // and remove all listed elements
- break; // done.
- }
-
- break;
-
- // If the policy defines only those metadata which should be shown:
- case self::VIS_INTERPRET_SHOW:
- $displayMet = $globalVisibilityPolicy['visibility.always'] // merge the global 'always show' array
- + $productTypeVisibilityPolicy['visibility.always']; // with the product-type specific 'always show' array
- switch ($authState) { // check the login status of the user
- case self::VIS_AUTH_ANONYMOUS: // if the user is anonymous...
- $displayMet += $globalVisibilityPolicy['visibility.anonymous']; // merge the global 'anonymous show' array
- $displayMet += $productTypeVisibilityPolicy['visibility.anonymous']; // and the product-type specific 'anonymous show' array
- break; // done.
- case self::VIS_AUTH_AUTHENTICATED: // if the user is authenticated...
- $displayMet += $globalVisibilityPolicy['visibility.authenticated']; // merge the global 'authenticated show' array
- $displayMet += $productTypeVisibilityPolicy['visibility.authenticated']; // and the product-type specific 'authenticated show' array
- break; // done.
- }
- }
-
- return $displayMet;
-
- } else {
- return $metadataAsArray;
- }
- }
-
- /**
- * Internal helper function to determine the visibility level of a given resource given
- * its array of security groups. The value returned is one of VIS_ALL,VIS_LIMIT,VIS_NONE.
- *
- * @param array $resourceGroups - an array of security groups for the resource
- * @param string $policy - one of VIS_LIMIT or VIS_DENY
- */
- protected function getResourceVisibility( $resourceGroups, $policy = CasBrowser::VIS_DENY ) {
-
- // Is the resource considered "public"?
- if (in_array(App::Get()->settings['browser_data_public_access'],$resourceGroups)) {
- return CasBrowser::VIS_ALL;
- }
-
- // Get user authentication info
- $authentication = App::Get()->getAuthenticationProvider();
- $username = ($authentication)
- ? $authentication->getCurrentUsername()
- : false; // no authentication info provided in config file
-
- // Does the metadata visibility depend on an access element matching
- // the `browser_data_access_key` in the config setting?
- $accessKeyExists = isset(App::Get()->settings['browser_data_access_key']);
-
- // If key is set then we look into what groups have access to metadata
- if ( $accessKeyExists && !empty($resourceGroups) ) {
-
- // Has authentication provider information been specified?
- if ( $authentication ) {
-
- // Is the user currently logged in?
- if ( $username ) {
-
- if ( $authorization = App::Get()->getAuthorizationProvider() ) {
- // Obtain the groups for the current user
- $userGroups = $authorization->retrieveGroupsForUser($username);
-
- // Perform a comparison via array intersection to determine overlap
- $x = array_intersect($userGroups,$resourceGroups);
-
- if (empty($x)) { // No intersection found between user and resource groups
-
- // Examine the policy to determine how to handle the failure
- switch ($policy) {
- case CasBrowser::VIS_LIMIT:
- // Allow the user to proceed, the metadata visibility policy
- // will be used to determine what is visible to non-authorized
- // users.
- return CasBrowser::VIS_LIMIT;
- default:
- // Kick the user out at this point, deny all access.
- return CasBrowser::VIS_NONE;
- }
- } else {
- // We have an authorized user
- $authorizedUser = true;
- }
- } else {
-
- // If no authorization provider information exists in the application
- // configuration file, it is assumed that every user is authorized once
- // logged in.
- return CasBrowser::VIS_ALL;
- }
- } else {
-
- // If no logged in user, and policy says DENY, kick the user
- if ($policy == CasBrowser::VIS_DENY) {
- return CasBrowser::VIS_NONE;
- } else {
- return CasBrowser::VIS_LIMIT;
- }
- }
- } else {
- // If no authentication provider information exists in the application
- // configuration file, it is assumed that authentication and authorization
- // are not needed for this application, and thus every user is authorized
- // by default.
- return CasBrowser::VIS_ALL;
- }
- } else {
-
- // All data is visible to user if logged in
- // Has authentication provider information been specified?
- if ( $authentication ) {
-
- // Is the user currently logged in?
- if ( $username ) {
- return CasBrowser::VIS_ALL; // We have an authorized user
- } else {
- // If no logged in user, and policy says DENY, kick the user
- if ($policy == CasBrowser::VIS_DENY) {
- return CasBrowser::VIS_NONE;
- } else {
- return CasBrowser::VIS_LIMIT;
- }
- }
- } else {
- // If no authentication provider information exists in the application
- // configuration file, it is assumed that authentication and authorization
- // are not needed for this application, and thus every user is authorized
- // by default.
- return CasBrowser::VIS_ALL;
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/classes/Utils.class.php
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/classes/Utils.class.php b/balance/modules/cas-browser/classes/Utils.class.php
deleted file mode 100644
index e8d608a..0000000
--- a/balance/modules/cas-browser/classes/Utils.class.php
+++ /dev/null
@@ -1,388 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-require_once("CasBrowser.class.php");
-
-class Utils{
-
- public static $acceptedReturnTypes = array('html', 'json');
-
- /**
- * @param types
- * An array of PoductTypes.
- *
- * @return
- * An array of unique names of Metadata and Elements associated with the given
- * ProductTypes.
- */
- public static function getMetadataElements($types){
- $cb = new CasBrowser();
- $client = $cb->getClient();
- $metadataNames = array();
- foreach($types as $type){
- foreach(array_keys($type->getTypeMetadata()->toAssocArray()) as $metadata){
- if(!in_array($metadata, $metadataNames)){
- array_push($metadataNames, $metadata);
- }
- }
- foreach($client->getElementsByProductType($type) as $element){
- $elementName = $element->getElementName();
- if(!in_array($elementName, $metadataNames)){
- array_push($metadataNames, $elementName);
- }
- }
- }
- return $metadataNames;
- }
-
- /**
- * @param productType
- * The productType of the ProductPage desired.
- *
- * @param pageNum
- * The number of the page desired in the set of ProductPages of that ProductType.
- *
- * @return
- * The requested ProductPage object.
- */
- public static function getPage($productType, $pageNum){
- $cb = new CasBrowser();
- $client = $cb->getClient();
-
- // Iterate until the proper page is reached
- for($page = $client->getFirstPage($productType);
- $page->getPageNum() < $pageNum && $page->getPageNum() < $page->getTotalPages();
- $page = $client->getNextPage($productType, $page)){}
-
- return $page;
- }
-
- public static function getRequestedReturnType($requestedType){
- $lowerRequestedType = strtolower($requestedType);
- if(!in_array($lowerRequestedType, self::$acceptedReturnTypes)){
- throw new CasBrowserException('Error: The requested return type of '. $requestedType . 'is not accepted.');
- }
- return $lowerRequestedType;
- }
-
- public static function getProductListMetadata($products){
- $payload = array();
- foreach($products as $p){
- $cb = new CasBrowser();
- $client = $cb->getClient();
- $met = $client->getMetadata($p);
- $payload[$p->getId()] = $met;
- }
- return $payload;
- }
-
- // What kind of access should the currently authenticated user have, given the
- // provided groups (aka roles, permissions) associated with the resource?
- //
- // Possible values are: CasBrowser::{VIS_ALL, VIS_LIMIT, VIS_NONE}. It is up to the
- // caller to determine what to do based on the return value
- //
- public static function ResourceVisibility( $resourceGroups ) {
-
- // Is the resource considered "public"?
- if (in_array(App::Get()->settings['browser_data_public_access'],$resourceGroups)) {
- return CasBrowser::VIS_ALL;
- }
-
- // Get user authentication info
- $authentication = App::Get()->getAuthenticationProvider();
- $username = ($authentication)
- ? $authentication->getCurrentUsername()
- : false; // no authentication info provided in config file
-
- // Does the metadata visibility depend on an access element matching
- // the `browser_data_access_key` in the config setting?
- $accessKeyExists = isset(App::Get()->settings['browser_data_access_key']);
-
- // If key is set then we look into what groups have access to metadata
- if ( $accessKeyExists && !empty($resourceGroups) ) {
-
- // Has authentication provider information been specified?
- if ( $authentication ) {
-
- // Is the user currently logged in?
- if ( $username ) {
-
- // Obtain the groups for the current user
- $userGroups = App::Get()->getAuthorizationProvider()->retrieveGroupsForUser($username);
-
- // Perform a comparison via array intersection to determine overlap
- $x = array_intersect($userGroups,$resourceGroups);
-
- if (empty($x)) { // No intersection found between user and resource groups
-
- // Examine `browser_pt_auth_policy` to determine how to handle the failure
- switch (strtoupper(App::Get()->settings['browser_pt_auth_policy'])) {
- case "LIMIT":
- // Allow the user to proceed, the metadata visibility policy
- // will be used to determine what is visible to non-authorized
- // users.
- return CasBrowser::VIS_LIMIT;
- case "DENY":
- default:
- // Kick the user out at this point, deny all access.
- return CasBrowser::VIS_NONE;
- }
- } else {
- // We have an authorized user
- $authorizedUser = true;
- }
- } else {
- // If no logged in user, and policy says DENY, kick the user
- if (strtoupper(App::Get()->settings[$metType]) == "DENY") {
- return CasBrowser::VIS_NONE;
- } else {
- return CasBrowser::VIS_LIMIT;
- }
- }
- } else {
- // If no authentication provider information exists in the application
- // configuration file, it is assumed that authentication and authorization
- // are not needed for this application, and thus every user is authorized
- // by default.
- return CasBrowser::VIS_ALL;
- }
- } else {
-
- // All data is visible to user if logged in
- // Has authentication provider information been specified?
- if ( $authentication ) {
-
- // Is the user currently logged in?
- if ( $username ) {
- return CasBrowser::VIS_ALL; // We have an authorized user
- } else {
- // If no logged in user, and policy says DENY, kick the user
- if (strtoupper(App::Get()->settings[$metType]) == "DENY") {
- return CasBrowser::VIS_NONE;
- }
- return CasBrowser::VIS_LIMIT;
- }
- } else {
- // If no authentication provider information exists in the application
- // configuration file, it is assumed that authentication and authorization
- // are not needed for this application, and thus every user is authorized
- // by default.
- return CasBrowser::VIS_ALL;
- }
- }
- }
-
- // Create a criteria subtree that will search for the value at the given criteriaIndex across all
- // metadata elements associated with the given productTypes.
- public static function createBasicSearchSubtree($criteriaIndex, $queryTypes){
- $criterion = new CAS_Filemgr_BooleanQueryCriteria();
- $criterion->setOperator(CAS_Filemgr_BooleanQueryCriteria::$OR_OP);
- $metadataNames = getMetadataElements($queryTypes);
- foreach($metadataNames as $name){
- $term = new CAS_Filemgr_TermQueryCriteria();
- $term->setElementName($name);
- $term->setValue($_POST['Criteria'][$criteriaIndex]['Value']);
- $criterion->addTerm($term);
- }
- return $criterion;
- }
-
- public static function createTermCriteria($criteriaIndex, $queryTypes){
- if(!isset($_POST['Criteria'][$criteriaIndex]['ElementName'])){
- throw new CasBrowserException("Query Term criterion " . $criteriaIndex . " does not contain 'ElementName' specification");
- }
- if(!isset($_POST['Criteria'][$criteriaIndex]['Value'])){
- throw new CasBrowserException("Query Term criterion " . $criteriaIndex . " does not contain 'Value' specification");
- }
- if($_POST['Criteria'][$criteriaIndex]['ElementName'] == '*'){
- $criterion = self::createBasicSearchSubtree($criteriaIndex, $queryTypes);
- }else{
- $criterion = new CAS_Filemgr_TermQueryCriteria();
- $criterion->setElementName($_POST['Criteria'][$criteriaIndex]['ElementName']);
- $criterion->setValue($_POST['Criteria'][$criteriaIndex]['Value']);
- }
- return $criterion;
- }
-
- public static function createRangeCriteria($criteriaIndex){
- if(!isset($_POST['Criteria'][$criteriaIndex]['ElementName'])){
- throw new CasBrowserException("Query Term criterion " . $criteriaIndex . " does not contain 'ElementName' specification");
- }
- if(!isset($_POST['Criteria'][$criteriaIndex]['Min'])){
- throw new CasBrowserException("Query Range criterion " . $criteriaIndex . " does not contain 'Min' specification");
- }
- if(!isset($_POST['Criteria'][$criteriaIndex]['Max'])){
- throw new CasBrowserException("Query Range criterion " . $criteriaIndex . " does not contain 'Max' specification");
- }
- $criterion = new CAS_Filemgr_RangeQueryCriteria();
- $criterion->setElementName($_POST['Criteria'][$criteriaIndex]['ElementName']);
- $criterion->setStartValue($_POST['Criteria'][$criteriaIndex]['Min']);
- $criterion->setEndValue($_POST['Criteria'][$criteriaIndex]['Max']);
- if(isset($_POST['Criteria'][$criteriaIndex]['Inclusive'])){
- $criterion->setInclusive($_POST['Criteria'][$criteriaIndex]['Inclusive']);
- }
- return $criterion;
- }
-
- public static function createBooleanCriteria($criteriaIndex, $queryTypes, $createdIndices){
- if(!isset($_POST['Criteria'][$criteriaIndex]['Operator'])){
- throw new CasBrowserException("Query Boolean criterion " . $criteriaIndex . " does not contain 'Operator' specification");
- }
- if(!isset($_POST['Criteria'][$criteriaIndex]['CriteriaTerms'])){
- throw new CasBrowserException("Query Boolean criterion " . $criteriaIndex . " does not contain 'CriteriaTerms' specification");
- }
- if(!count($_POST['Criteria'][$criteriaIndex]['CriteriaTerms'])){
- throw new CasBrowserException("Query Boolean criterion " . $criteriaIndex . " does not contain any terms");
- }
- $criterion = new CAS_Filemgr_BooleanQueryCriteria();
- $operator = trim(strtoupper($_POST['Criteria'][$criteriaIndex]['Operator']));
- if($operator == 'AND'){
- $criterion->setOperator(CAS_Filemgr_BooleanQueryCriteria::$AND_OP);
- }elseif($operator == 'OR'){
- $criterion->setOperator(CAS_Filemgr_BooleanQueryCriteria::$OR_OP);
- }elseif($operator == 'NOT'){
- if(count($_POST['Criteria'][$criteriaIndex]['CriteriaTerms']) != 1){
- throw new CasBrowserException("Query Boolean criterion " . $criteriaIndex . " cannot negate more than one term");
- }
- $criterion->setOperator(CAS_Filemgr_BooleanQueryCriteria::$NOT_OP);
- }else{
- throw new CasBrowserException("Error: Query Boolean criterion " . $criteriaIndex . " tries to use undefined operator '" . $operator . "'");
- }
- foreach(array_map("intval", $_POST['Criteria'][$criteriaIndex]['CriteriaTerms']) as $childIndex){
- if(in_array($childIndex, $createdIndices)){ // Check for loops in criteria tree
- throw new CasBrowserException("Criterion " . $criteriaIndex . " lists " . $childIndex . "as a child, making a loop.");
- }
- array_push($createdIndices, $childIndex);
- $child = self::createCriteriaTree($childIndex, $queryTypes);
- $criterion->addTerm($child);
- }
- return $criterion;
- }
-
- public static function createCriteriaTree($criteriaIndex, $queryTypes, $createdIndices=null){
- if(!isset($createdIndices)){
- $createdIndices = array();
- }
- if(!isset($_POST['Criteria'][$criteriaIndex])){
- throw new CasBrowserException("Query Boolean criterion " . $criteriaIndex . " does not exist.");
- }
- $type = strtolower($_POST['Criteria'][$criteriaIndex]['CriteriaType']);
- if($type == 'term'){
- $criterion = self::createTermCriteria($criteriaIndex, $queryTypes);
- }elseif($type == 'range'){
- $criterion = self::createRangeCriteria($criteriaIndex);
- }elseif($type == 'boolean'){
- $criterion = self::createBooleanCriteria($criteriaIndex, $queryTypes, $createdIndices);
- }else{
- throw new CasBrowserException("Query criterion " . $criteriaIndex . " contains an unknown type " . $type . ". Please use one of 'term', 'range' or 'boolean'");
- }
- return $criterion;
- }
-
- public static function getMetadataNamesForTypeProducts($type){
- $cb = new CasBrowser();
- $client = $cb->getClient();
- $elementNames = array();
- foreach($client->getElementsByProductType($type) as $e){
- array_push($elementNames, $e->getElementName());
- }
- foreach(array_keys($type->getTypeMetadata()->toAssocArray()) as $typeElementName){
- if(!in_array($typeElementName, $elementNames)){
- array_push($elementNames, $typeElementName);
- }
- }
- return $elementNames;
- }
-
- public static function getFacets(){
- $cb = new CasBrowser();
- $client = $cb->getClient();
- $types = $client->getProductTypes();
- $facets = self::getMetadataNamesForTypeProducts(array_pop($types));
- if(count($types) == 0){
- return $facets; // In case there is only one product type
- }
- foreach($types as $type){
- $elementNames = self::getMetadataNamesForTypeProducts($type);
- $facets = array_intersect($facets, $elementNames);
- }
- return $facets;
- }
-
- public static function paginate($allProducts, $pageNum, $pageSize){
- if(count($allProducts) == 0){
- return array();
- }
- if($pageSize <= 0){
- throw new CasBrowserException("The given PageSize (" . $pageSize . ") was zero or less.");
- }
- $startIndex = ($pageNum - 1) * $pageSize;
- if($startIndex >= count($allProducts)){
- throw new CasBrowserException("The starting index of the requested page (" .
- $startIndex . ") is greater than the last index of all products (" .
- count($allProducts) . ").");
- }
- $endIndex = $startIndex + $pageSize - 1;
- $endIndex = min($endIndex, count($allProducts) - 1);
- $requestedProducts = array();
- for($i = $startIndex; $i <= $endIndex; $i++){
- array_push($requestedProducts, $allProducts[$i]);
- }
- return $requestedProducts;
- }
-
- public static function formatResults($products){
- $cb = new CasBrowser();
- $client = $cb->getClient();
- $results = array();
- foreach($products as $product){
- try{
- $p = array('id'=>$product['product']->getId(),
- 'name'=>urlDecode($product['product']->getName()),
- 'metadata'=>$client->getMetadata($product['product'])->toAssocArray());
- if(isset($product['typeName'])){
- $p['type'] = $product['typeName'];
- }
- array_push($results, $p);
- }catch(Exception $e){
- throw new CasBrowserException("An error occured while formatting product [" .
- $product['product']->getId() . "] metadata: " . $e->getMessage());
- }
- }
- return $results;
- }
-
- public static function reportError($message, $outputFormat){
- if($outputFormat == 'html'){
- echo '<div class="error">' . $message . '</div>';
- }elseif($outputFormat == 'json'){
- $payload = array();
- $payload['Error'] = 1;
- $payload['ErrorMsg'] = $message;
- $payload = json_encode($payload);
- echo $payload;
- }
- exit();
- }
-
-}
-
-class CasBrowserException extends Exception{}
-
-?>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/config.ini
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/config.ini b/balance/modules/cas-browser/config.ini
deleted file mode 100644
index f397af8..0000000
--- a/balance/modules/cas-browser/config.ini
+++ /dev/null
@@ -1,121 +0,0 @@
-; Licensed to the Apache Software Foundation (ASF) under one or more
-; contributor license agreements. See the NOTICE file distributed with
-; this work for additional information regarding copyright ownership.
-; The ASF licenses this file to You under the Apache License, Version 2.0
-; (the "License"); you may not use this file except in compliance with
-; the License. You may obtain a copy of the License at
-;
-; http://www.apache.org/licenses/LICENSE-2.0
-;
-; Unless required by applicable law or agreed to in writing, software
-; distributed under the License is distributed on an "AS IS" BASIS,
-; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-; See the License for the specific language governing permissions and
-; limitations under the License.
-
-
-; CAS-BROWSER module configuration file
-; ------------------------------------------------------------------------
-
-
-; FILE MANAGER CONNECTIVITY
-; -----------------------------------------------------------------------------
-; Specify connection information for an instance of the OODT file manager.
-;
-browser_filemgr_url = http://localhost:9000
-browser_filemgr_path = /
-browser_datadeliv_url = http://host:port/path
-
-
-
-; AUTHENTICATION AND AUTHORIZATION
-; -----------------------------------------------------------------------------
-; Customize the behavior of the module for specific auth & auth requirements.
-
-; This key specifies the behavior to take when users attempt to access resources
-; for which they do not have the necessary permissions. There are two options:
-;
-; deny => force redirect with a 403 Not Authorized error
-; This option prevents a user from viewing any information about
-; products or productTypes they are not authorized to see.
-;
-; limit => apply the metadata filtering policy specified in element-visibility.ini
-; to control access to information on a more granular, element by
-; element level. This allows users to see publicly available information
-; about an otherwise protected product or productType.
-;
-; Policy for product types:
-browser_pt_auth_policy = limit
-; Policy for products:
-browser_p_auth_policy = limit
-
-; This key specifies the productType metadata element that contains
-; the list of security groups (aka roles, permissions,etc) that should
-; be granted access. This key can exist in productType metadata, or
-; product metadata, or both. If it exists in productType metadata only,
-; products will inherit the information.
-;
-browser_data_access_key = AccessGrantedTo
-browser_data_public_access = public
-
-; LOOK AND FEEL SETTINGS
-; -----------------------------------------------------------------------------
-; Customize aspects of the user interface to suit project needs
-
-browser_index_title_text = Cas Browser
-
-; These keys identify the metadata keys used to obtain basic product type
-; information. These rarely need to be manually changed.
-; browser_pt_name_key: the product type name
-; browser_pt_desc_key: the key containing a description of the product type
-; browser_pt_id_key: the key containing the unique product type id (urn)
-
-browser_pt_name_key = name
-browser_pt_desc_key = description
-browser_pt_id_key = id
-
-; These keys determine which metadata elements will
-; appear as column headers on the dataset viewer
-
-browser_pt_search_met[] = name
-browser_pt_search_met[] = description
-browser_pt_search_met[] = id
-
-; This key determines which of the `browser_pt_search_met` keys will be used
-; as the clickable link taking the user to the overview page for the given
-; product type
-
-browser_pt_search_linkkey = name
-
-; These keys specify (an array of) product types to exclude from the
-; product type list displayed on the index page.
-browser_dataset_ignores[] = urn:oodt:GenericFile
-
-
-
-; The browser_products_met[] array key dictates which metadata elements will
-; be displayed in the products view. One can designate any number of
-; elements to display (including zero), but all of them must be defined for
-; all product types.
-
-browser_products_met[] = CAS.ProductId
-browser_products_met[] = MimeType
-browser_products_met[] = ProductStructure
-browser_products_met[] = CAS.ProductReceivedTime
-
-; The browser_private_products_visibility key dictates whether private products
-; will be displayed in the products view.
-browser_private_products_visibility = true
-
-; If the browser_show_download_widget key is set to 0, the download widget in
-; the products view won't be displayed. If the key is set to any other value
-; the widget will be displayed.
-
-browser_show_download_widget=1
-
-; If default_show_all is set to 1, then the typesearch view will, by deafult,
-; display all products of all types when the view is opened. Otherwise, no
-; products will be shown in the typesearch vie until filters are specified.
-
-default_show_all = 1
-
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/element-ordering.ini
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/element-ordering.ini b/balance/modules/cas-browser/element-ordering.ini
deleted file mode 100644
index 72c51fd..0000000
--- a/balance/modules/cas-browser/element-ordering.ini
+++ /dev/null
@@ -1,64 +0,0 @@
-;
-; Licensed to the Apache Software Foundation (ASF) under one or more
-; contributor license agreements. See the NOTICE file distributed with
-; this work for additional information regarding copyright ownership.
-; The ASF licenses this file to You under the Apache License, Version 2.0
-; (the "License"); you may not use this file except in compliance with
-; the License. You may obtain a copy of the License at
-;
-; http://www.apache.org/licenses/LICENSE-2.0
-;
-; Unless required by applicable law or agreed to in writing, software
-; distributed under the License is distributed on an "AS IS" BASIS,
-; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-; See the License for the specific language governing permissions and
-; limitations under the License.
-
-;
-; ELEMENT-ORDERING.INI
-;
-; This file defines the order of metadata keys on a per-product-type basis
-; Elements not explicitly mentioned in this file will be displayed following
-; all of the explicitly ordered elements.
-;
-; The global section [*] can be used to define a default ordering to apply.
-; Note that, if a product type declaration is found, its ordering overrides
-; the default ordering in [*].
-;
-; There are two ordered arrays for each product type:
-; pt.element.ordering: specifies product-type metadata order
-; p.element.ordering: specifies product metadata order
-;
-
-[*]
-;product type metadata element ordering (global)
-; the '.first' array indicates those elements which should be shown BEFORE
-; all other metadata elements:
-pt.element.ordering.first[] =
-
-
-; the '.last' array indicates those elements that should be shown AFTER
-; all other metadata elements. The last element in this array will be
-; shown last.
-pt.element.ordering.last[] =
-
-
-; product metadata element ordering (global)
-; the '.first' array indicates those elements that should be shown BEFORE
-; all other metadata elements:
-p.element.ordering.first[] =
-; the '.last' array indicates those elements that should be shown AFTER
-; all other metadata elements. The last element in this array will be
-; shown last.
-p.element.ordering.last[] =
-
-; It is possible to override the global settings on a per-productType basis
-; simply by defining a productType header and re-defining the pt.element.ordering.*
-; arrays for that productType. ProductType-specific settings do not inherit from
-;the global settings.
-;
-;[urn:oodt:GenericFile]
-;pt.element.ordering.first[] =
-;pt.element.ordering.last[] =
-;p.element.ordering.first[] =
-;p.element.ordering.last[] =
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/element-visibility.ini
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/element-visibility.ini b/balance/modules/cas-browser/element-visibility.ini
deleted file mode 100644
index 103f9db..0000000
--- a/balance/modules/cas-browser/element-visibility.ini
+++ /dev/null
@@ -1,49 +0,0 @@
-;
-; ELEMENT-VISIBILITY.INI
-;
-; This file controls the visibility of metadata elements for product types
-; known to the underlying file manager instance.
-;
-; Specify the interpretation policy for this file. This can take one of two values:
-; show: Definitions in this file indicate metadata keys which should be SHOWN
-; hide: Definitions in this file indicate metadata keys which should be HIDDEN
-;
-; If the policy is 'show' and an element does NOT appear in this file, it will be
-; hidden. Conversely, if the policy is 'hide' and an element does NOT appear in
-; this list, it will be shown.
-
-interpretation.policy = hide
-
-; Next, define element visibility on a per-product-type basis.
-; To specify definitions for a particular product type, first declare the product type
-; by enclosing its URN in square brackets on its own line, e.g.:
-; [urn:oodt:GenericFile]
-; (without the leading ';', obviously) and then add element visibility definitions below.
-;
-; Element visibility definitions take three forms:
-; visibility.always: will be {shown/hidden} regardless of authentication
-; visibility.anonymous: will be {shown/hidden} for anonymous users
-; visibility.authenticated: will be {shown/hidden} for authenticated users
-; Note that {shown/hidden} is determined by the interpretation.policy for the file. That is,
-; if the interpretation policy is "show", then the keys under visibility.always will always
-; be shown. If the interpretation is "hide", however, those same keys will always be
-; hidden.
-;
-;
-;
-; Definitions under the product type label [*] will be applied to all product types and
-; merged with any product-type-specific definitions which may come later in the file.
-[*]
-visibility.always[] =
-visibility.anonymous[] =
-visibility.authenticated[] =
-
-; EXAMPLE of product-type specific override:
-; Definitions for the FHCRC Hanash (Annexin-LAMR) product type
-;
-;[urn:edrn:FHCRCHanashAnnexinLamr]
-;visibility.always[] =
-;visibility.anonymous[] =
-;visibility.authenticated[] =
-
-
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/hooks.php
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/hooks.php b/balance/modules/cas-browser/hooks.php
deleted file mode 100644
index ba0c212..0000000
--- a/balance/modules/cas-browser/hooks.php
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * HOOKS.PHP
- *
- * Hooks provide the ability, as the name implies, to hook into various parts of
- * the view rendering process and insert customizations. The contents of these
- * functions are run at the appropriate time *EVERY* time a view is rendered, i.e.
- * the content of the hooks is not by default view-specific but rather will be
- * applied to all views. (However, there is nothing that prevents developers from
- * inserting conditional logic inside a hook that then causes view-specific
- * them to exhibit view-specific behavior).
- *
- * Take a look at the docblock descriptions of each hook to get a sense of where
- * in the view rendering process the hook is invoked.
- *
- * @author ahart
- */
-
-/**
- * hook_before_header
- *
- * This hook is executed before the contents of the header file are processed.
- */
-function hook_before_header() {}
-
-/**
- * hook_before_view
- *
- * This hook is executed before the contents of the main view are processed.
- */
-function hook_before_view() {
- require_once( 'scripts/widgets/BreadcrumbsWidget.php' );
-
- $module = App::Get()->loadModule();
- // Include JavaScript files to be shown with every view in this module
- App::Get()->response->addJavascript($module->moduleStatic.'/js/jquery-1.4.2-min.js');
- App::Get()->response->addJavascript($module->moduleStatic.'/js/jcorner.jquery.js');
-
- // Include CAS-Browser default CSS stylesheets to be shown with every view in this module
- App::Get()->response->addStylesheet($module->moduleStatic.'/css/cas-browser.css');
- App::Get()->response->addStylesheet($module->moduleStatic.'/css/dataTables.css');
-}
-
-/**
- * hook_before_footer
- *
- * This hook is executed before the contents of the footer are processed
- */
-function hook_before_footer() {}
-
-/**
- * hook_before_render
- *
- * This hook is after all of the view components (header, view, footer) have been
- * processed but before the processed results are sent out across the wire to the
- * browser.
- */
-function hook_before_send() {}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/scripts/allTypeScript.php
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/scripts/allTypeScript.php b/balance/modules/cas-browser/scripts/allTypeScript.php
deleted file mode 100644
index c366a5a..0000000
--- a/balance/modules/cas-browser/scripts/allTypeScript.php
+++ /dev/null
@@ -1,64 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-$module = App::Get()->loadModule();
-require_once(dirname(dirname(__FILE__)) . '/classes/CasBrowser.class.php');
-
-$outputFormat = 'json'; // Hard-coded for now
-
-// Get client handle
-$cb = new CasBrowser();
-$client = $cb->getClient();
-
-$results = array('results'=>array());
-
-// Get all products and their types
-$allProducts = array();
-foreach($client->getProductTypes() as $type){
- foreach($client->getProductsByProductType($type) as $product){
- array_push($allProducts, array('product'=>$product, 'typeName'=>$type->getName()));
- }
-}
-
-// Narrow down the given products to the requested page (if page info is given)
-$requestedProducts = array();
-if(isset($_POST['PageNum']) && isset($_POST['PageSize'])){
- $pageNum = intval($_POST['PageNum']);
- $pageSize = intval($_POST['PageSize']);
- try{
- $requestedProducts = Utils::paginate($allProducts, $pageNum, $pageSize);
- }catch(Exception $e){
- Utils::reportError($e->getMessage(), $outputFormat);
- }
- $results['totalPages'] = ceil(count($allProducts) / $pageSize);
-}else{
- $requestedProducts = $allProducts;
-}
-
-// Get metadata and format requested products
-try{
- $results['results'] = Utils::formatResults($requestedProducts);
-}catch(Exception $e){
- Utils::reportError($e->getMessage(), $outputFormat);
-}
-
-$results['totalProducts'] = count($allProducts);
-
-echo json_encode($results);
-
-?>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/scripts/crossTypeQueryScript.php
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/scripts/crossTypeQueryScript.php b/balance/modules/cas-browser/scripts/crossTypeQueryScript.php
deleted file mode 100644
index d228f2b..0000000
--- a/balance/modules/cas-browser/scripts/crossTypeQueryScript.php
+++ /dev/null
@@ -1,246 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-$module = App::Get()->loadModule();
-require_once(dirname(dirname(__FILE__)) . '/classes/CasBrowser.class.php');
-
-global $messages;
-$messages = array();
-
-function searchBooleanMetadata($pts, $booleanCriterion){
- global $messages;
- $resultTypes = array();
- $terms = $booleanCriterion->getTerms();
- if($booleanCriterion->getOperator() == CAS_Filemgr_BooleanQueryCriteria::$AND_OP){
- $resultTypes = $pts;
- foreach($terms as $t){
- try{
- $resultTypes = searchTypeMetadata($resultTypes, $t);
- array_push($messages, count($termResults) . " types returned to boolean type search");
- }catch(Exception $e){
- throw new CasBrowserException("Exception occurred while searching type metadata in boolean AND term ("
- . $t->getElementName() . " = " . $t->getValue() . "): " . $e->getMessage());
- }
- if(!count($resultTypes)){
- array_push($messages, "No types found that match the boolean AND query");
- return array();
- }
- }
- }elseif($booleanCriterion->getOperator() == CAS_Filemgr_BooleanQueryCriteria::$OR_OP){
- foreach($terms as $t){
- try{
- $termResults = searchTypeMetadata($pts, $t);
- }catch(Exception $e){
- throw new CasBrowserException("Exception occurred while searching type metadata in boolean OR term ("
- . $t->getElementName() . " = " . $t->getValue() . "): " . $e->getMessage());
- }
- $resultTypes += $termResults; // Not sure if this is correct
- if(count($resultTypes) == count($pts)){
- array_push($messages, "All types match the boolean OR query");
- return $pts;
- }
- }
- }elseif($booleanCriterion->getOperator() == CAS_Filemgr_BooleanQueryCriteria::$NOT_OP){
- try{
- $termResults = searchTypeMetadata($pts, $terms[0]);
- }catch(Exception $e){
- throw new CasBrowserException("Exception occurred while searching type metadata in boolean NOT term: "
- . $e->getMessage());
- }
- $resultTypes = array_merge(array_diff($pts, $termResults));
- }else{
- throw new CasBrowserException("A BooleanQueryCriteria object has an invalid operator");
- }
- array_push($messages, count($resultTypes) . " types found that match the boolean query");
- return $resultTypes;
-}
-
-function searchTermMetadata($pts, $termCriterion){
- global $messages;
- $key = $termCriterion->getElementName();
- $value = $termCriterion->getValue();
- array_push($messages, "Searching type metadata for " . $key . " = " . $value . " in " . count($pts) . " types");
- $resultTypes = array();
- foreach($pts as $pt){
- $ptMet = $pt->getTypeMetadata();
- if(array_key_exists($key, $ptMet->toAssocArray())){
- if($ptMet->isMultiValued($key)){
- $ptMetValues = $ptMet->getAllMetadata($key);
- for($i = 0; $i < count($ptMetValues); $i++){
- //array_push($messages, "Comparing type " . $pt->getName() . " key " . $key . " value: " . $ptMetValues[$i]);
- if($ptMetValues[$i] == $value){
- array_push($resultTypes, $pt);
- $i = count($ptMetValues);
- }
- }
- }elseif($ptMet->getMetadata($key) == $value){
- array_push($resultTypes, $pt);
- }
- }
- }
- array_push($messages, count($resultTypes) . " types found that match the term");
- return $resultTypes;
-}
-
-function searchTypeMetadata($pts, $criterion){
- if($criterion == NULL){
- throw new CasBrowserException("A null criterion was given to search for type metadata");
- }
- if($pts == NULL){
- throw new CasBrowserException("A null list of product types was given to search for type metadata");
- }
- if(!count($pts)){
- throw new CasBrowserException("An empty list of product types was given to search for type metadata");
- }
- if($criterion instanceof CAS_Filemgr_TermQueryCriteria){
- return searchTermMetadata($pts, $criterion);
- }elseif($criterion instanceof CAS_Filemgr_RangeQueryCriteria){
- return array(); // Not yet supported
- }elseif($criterion instanceof CAS_Filemgr_BooleanQueryCriteria){
- return searchBooleanMetadata($pts, $criterion);
- }else{
- throw new CasBrowserException("An unknown query criteria type was encountered while search product type metadata");
- }
-}
-
-
-
-
-$outputFormat = 'json'; // Hard-coded for now
-
-// Get client handle
-$cb = new CasBrowser();
-$client = $cb->getClient();
-
-$results = array('results'=>array());
-
-// Ceate an array of ProductTypes to be queried
-try{
- if(!isset($_POST['Types'])){
- Utils::reportError("POST does not contain 'Types' sub-array", $outputFormat);
- }
- if(count($_POST['Types']) == 0){
- Utils::reportError("No product types were specified in POST", $outputFormat);
- }
- $queryTypes = array();
- $allTypes = $client->getProductTypes();
- if($_POST['Types'][0] == '*'){
- $queryTypes = $allTypes;
- }else{
- $allTypeNames = array_map(create_function('$t', 'return $t->getName();'), $allTypes);
- foreach($_POST['Types'] as $type){
- if(!in_array($type, $allTypeNames)){
- $errStr = "Error: The type " . $type . " is not used in the repository. Please use one of: ";
- $errStr .= $allTypeNames[0];
- for($i = 1; $i < count($allTypeNames); $i++){
- $errStr .= ", " . $allTypeNames[$i];
- }
- Utils::reportError($errStr, $outputFormat);
- }
- array_push($queryTypes, $client->getProductTypeByName($type));
- }
- if(!count($queryTypes)){
- Utils::reportError("No ProductTypes were given to query", $outputFormat);
- }
- }
-}catch(Exception $e){
- Utils::reportError($e->getMessage(), $outputFormat);
-}
-
-// Create the tree of criteria objects that define the query. The tree root is returned.
-if(!isset($_POST['Criteria'])){
- Utils::reportError("POST does not contain 'Criteria' sub-array", $outputFormat);
-}
-if(!count($_POST['Criteria'])){
- Utils::reportError("POST sub-array 'Criteria' contains no criteria", $outputFormat);
-}
-$rootIndex = (isset($_POST['RootIndex']))
- ? intval($_POST['RootIndex'])
- : 0;
-try{
- $criteriaTree = Utils::createCriteriaTree($rootIndex, $queryTypes, null);
-}catch(Exception $e){
- Utils::reportError($e->getMessage(), $outputFormat);
-}
-
-// Search inside of product type metadata for results to further refine search
-// NOTE: This is all currently a dirty hack! This needs major refinement!
-$allMatchingProducts = array();
-$typesByName = array();
-foreach($queryTypes as $t){
- $typesByName[$t->getName()] = $t;
-}
-try{
- $matchingPTs = searchTypeMetadata($queryTypes, $criteriaTree);
-}catch(Exception $e){
- Utils::reportError("An exception occurred while searching type metadata: " . $e->getMessage(), $outputFormat);
-}
-foreach($matchingPTs as $matchingType){
- array_splice($queryTypes, array_search($matchingType, $queryTypes), 1); // Remove types that match from query
- foreach($client->getProductsByProductType($matchingType) as $p){ // Add all products of matching types
- array_push($allMatchingProducts, array('product'=>$p, 'typeName'=>$matchingType->getName()));
- }
-}
-
-// Add criteria to query object
-$query = new CAS_Filemgr_Query();
-$query->addCriterion($criteriaTree);
-
-// Perform the query and collect results
-try{
- foreach($queryTypes as $type){
- $queryResultsOfType = $client->query($query, $type);
- if(count($queryResultsOfType) > 0){
- foreach($queryResultsOfType as $matchingProduct){
- array_push($allMatchingProducts, array('product'=>$matchingProduct, 'typeName'=>$type->getName()));
- }
- }
- }
-}catch(Exception $e){
- Utils::reportError($e->getMessage(), $outputFormat);
-}
-
-// Narrow down the given products to the requested page (if page info is given)
-$requestedProducts = array();
-if(isset($_POST['PageNum']) && isset($_POST['PageSize'])){
- $pageNum = intval($_POST['PageNum']);
- $pageSize = intval($_POST['PageSize']);
- try{
- $requestedProducts = Utils::paginate($allMatchingProducts, $pageNum, $pageSize);
- }catch(Exception $e){
- Utils::reportError($e->getMessage(), $outputFormat);
- }
- $results['totalPages'] = ceil(count($allMatchingProducts) / $pageSize);
-}else{
- $requestedProducts = $allMatchingProducts;
-}
-
-// Get metadata and format requested products
-try{
- $results['results'] = Utils::formatResults($requestedProducts);
-}catch(Exception $e){
- Utils::reportError($e->getMessage(), $outputFormat);
-}
-
-$results['totalProducts'] = count($allMatchingProducts);
-
-$results['messages'] = $messages;
-
-echo json_encode($results);
-
-?>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/scripts/pageScript.php
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/scripts/pageScript.php b/balance/modules/cas-browser/scripts/pageScript.php
deleted file mode 100644
index 5b4aaec..0000000
--- a/balance/modules/cas-browser/scripts/pageScript.php
+++ /dev/null
@@ -1,102 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-$module = App::Get()->loadModule();
-require_once(dirname(dirname(__FILE__)) . '/classes/CasBrowser.class.php');
-
-// Extract desired output format from POST
-if(isset($_POST['OutputFormat'])){
- try{
- $outputFormat = Utils::getRequestedReturnType($_POST['OutputFormat']);
- }catch(Exception $e){
- Utils::reportError($e->getMessage(), 'html');
- }
-}else{
- $outputFormat = 'html';
-}
-
-// Get client handle
-$cb = new CasBrowser();
-$client = $cb->getClient();
-
-// Extract ProductType from POST
-if(!isset($_POST['Type'])){
- Utils::reportError("POST does not contain 'Type' ProductType", $outputFormat);
-}
-$typeName = $_POST['Type'];
-try{
- $allTypes = $client->getProductTypes();
- $allTypeNames = array_map(create_function('$t', 'return $t->getName();'), $allTypes);
- if(!in_array($typeName, $allTypeNames)){
- $errStr = "The type " . $typeName . " is not used in the repository. Please use one of: ";
- for($i = 0; $i < count($allTypeNames) - 1; $i++){
- $errStr .= $allTypeNames[i] . ", ";
- }
- $errStr .= $allTypeNames[count($allTypeNames) - 1];
- Utils::reportError($errStr, $outputFormat);
- }
- $type = $client->getProductTypeByName($typeName);
-}catch(Exception $e){
- Utils::reportError($e->getMessage(), $outputFormat);
-}
-
-// Extract page number from POST
-if(!isset($_POST['PageNum'])){
- Utils::reportError("POST does not contain 'PageNum'", $outputFormat);
-}
-$pageNum = intval($_POST['PageNum']);
-
-// Get the requested page
-try{
- $page = Utils::getPage($type, $pageNum);
-}catch(Exception $e){
- Utils::reportError($e->getMessage(), $outputFormat);
-}
-
-// Get the products from the requested page -- what we're really after
-$pageProducts = array();
-foreach($page->getPageProducts() as $p){
- array_push($pageProducts, array('product'=>$p));
-}
-
-// Format results
-if($outputFormat == 'html'){
- $payload = '<ul class="pp_productList" id="product_list">';
- foreach($pageProducts as $p){
- $payload .= '<li><a href="' . $module->moduleRoot . '/product/' . $p['product']->getId() . '">';
- $payload .= urlDecode($p['product']->getName()) . '</a></li>';
- }
- $payload .= "</ul>\n";
- $payload .= '<input type="hidden" id="total_pages" value="' . $page->getTotalPages() . '">';
- $payload .= '<input type="hidden" id="page_size" value="' . $page->getPageSize() . '">';
-}elseif ($outputFormat == 'json') {
- $payload = array();
- try{
- $payload['results'] = Utils::formatResults($pageProducts);
- $payload['totalProducts'] = $client->getNumProducts($type);
- }catch(Exception $e){
- Utils::reportError($e->getMessage(), $outputFormat);
- }
- $payload['totalPages'] = $page->getTotalPages();
- $payload['pageSize'] = $page->getPageSize();
- $payload = json_encode($payload);
-}
-
-echo $payload;
-
-?>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/scripts/productTypeFilter.php
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/scripts/productTypeFilter.php b/balance/modules/cas-browser/scripts/productTypeFilter.php
deleted file mode 100644
index 5724cdd..0000000
--- a/balance/modules/cas-browser/scripts/productTypeFilter.php
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- * PRODUCT-TYPE FILTER
- *
- * HTTP Method: GET
- * Input:
- * - key (string) a ProductType metadata key to search on
- * - value (string) the value to use when determining matches
- * Output:
- * - json (default) a json array representing all matching product types
- * with their defined metadata
- *
- */
-$module = App::Get()->loadModule();
-require_once( $module->modulePath . "/classes/CasBrowser.class.php");
-require_once( $module->modulePath . "/scripts/widgets/ProductTypeListWidget.php");
-
-// Get a Cas-Browser XML/RPC Client
-$browser = new CasBrowser();
-$client = $browser->getClient();
-
-// Get a list of the product types managed by this server
-$ptypes = $client->getProductTypes();
-
-// Get the metadata key/val pair that will serve as the needle
-$metKey = urldecode($_GET['key']);
-$needle = urldecode($_GET['value']);
-
-$productTypes = array();
-foreach ($ptypes as $pt) {
- $ptArray = $pt->toAssocArray();
-
- // Check whether the requested met key value matches desired value
- if ($needle == '*' || (isset($ptArray['typeMetadata'][$metKey])
- && $ptArray['typeMetadata'][$metKey][0] == $needle)) {
-
- $merged = array_merge($ptArray['typeMetadata'],array(
- "name" => array($ptArray[App::Get()->settings['browser_pt_name_key']]),
- "description" => array($ptArray[App::Get()->settings['browser_pt_desc_key']]),
- "id" => array($ptArray[App::Get()->settings['browser_pt_id_key']])));
-
- $productTypes[] = $merged;
- }
-}
-
-// Format output as json
-$json = json_encode($productTypes);
-
-// Output the json result
-header('Content-Type: application/json');
-echo $json;
-
-// We're done.
-exit();
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/scripts/queryScript.php
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/scripts/queryScript.php b/balance/modules/cas-browser/scripts/queryScript.php
deleted file mode 100644
index 5566994..0000000
--- a/balance/modules/cas-browser/scripts/queryScript.php
+++ /dev/null
@@ -1,155 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-$module = App::Get()->loadModule();
-require_once(dirname(dirname(__FILE__)) . '/classes/CasBrowser.class.php');
-
-// Extract desired output format from POST
-if(isset($_POST['OutputFormat'])){
- try{
- $outputFormat = Utils::getRequestedReturnType($_POST['OutputFormat']);
- }catch(Exception $e){
- Utils::reportError($e->getMessage(), 'html');
- }
-}else{
- $outputFormat = 'html';
-}
-
-// Get client handle
-$cb = new CasBrowser();
-$client = $cb->getClient();
-
-// Ceate an array of ProductTypes to be queried
-try{
- if(!isset($_POST['Types'])){
- Utils::reportError("POST does not contain 'Types' sub-array", $outputFormat);
- }
- if(count($_POST['Types']) == 0){
- Utils::reportError("No product types were specified in POST", $outputFormat);
- }
- $queryTypes = array();
- $allTypes = $client->getProductTypes();
- if($_POST['Types'][0] == '*'){
- $queryTypes = $allTypes;
- }else{
- $allTypeNames = array_map(create_function('$t', 'return $t->getName();'), $allTypes);
- foreach($_POST['Types'] as $type){
- if(!in_array($type, $allTypeNames)){
- $errStr = "Error: The type " . $type . " is not used in the repository. Please use one of: ";
- $errStr .= $allTypeNames[0];
- for($i = 1; $i < count($allTypeNames); $i++){
- $errStr .= ", " . $allTypeNames[$i];
- }
- Utils::reportError($errStr, $outputFormat);
- }
- array_push($queryTypes, $client->getProductTypeByName($type));
- }
- if(!count($queryTypes)){
- Utils::reportError("No ProductTypes were given to query", $outputFormat);
- }
- }
-}catch(Exception $e){
- Utils::reportError($e->getMessage(), $outputFormat);
-}
-
-// Check if results are desired in a ProductPage and which page of results is desired
-$pagedResults = false;
-$pageNum = 1;
-if(isset($_POST['PagedResults'])){
- if($_POST['PagedResults']){
- if(count($queryTypes) != 1){
- Utils::reportError("Paged queries can only be performed on one ProductType", $outputFormat);
- }
- $pagedResults = true;
- if(isset($_POST['PageNum'])){
- $pageNum = intval($_POST['PageNum']);
- }
- }
-}
-
-// Create the tree of criteria objects that define the query
-if(!isset($_POST['Criteria'])){
- Utils::reportError("POST does not contain 'Criteria' sub-array", $outputFormat);
-}
-if(!count($_POST['Criteria'])){
- Utils::reportError("POST sub-array 'Criteria' contains no criteria", $outputFormat);
-}
-$rootIndex = (isset($_POST['RootIndex']))
- ? intval($_POST['RootIndex'])
- : 0;
-try{
- $criteriaTree = Utils::createCriteriaTree($rootIndex, $queryTypes, null);
-}catch(Exception $e){
- Utils::reportError($e->getMessage(), $outputFormat);
-}
-
-// Add criteria to query object
-$query = new CAS_Filemgr_Query();
-$query->addCriterion($criteriaTree);
-
-// Perform the query and collect results
-$results = array();
-try{
- if($pagedResults){
- $resultPage = $client->pagedQuery($query, $queryTypes[0], $pageNum);
- foreach($resultPage->getPageProducts() as $p){
- array_push($results, array('product'=>$p));
- }
- }else{
- foreach($queryTypes as $type){
- foreach($client->query($query, $type) as $p){
- array_push($results, array('product'=>$p));
- }
- }
- }
-}catch(Exception $e){
- Utils::reportError($e->getMessage(), $outputFormat);
-}
-
-// Format results
-try{
- if($outputFormat == 'html'){
- $payload = '<ul class="pp_productList" id="product_list">';
- foreach($results as $r){
- $payload .= '<li><a href="' . $module->moduleRoot . '/product/' . $r['product']->getId() . '">';
- $payload .= urlDecode($r['product']->getName()) . '</a></li>';
- }
- $payload .= "</ul>\n";
- if($pagedResults){
- $payload .= '<input type="hidden" id="total_pages" value="' . $resultPage->getTotalPages() . '">';
- $payload .= '<input type="hidden" id="page_size" value="' . $resultPage->getPageSize() . '">';
- $payload .= '<input type="hidden" id="total_type_products" value="' . $client->getNumProducts($queryTypes[0]) . '">';
- }
- }elseif ($outputFormat == 'json') {
- $payload = array();
- $payload['results'] = Utils::formatResults($results);
- if($pagedResults){
- $payload['totalPages'] = $resultPage->getTotalPages();
- $payload['pageSize'] = $resultPage->getPageSize();
- $payload['totalProducts'] = $client->getNumProducts($queryTypes[0]);
- }
- $payload = json_encode($payload);
- }
-}catch(Exception $e){
- Utils::reportError($e->getMessage(), $outputFormat);
-}
-
-echo $payload;
-
-?>
-
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/scripts/widgets/BasicSearchWidget.php
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/scripts/widgets/BasicSearchWidget.php b/balance/modules/cas-browser/scripts/widgets/BasicSearchWidget.php
deleted file mode 100644
index 917eaa5..0000000
--- a/balance/modules/cas-browser/scripts/widgets/BasicSearchWidget.php
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-class BasicSearchWidget
- implements Org_Apache_Oodt_Balance_Interfaces_IApplicationWidget {
-
- public function __construct($options = array()){}
-
- public function render($bEcho = true){
- $module = App::Get()->loadModule();
- $str = '';
- $str .= '<form action="' . $module->moduleRoot . '/queryScript.do" method="POST">';
- $str .= '<input type="hidden" name="Types[0]" value="*"/>';
- $str .= '<input type="hidden" name="Criteria[0][CriteriaType]" value="Term"/>';
- $str .= '<input type="hidden" name="Criteria[0][ElementName]" value="*"/>';
- $str .= '<input type="text" name ="Criteria[0][Value]"/>';
- $str .= '<input type="submit" value="Search"/>';
- $str .= '</form>';
-
- if ($bEcho) {
- echo $str;
- } else {
- return $st;
- }
- }
-}
-?>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/scripts/widgets/CrossTypeSearchWidget.php
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/scripts/widgets/CrossTypeSearchWidget.php b/balance/modules/cas-browser/scripts/widgets/CrossTypeSearchWidget.php
deleted file mode 100644
index b50de42..0000000
--- a/balance/modules/cas-browser/scripts/widgets/CrossTypeSearchWidget.php
+++ /dev/null
@@ -1,125 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-class CrossTypeSearchWidget
- implements Org_Apache_Oodt_Balance_Interfaces_IApplicationWidget {
-
- // The id of the HTMLElement that will be modified by filter results. This must be set before
- // calling renderScript().
- public $htmlID;
-
- // The ID of the HTMLElement that contains the loading icon that will be
- // displayed while getting results
- public $loadingID;
-
- // The url of the site base
- public $siteUrl;
-
- public function __construct($options = array()){
- if(isset($options['htmlID'])){
- $this->htmlID = $options['htmlID'];
- }
- if(isset($options['loadingID'])){
- $this->loadingID = $options['loadingID'];
- }
- if(isset($options['siteUrl'])){
- $this->siteUrl = $options['siteUrl'];
- }
- }
-
- public function setHtmlId($htmlID){
- $this->htmlID = $htmlID;
- }
-
- public function setSiteUrl($siteUrl){
- $this->siteUrl = $siteUrl;
- }
-
- public function render($bEcho = true){
- $str = '<div id="filter_widget_exclusive_container">';
- $str .= '<label>Exclusive:</label><input id="exclusive" type="checkbox" checked="checked" onclick="changeExclusive()"/></div>';
- $str .= '<select id="filterKey">';
- $filterKeys = Utils::getFacets();
- natcasesort($filterKeys);
- foreach($filterKeys as $label){
- $str .= '<option value="' . $label . '">' . $label . '</option>';
- }
- $str .= '</select> = ';
- $str .= '<input type="text" id="filterValue" size="18" alt="filterValue"> ';
- $str .= '<input type="button" value="Add" onclick="addFilter()" />';
- $str .= '<table id="filters"></table>';
- $str .= '';
- $str .= '<div id="permalink"></div>';
-
- if ($bEcho) {
- echo $str;
- } else {
- return $str;
- }
- }
-
- public function renderScript($bEcho = true){
- $str = '<script type="text/javascript">';
- $str .= 'var htmlID = "' . $this->htmlID . '";';
- $str .= 'var loadingID = "' . $this->loadingID . '";';
- $str .= 'var siteUrl = "'. $this->siteUrl . '";';
- $str .= 'var resultFormat = "json";';
- $str .= 'var defaultShowEverything = ' . App::Get()->settings['default_show_all'] . ';';
- $str .= 'var displayedMetadata = new Array(';
- if(isset(App::Get()->settings['browser_products_met'])){
- $metList = '';
- foreach(App::Get()->settings['browser_products_met'] as $met){
- if(strlen($metList) > 0){
- $metList .= ',';
- }
- $metList .= '"' . $met . '"';
- }
- $str .= $metList;
- }
- $str .= ');</script>';
- $str .= '<script type="text/javascript" src="' . App::Get()->request->moduleStatic . '/js/querywidget.js"></script>';
- $str .= '<script type="text/javascript" src="' . App::Get()->request->moduleStatic . '/js/crosstypesearchwidget.js"></script>';
-
- if ($bEcho) {
- echo $str;
- } else {
- return $str;
- }
- }
-
- public static function parseSegments(){
- $results = array();
- $segments = App::Get()->request->segments;
- if(isset($segments[1]) && $segments[1] != ""){
- $filterParams = array();
- for($index = 1; isset($segments[$index]) && $segments[$index] != ""; $index = $index + 2){
- array_push($filterParams, array($segments[$index], $segments[$index + 1]));
- }
- $results['filterParams'] = $filterParams;
- }
- if(isset($segments[0]) && $segments[0] != ""){
- if(intval($segments[0]) == 1){
- $results['exclusive'] = array('bool'=>'or', 'checked'=>false);
- }else{
- $results['exclusive'] = array('bool'=>'and', 'checked'=>true);
- }
- }
- return $results;
- }
-}
-?>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/scripts/widgets/CustomSearchWidget.php
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/scripts/widgets/CustomSearchWidget.php b/balance/modules/cas-browser/scripts/widgets/CustomSearchWidget.php
deleted file mode 100644
index 4102d7b..0000000
--- a/balance/modules/cas-browser/scripts/widgets/CustomSearchWidget.php
+++ /dev/null
@@ -1,178 +0,0 @@
-<?php
- /*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- * This widget is configured by the customSearchConfig array in the config file. The
- * widget expects the specifications for the criteria to search in sequence. Each
- * criteria should start with either 'term' or 'range' as an element in the config
- * array, followed by the name of the metadata element that will be searched with the
- * value given in the field corresponding to that criteria. Finally the next element
- * or two elements in the config array will be occupied by labels for the inout fields,
- * depending upon the criteria type (term or range).
- * Here is an exmaple of a config array for a term criterion and a range criterion in order:
- *
- * customSearchConfig[]=term
- * customSearchConfig[]=EUFile
- * customSearchConfig[]=EUFile
- * customSearchConfig[]=range
- * customSearchConfig[]=VideoLength
- * customSearchConfig[]=Min. Video Length
- * customSearchConfig[]=Max. Video Length
- *
- */
-class CustomSearchWidget
- implements Org_Apache_Oodt_Balance_Interfaces_IApplicationWidget {
-
- // This array will specify what criteria we use in our search, what types they are
- // and how they should be labeled.
- public $criteria;
-
- // The ProductType that the widget is filtering. This must be set before calling
- // render() or renderScript().
- public $productType;
-
- // The id of the HTMLElement that will be modified by filter results. This must be set before
- // calling renderScript().
- public $htmlID;
-
- // The url of the site base
- public $siteUrl;
-
- // Will results be returned in html or json
- public $resultFormat;
-
- public function __construct($options = array()){
-
- if(isset($options['productType'])){
- $this->productType = $options['productType'];
- }
- if(isset($options['htmlID'])){
- $this->htmlID = $options['htmlID'];
- }
- if(isset($options['siteUrl'])){
- $this->siteUrl = $options['siteUrl'];
- }
- if(isset($options['resultFormat'])){
- $this->resultFormat = $options['resultFormat'];
- }
-
- if(!isset(App::Get()->settings['customSearchConfig'])){
- echo '<div class="error">No criteria config was found for the CustomSearchWidget.</div>';
- return;
- }
- $criteriaConfig = App::Get()->settings['customSearchConfig'];
-
- // Build a representation of the criteria to be searched by the widget.
- // If, during this process, we encounter config values that don't make
- // sense or an incomplete config for a criterion, we'll simply skip to
- // the next index in the config array.
- $this->criteria = array();
- $configIndex = 0;
- while(isset($criteriaConfig[$configIndex])){
-
- $newCriterion = array();
-
- // Look for a criteria type
- $newType = strtolower($criteriaConfig[$configIndex]);
- if($newType == 'term' or $newType == 'range'){
- $newCriterion['type'] = $newType;
- $configIndex++;
- }else{
- continue; // Let's skip this one and hope that we
- // find one that makes more sense later.
- }
-
- // Extract the metadata element associated with the criterion
- $newElement = $criteriaConfig[$configIndex];
- if(isset($newElement)){
- $newCriterion['element'] = $newElement;
- $configIndex++;
- }else{
- continue; // This criterion wasn't finished.
- }
-
- // Extract the labels for the input field(s)
- $newLabel = $criteriaConfig[$configIndex];
- if(isset($newLabel)){
- if($newType == 'term'){
- $newCriterion['termLabel'] = $newLabel;
- }else{
- $newCriterion['minLabel'] = $newLabel;
- $configIndex++;
- $newLabel = $criteriaConfig[$configIndex];
- if(isset($newLabel)){
- $newCriterion['maxLabel'] = $newLabel;
- }else{
- continue; // This criterion wasn't finished.
- }
- }
- }else{
- continue; // This criterion wasn't finished.
- }
-
- array_push($this->criteria, $newCriterion);
- $configIndex++;
-
- }
- }
-
- // Using the criteria representation at this->criteria, we create the fields for
- // specifying the criteria values. We put a hidden input tag with an id of the
- // form termX or rangeX before the specification fields. The JS will find these
- // hidden tags and use them to understand whether the fields specify term or
- // range criteria. The number following the criterion type is only so that they
- // have unique IDs.
- public function render($bEcho = true){
- $str = '';
- for($i = 0; $i < count($this->criteria); $i++){
- if($this->criteria[$i]['type'] == 'term'){
- $str .= '<input id="term' . $i . '" type="hidden" value="' . $this->criteria[$i]['element'] . '">';
- $str .= $this->criteria[$i]['termLabel'] . ': <input type="text" size="18" id="inputTerm' . $i . '"><br/>';
- }else{
- $str .= '<input id="range' . $i . '" type="hidden" value="' . $this->criteria[$i]['element'] . '">';
- $str .= $this->criteria[$i]['minLabel'] . ': <input type="text" size="18" id="inputRangeMin' . $i . '">';
- $str .= ' ';
- $str .= $this->criteria[$i]['maxLabel'] . ': <input type="text" size="18" id="inputRangeMax' . $i . '"><br/>';
- }
- }
- $str .= '<input type="button" value="Search" onclick="customQuery()" />';
-
- if ($bEcho) {
- echo $str;
- } else {
- return $str;
- }
- }
-
- public function renderScript($bEcho = true){
- $module = App::Get()->loadModule();
- $str = '';
- $str .= '<script type="text/javascript">var htmlID = "' . $this->htmlID . '";</script>';
- $str .= '<script type="text/javascript">var ptName = "' . $this->productType->getName() . '";</script>';
- $str .= '<script type="text/javascript">var siteUrl = "' . $this->siteUrl . '";</script>';
- $str .= '<script type="text/javascript">var resultFormat = "' . $this->resultFormat . '";</script>';
- $str .= '<script type="text/javascript" src="' . $module->moduleStatic . '/js/querywidget.js"></script>';
- $str .= '<script type="text/javascript" src="' . $module->moduleStatic . '/js/customsearchwidget.js"></script>';
-
- if ($bEcho) {
- echo $str;
- } else {
- return $str;
- }
- }
-}
-?>
[28/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/WorkflowManagerDataSourceIndex.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/WorkflowManagerDataSourceIndex.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/WorkflowManagerDataSourceIndex.java
deleted file mode 100644
index cc329dc..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/WorkflowManagerDataSourceIndex.java
+++ /dev/null
@@ -1,323 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.struct.impl.index;
-
-//JDK imports
-
-import org.apache.oodt.cas.catalog.exception.CatalogIndexException;
-import org.apache.oodt.cas.catalog.exception.QueryServiceException;
-import org.apache.oodt.cas.catalog.page.IndexPager;
-import org.apache.oodt.cas.catalog.page.IngestReceipt;
-import org.apache.oodt.cas.catalog.query.ComparisonQueryExpression;
-import org.apache.oodt.cas.catalog.query.NotQueryExpression;
-import org.apache.oodt.cas.catalog.query.QueryExpression;
-import org.apache.oodt.cas.catalog.query.QueryLogicalGroup;
-import org.apache.oodt.cas.catalog.query.StdQueryExpression;
-import org.apache.oodt.cas.catalog.struct.Index;
-import org.apache.oodt.cas.catalog.struct.QueryService;
-import org.apache.oodt.cas.catalog.struct.TransactionId;
-import org.apache.oodt.cas.catalog.struct.TransactionIdFactory;
-import org.apache.oodt.cas.catalog.struct.impl.transaction.LongTransactionIdFactory;
-import org.apache.oodt.cas.catalog.term.Term;
-import org.apache.oodt.cas.catalog.term.TermBucket;
-import org.apache.oodt.commons.database.DatabaseConnectionBuilder;
-import org.apache.oodt.commons.util.DateConvert;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import java.net.URLEncoder;
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.Statement;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Vector;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.sql.DataSource;
-
-//SQL imports
-//OODT imports
-//EDA imports
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A queriable index for querying for original cas-workflow instance metadata (not for cas-workflow2)
- * <p>
- */
-public class WorkflowManagerDataSourceIndex implements Index, QueryService {
-
- private static final Logger LOG = Logger.getLogger(WorkflowManagerDataSourceIndex.class.getName());
-
- protected DataSource dataSource;
-
- public WorkflowManagerDataSourceIndex(String user, String pass, String driver, String jdbcUrl) {
- this.dataSource = DatabaseConnectionBuilder.buildDataSource(user, pass, driver, jdbcUrl);
- }
-
- public List<TransactionId<?>> getPage(IndexPager indexPage) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Properties getProperties() {
- return new Properties();
- }
-
- public String getProperty(String key) {
- return null;
- }
-
- public TransactionIdFactory getTransactionIdFactory() {
- return new LongTransactionIdFactory();
- }
-
- public boolean hasTransactionId(TransactionId<?> transactionId)
- throws CatalogIndexException {
- Connection conn = null;
- Statement stmt = null;
- ResultSet rs = null;
- try {
- conn = this.dataSource.getConnection();
- stmt = conn.createStatement();
- rs = stmt.executeQuery("SELECT DISTINCT workflow_instance_id FROM workflow_instance_metadata WHERE workflow_instance_id = '" + transactionId + "'");
- return rs.next();
- }catch (Exception e) {
- throw new CatalogIndexException("Failed to check for workflow id '" + transactionId + "' : " + e.getMessage(), e);
- }finally {
- try {
- conn.close();
- }catch(Exception ignored) {}
- try {
- stmt.close();
- }catch(Exception ignored) {}
- try {
- rs.close();
- }catch(Exception ignored) {}
- }
- }
-
- public List<TermBucket> getBuckets(TransactionId<?> transactionId)
- throws QueryServiceException {
- Connection conn = null;
- Statement stmt = null;
- ResultSet rs = null;
- try {
- conn = this.dataSource.getConnection();
- stmt = conn.createStatement();
- rs = stmt.executeQuery("SELECT * FROM workflow_instance_metadata WHERE workflow_instance_id = '" + transactionId + "'");
-
- TermBucket tb = new TermBucket("Workflows");
- while (rs.next()) {
- String key = rs.getString("workflow_met_key");
- String value = URLDecoder.decode(rs.getString("workflow_met_val"), "UTF-8");
- tb.addTerm(new Term(key, Collections.singletonList(value)));
- }
- return Collections.singletonList(tb);
- }catch (Exception e) {
- throw new QueryServiceException("Failed to get Workflow Instance Metadata for workflow id '" + transactionId + "' : " + e.getMessage(), e);
- }finally {
- try {
- conn.close();
- }catch(Exception ignored) {}
- try {
- stmt.close();
- }catch(Exception ignored) {}
- try {
- rs.close();
- }catch(Exception ignored) {}
- }
- }
-
- public Map<TransactionId<?>, List<TermBucket>> getBuckets(
- List<TransactionId<?>> transactionIds) throws QueryServiceException {
- Map<TransactionId<?>, List<TermBucket>> returnMap = new ConcurrentHashMap<TransactionId<?>, List<TermBucket>>();
- for (TransactionId<?> transactionId : transactionIds) {
- returnMap.put(transactionId, this.getBuckets(transactionId));
- }
- return returnMap;
- }
-
- public List<IngestReceipt> query(QueryExpression queryExpression)
- throws QueryServiceException {
- Connection conn = null;
- Statement stmt = null;
- ResultSet rs = null;
- try {
- conn = this.dataSource.getConnection();
- stmt = conn.createStatement();
- String sqlQuery = "SELECT workflow_instance_id,start_date_time FROM workflow_instances WHERE workflow_instance_id IN (" + this.getSqlQuery(queryExpression) + ")";
- LOG.log(Level.INFO, "Performing Query: " + sqlQuery);
- rs = stmt.executeQuery(sqlQuery);
-
- List<IngestReceipt> receipts = new Vector<IngestReceipt>();
- while (rs.next()) {
- receipts.add(new IngestReceipt(
- new LongTransactionIdFactory().createTransactionId(rs.getString("workflow_instance_id")),
- DateConvert.isoParse(rs.getString("start_date_time"))));
- }
- return receipts;
- }catch (Exception e) {
- throw new QueryServiceException("Failed to query Workflow Instances Database : " + e.getMessage(), e);
- }finally {
- try {
- conn.close();
- }catch(Exception ignored) {}
- try {
- stmt.close();
- }catch(Exception ignored) {}
- try {
- rs.close();
- }catch(Exception ignored) {}
- }
- }
-
- public List<IngestReceipt> query(QueryExpression queryExpression, int startIndex, int endIndex) throws QueryServiceException {
- Connection conn = null;
- Statement stmt = null;
- ResultSet rs = null;
- try {
- conn = this.dataSource.getConnection();
- stmt = conn.createStatement();
- String sqlQuery = "SELECT workflow_instance_id,start_date_time FROM workflow_instances WHERE workflow_instance_id IN (" + this.getSqlQuery(queryExpression) + ")";
- LOG.log(Level.INFO, "Performing Query: " + sqlQuery);
- rs = stmt.executeQuery(sqlQuery);
-
- List<IngestReceipt> receipts = new Vector<IngestReceipt>();
- int index = 0;
- while (startIndex > index && rs.next()) {
- index++;
- }
- while (rs.next() && index++ <= endIndex) {
- receipts.add(new IngestReceipt(
- new LongTransactionIdFactory().createTransactionId(rs.getString("workflow_instance_id")),
- DateConvert.isoParse(rs.getString("start_date_time"))));
- }
- return receipts;
- }catch (Exception e) {
- throw new QueryServiceException("Failed to query Workflow Instances Database : " + e.getMessage(), e);
- }finally {
- try {
- conn.close();
- }catch(Exception ignored) {}
- try {
- stmt.close();
- }catch(Exception ignored) {}
- try {
- rs.close();
- }catch(Exception ignored) {}
- }
- }
-
- public int sizeOf(QueryExpression queryExpression)
- throws QueryServiceException {
- Connection conn = null;
- Statement stmt = null;
- ResultSet rs = null;
- try {
- conn = this.dataSource.getConnection();
- stmt = conn.createStatement();
- String sqlQuery = "SELECT COUNT(workflow_instance_id) AS numInstances FROM workflow_instances WHERE workflow_instance_id IN (" + this.getSqlQuery(queryExpression) + ")";
- LOG.log(Level.INFO, "Performing Query: " + sqlQuery);
- rs = stmt.executeQuery(sqlQuery);
-
- int numInstances = 0;
- while (rs.next()) {
- numInstances = rs.getInt("numInstances");
- }
-
- return numInstances;
- } catch (Exception e) {
- throw new QueryServiceException(
- "Failed to get size of query in Workflow Instances Database : "
- + e.getMessage(), e);
- } finally {
- try {
- conn.close();
- } catch (Exception ignored) {
- }
- try {
- stmt.close();
- } catch (Exception ignored) {
- }
- try {
- rs.close();
- } catch (Exception ignored) {
- }
- }
- }
-
- private String getSqlQuery(QueryExpression queryExpression) throws QueryServiceException, UnsupportedEncodingException {
- StringBuilder sqlQuery = new StringBuilder();
- if (queryExpression instanceof QueryLogicalGroup) {
- QueryLogicalGroup qlg = (QueryLogicalGroup) queryExpression;
- sqlQuery.append("(").append(this.getSqlQuery(qlg.getExpressions().get(0)));
- String op = qlg.getOperator() == QueryLogicalGroup.Operator.AND ? "INTERSECT" : "UNION";
- for (int i = 1; i < qlg.getExpressions().size(); i++) {
- sqlQuery.append(") ").append(op).append(" (").append(this.getSqlQuery(qlg.getExpressions().get(i)));
- }
- sqlQuery.append(")");
- }else if (queryExpression instanceof ComparisonQueryExpression){
- ComparisonQueryExpression cqe = (ComparisonQueryExpression) queryExpression;
- String operator;
- if (cqe.getOperator().equals(ComparisonQueryExpression.Operator.EQUAL_TO)) {
- operator = "=";
- } else if (cqe.getOperator().equals(ComparisonQueryExpression.Operator.GREATER_THAN)) {
- operator = ">";
- } else if (cqe.getOperator().equals(ComparisonQueryExpression.Operator.GREATER_THAN_EQUAL_TO)) {
- operator = ">=";
- } else if (cqe.getOperator().equals(ComparisonQueryExpression.Operator.LESS_THAN)) {
- operator = "<";
- } else if (cqe.getOperator().equals(ComparisonQueryExpression.Operator.LESS_THAN_EQUAL_TO)) {
- operator = "<=";
- } else {
- throw new QueryServiceException("Invalid ComparisonQueryExpression Operator '" + cqe.getOperator() + "'");
- }
-
- sqlQuery.append(
- "SELECT DISTINCT workflow_instance_id FROM workflow_instance_metadata WHERE " + "workflow_met_key = '")
- .append(cqe.getTerm().getName()).append("' AND (");
- for (int i = 0; i < cqe.getTerm().getValues().size(); i++) {
- String value = cqe.getTerm().getValues().get(i);
- sqlQuery.append("workflow_met_val ").append(operator).append(" '")
- .append(URLEncoder.encode(value, "UTF-8")).append("'");
- if ((i + 1) < cqe.getTerm().getValues().size()) {
- sqlQuery.append("OR");
- }
- }
- sqlQuery.append(")");
- }else if (queryExpression instanceof NotQueryExpression) {
- NotQueryExpression nqe = (NotQueryExpression) queryExpression;
- sqlQuery.append("SELECT DISTINCT workflow_instance_id FROM workflow_instance_metadata WHERE NOT (")
- .append(this
- .getSqlQuery(nqe.getQueryExpression())).append(")");
- }else if (queryExpression instanceof StdQueryExpression) {
- sqlQuery.append("SELECT DISTINCT workflow_instance_id FROM workflow_instance_metadata");
- }else {
- throw new QueryServiceException("Invalid QueryExpression '" + queryExpression.getClass().getCanonicalName() + "'");
- }
- return sqlQuery.toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/WorkflowManagerDataSourceIndexFactory.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/WorkflowManagerDataSourceIndexFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/WorkflowManagerDataSourceIndexFactory.java
deleted file mode 100644
index b7abe3c..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/WorkflowManagerDataSourceIndexFactory.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.struct.impl.index;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.struct.IndexFactory;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- */
-public class WorkflowManagerDataSourceIndexFactory implements IndexFactory {
-
- protected String jdbcUrl;
- protected String user;
- protected String pass;
- protected String driver;
-
- public WorkflowManagerDataSourceIndex createIndex() {
- try {
- return new WorkflowManagerDataSourceIndex(this.user, this.pass, this.driver, this.jdbcUrl);
- }catch (Exception e) {
- //log
- return null;
- }
- }
-
- public void setJdbcUrl(String jdbcUrl) {
- this.jdbcUrl = jdbcUrl;
- }
-
- public void setUser(String user) {
- this.user = user;
- }
-
- public void setPass(String pass) {
- this.pass = pass;
- }
-
- public void setDriver(String driver) {
- this.driver = driver;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/transaction/LongTransactionIdFactory.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/transaction/LongTransactionIdFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/transaction/LongTransactionIdFactory.java
deleted file mode 100644
index 1d8a573..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/transaction/LongTransactionIdFactory.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.struct.impl.transaction;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.struct.TransactionId;
-import org.apache.oodt.cas.catalog.struct.TransactionIdFactory;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- */
-public class LongTransactionIdFactory implements TransactionIdFactory {
-
- public TransactionId<?> createNewTransactionId() {
- return new TransactionId<Long>(System.currentTimeMillis()) {
-
- @Override
- protected Long fromString(String stringId) {
- return Long.parseLong(stringId);
- }
-
- };
- }
-
- public TransactionId<?> createTransactionId(String transactionIdString) {
- return new TransactionId<Long>(transactionIdString) {
-
- @Override
- protected Long fromString(String stringId) {
- return Long.parseLong(stringId);
- }
-
- };
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/transaction/StringTransactionIdFactory.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/transaction/StringTransactionIdFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/transaction/StringTransactionIdFactory.java
deleted file mode 100644
index 8e1bc18..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/transaction/StringTransactionIdFactory.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.struct.impl.transaction;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.struct.TransactionId;
-import org.apache.oodt.cas.catalog.struct.TransactionIdFactory;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- */
-public class StringTransactionIdFactory implements TransactionIdFactory {
-
- public TransactionId<String> createNewTransactionId() {
- return new StringTransactionId(Long.toString(System.currentTimeMillis()));
- }
-
- public TransactionId<?> createTransactionId(String transactionIdString) {
- return new StringTransactionId(transactionIdString);
- }
-
- private class StringTransactionId extends TransactionId<String> {
-
- public StringTransactionId(String stringValue) {
- this.nativeId = stringValue;
- }
-
- @Override
- protected String fromString(String stringId) {
- return stringId;
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/transaction/UuidTransactionIdFactory.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/transaction/UuidTransactionIdFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/transaction/UuidTransactionIdFactory.java
deleted file mode 100644
index 96aeda8..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/transaction/UuidTransactionIdFactory.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.struct.impl.transaction;
-
-//JDK imports
-import java.util.UUID;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.struct.TransactionId;
-import org.apache.oodt.cas.catalog.struct.TransactionIdFactory;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- */
-public class UuidTransactionIdFactory implements TransactionIdFactory {
-
- public TransactionId<?> createNewTransactionId() {
- return new TransactionId<UUID>(UUID.randomUUID()) {
-
- @Override
- protected UUID fromString(String stringId) {
- return UUID.fromString(stringId);
- }
-
- };
- }
-
- public TransactionId<?> createTransactionId(String transactionIdString) {
- return new TransactionId<UUID>(transactionIdString) {
-
- @Override
- protected UUID fromString(String stringId) {
- return UUID.fromString(stringId);
- }
-
- };
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/system/Catalog.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/system/Catalog.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/system/Catalog.java
deleted file mode 100644
index c292672..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/system/Catalog.java
+++ /dev/null
@@ -1,399 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.system;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.exception.CatalogException;
-import org.apache.oodt.cas.catalog.exception.CatalogIndexException;
-import org.apache.oodt.cas.catalog.page.CatalogReceipt;
-import org.apache.oodt.cas.catalog.page.IndexPager;
-import org.apache.oodt.cas.catalog.page.IngestReceipt;
-import org.apache.oodt.cas.catalog.query.QueryExpression;
-import org.apache.oodt.cas.catalog.struct.Dictionary;
-import org.apache.oodt.cas.catalog.struct.Index;
-import org.apache.oodt.cas.catalog.struct.IngestService;
-import org.apache.oodt.cas.catalog.struct.QueryService;
-import org.apache.oodt.cas.catalog.struct.TransactionId;
-import org.apache.oodt.cas.catalog.struct.TransactionIdFactory;
-import org.apache.oodt.cas.catalog.term.Term;
-import org.apache.oodt.cas.catalog.term.TermBucket;
-import org.apache.oodt.cas.metadata.Metadata;
-
-import java.util.Collections;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Vector;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-//JDK imports
-
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A Calatog is a communication interface between the CatalogService and an underlying
- * database or index service
- * <p>
- */
-public class Catalog {
-
- private static Logger LOG = Logger.getLogger(Catalog.class.getName());
-
- protected Vector<Dictionary> dictionaries;
- protected Index index;
- protected String id;
- protected boolean restrictQueryPermissions = true;
- protected boolean restrictIngestPermissions = true;
-
- public Catalog(String id, Index index, List<Dictionary> dictionaries, boolean restrictQueryPermissions, boolean restrictIngestPermissions) {
- this.id = id;
- this.index = index;
- if (dictionaries != null) {
- this.dictionaries = new Vector<Dictionary>(dictionaries);
- }
- this.restrictQueryPermissions = restrictQueryPermissions;
- this.restrictIngestPermissions = restrictIngestPermissions;
- }
-
- public String getId() {
- return this.id;
- }
-
- public TransactionIdFactory getTransactionIdFactory() {
- return this.index.getTransactionIdFactory();
- }
-
- public void setIndex(Index index) {
- this.index = index;
- }
-
- public void setDictionaries(List<Dictionary> dictionaries) {
- this.dictionaries = new Vector<Dictionary>(dictionaries);
- }
-
- public List<Dictionary> getDictionaries() {
- return Collections.unmodifiableList(this.dictionaries);
- }
-
- public void addDictionary(Dictionary dictionary) {
- if (this.dictionaries == null) {
- this.dictionaries = new Vector<Dictionary>();
- }
- this.dictionaries.add(dictionary);
- }
-
- public void setRestrictQueryPermissions(boolean restrictQueryPermissions) {
- this.restrictQueryPermissions = restrictQueryPermissions;
- }
-
- public void setRestrictIngestPermissions(boolean restrictIngestPermissions) {
- this.restrictIngestPermissions = restrictIngestPermissions;
- }
-
- public boolean isQueriable() {
- return this.index instanceof QueryService && !this.restrictQueryPermissions;
- }
-
- public boolean isIngestable() {
- return this.index instanceof IngestService && !this.restrictIngestPermissions;
- }
-
- public List<TransactionId<?>> getPage(IndexPager indexPage) {
- return this.index.getPage(indexPage);
- }
-
- public TransactionId<?> getTransactionIdFromString(String catalogTransactionId) throws IllegalArgumentException, SecurityException,
- CatalogIndexException {
- return this.getTransactionIdFactory().createTransactionId(catalogTransactionId);
- }
-
- public boolean hasTransactionId(TransactionId<?> catalogTransactionid) throws CatalogIndexException {
- return this.index.hasTransactionId(catalogTransactionid);
- }
-
- public String getProperty(String key) throws CatalogException {
- try {
- return this.index.getProperty(key);
- }catch (Exception e) {
- throw new CatalogException("Failed to get property '" + key + "' : " + e.getMessage(), e);
- }
- }
-
- public Properties getProperties() throws CatalogException {
- try {
- return this.index.getProperties();
- }catch (Exception e) {
- throw new CatalogException("Failed to get properties : " + e.getMessage(), e);
- }
- }
-
- /**
- *
- * @param metadata
- * @return TransactionId param if used by underlying catalog, otherwise
- * the TransactionId generated and used by underlying catalog. if no
- * TermBuckets where created from the Metadata then null is returned
- * @throws CatalogException
- */
- public CatalogReceipt ingest(Metadata metadata) throws CatalogException {
- try {
- if (this.isIngestable()) {
- List<TermBucket> termBuckets = this.getTermBuckets(metadata);
- if (termBuckets.size() > 0) {
- LOG.log(Level.INFO, "Catalog '" + this + "' attemping ingest metadata");
- return new CatalogReceipt(((IngestService) this.index).ingest(termBuckets), this.getId());
- }else {
- LOG.log(Level.WARNING, "Catalog '" + this + "' dictionaries did not generate any TermBuckets from Metadata");
- return null;
- }
- }else {
- LOG.log(Level.WARNING, "Catalog '" + this + "' is not ingestable");
- return null;
- }
- }catch (Exception e) {
- throw new CatalogException(e.getMessage(), e);
- }
- }
-
- public CatalogReceipt update(TransactionId<?> transactionId, Metadata metadata) throws CatalogException {
- try {
- if (this.isIngestable()) {
- List<TermBucket> termBuckets = this.getTermBuckets(metadata);
- if (termBuckets.size() > 0) {
- LOG.log(Level.INFO, "Catalog '" + this + "' attemping update metadata for catalog TransactionId [id = '" + transactionId + "']");
- IngestReceipt ingestReceipt = ((IngestService) this.index).update(transactionId, termBuckets);
- if (ingestReceipt != null) {
- return new CatalogReceipt(ingestReceipt, this.getId());
- } else {
- return null;
- }
- }else {
- LOG.log(Level.WARNING, "Catalog '" + this + "' did not generate any TermBuckets from Metadata for catalog TransactionId [id = '" + transactionId + "']");
- return null;
- }
- }else {
- LOG.log(Level.WARNING, "Catalog '" + this + "' is not ingestable");
- return null;
- }
- }catch (Exception e) {
- throw new CatalogException(e.getMessage(), e);
- }
- }
-
- public boolean delete(TransactionId<?> transactionId) throws CatalogException {
- try {
- if (this.isIngestable()) {
- LOG.log(Level.INFO, "Catalog '" + this + "' attemping to delete all TermBuckets associated with catalog TransactionId [id = '" + transactionId + "']");
- return ((IngestService) this.index).delete(transactionId);
- }else {
- LOG.log(Level.WARNING, "Catalog '" + this + "' is not ingestable");
- return false;
- }
- }catch (Exception e) {
- throw new CatalogException(e.getMessage(), e);
- }
- }
-
- public boolean reduce(TransactionId<?> transactionId, Metadata metadata) throws CatalogException {
- try {
- if (this.isIngestable()) {
- List<TermBucket> termBuckets = this.getTermBuckets(metadata);
- if (termBuckets.size() > 0) {
- LOG.log(Level.INFO, "Catalog '" + this + "' attemping reduce metadata for catalog TransactionId [id = '" + transactionId + "']");
- return ((IngestService) this.index).reduce(transactionId, termBuckets);
- }else {
- LOG.log(Level.WARNING, "Catalog '" + this + "' did not generate any TermBuckets from Metadata for catalog TransactionId [id = '" + transactionId + "'] -- no metadata reduction took place");
- return false;
- }
- }else {
- LOG.log(Level.WARNING, "Catalog '" + this + "' is not ingestable");
- return false;
- }
- }catch(Exception e) {
- throw new CatalogException(e.getMessage(), e);
- }
- }
-
- public List<CatalogReceipt> query(QueryExpression queryExpression) throws CatalogException {
- try {
- if (this.isQueriable()) {
- QueryService queryService = (QueryService) this.index;
- List<CatalogReceipt> catalogReceipts = new Vector<CatalogReceipt>();
- for (IngestReceipt ingestReceipt : queryService.query(queryExpression)) {
- catalogReceipts.add(new CatalogReceipt(ingestReceipt, this.getId()));
- }
- return Collections.unmodifiableList(catalogReceipts);
- }else {
- LOG.log(Level.WARNING, "Catalog '" + this + "' is not queriable");
- return Collections.emptyList();
- }
- }catch (Exception e) {
- throw new CatalogException(e.getMessage(), e);
- }
- }
-
-
- public List<CatalogReceipt> query(QueryExpression queryExpression, int startIndex, int endIndex) throws CatalogException {
- try {
- if (this.isQueriable()) {
- QueryService queryService = (QueryService) this.index;
- List<CatalogReceipt> catalogReceipts = new Vector<CatalogReceipt>();
- for (IngestReceipt ingestReceipt : queryService.query(queryExpression, startIndex, endIndex)) {
- catalogReceipts.add(new CatalogReceipt(ingestReceipt, this.getId()));
- }
- return Collections.unmodifiableList(catalogReceipts);
- }else {
- LOG.log(Level.WARNING, "Catalog '" + this + "' is not queriable");
- return Collections.emptyList();
- }
- }catch (Exception e) {
- throw new CatalogException(e.getMessage(), e);
- }
- }
-
- public int sizeOf(QueryExpression queryExpression) throws CatalogException {
- try {
- if (this.isQueriable()) {
- QueryService queryService = (QueryService) this.index;
- return queryService.sizeOf(queryExpression);
- }else {
- LOG.log(Level.WARNING, "Catalog '" + this + "' is not queriable");
- return 0;
- }
- }catch (Exception e) {
- throw new CatalogException(e.getMessage(), e);
- }
- }
-
- public Metadata getMetadata(TransactionId<?> transactionId) throws CatalogException {
- try {
- if (this.isQueriable()) {
- QueryService queryService = (QueryService) this.index;
- return this.getMetadataFromBuckets(queryService.getBuckets(transactionId));
- }else {
- LOG.log(Level.WARNING, "Catalog '" + this + "' is not queriable");
- return new Metadata();
- }
- }catch(Exception e) {
- throw new CatalogException(e.getMessage(), e);
- }
- }
-
- public Map<TransactionId<?>, Metadata> getMetadata(List<TransactionId<?>> transactionIds) throws CatalogException {
- try {
- Map<TransactionId<?>, Metadata> metadataMap = new ConcurrentHashMap<TransactionId<?>, Metadata>();
- if (this.isQueriable()) {
- QueryService queryService = (QueryService) this.index;
- Map<TransactionId<?>, List<TermBucket>> termBucketMap = queryService.getBuckets(transactionIds);
-
- for(Map.Entry<TransactionId<?>, List<TermBucket>> entry : termBucketMap.entrySet()){
- metadataMap.put(entry.getKey(), this.getMetadataFromBuckets(entry.getValue()));
- }
- }else {
- LOG.log(Level.WARNING, "Catalog '" + this + "' is not queriable");
- }
- return metadataMap;
- }catch(Exception e) {
- throw new CatalogException(e.getMessage(), e);
- }
- }
-
- public boolean isInterested(QueryExpression queryExpression) throws CatalogException {
- try {
- if (this.dictionaries != null) {
- for (Dictionary dictionary : this.dictionaries) {
- if (dictionary.understands(queryExpression)) {
- return true;
- }
- }
- return false;
- }else {
- return true;
- }
- }catch(Exception e) {
- throw new CatalogException(e.getMessage(), e);
- }
- }
-
- protected Metadata getMetadataFromBuckets(List<TermBucket> termBuckets) {
- Metadata metadata = new Metadata();
- for (TermBucket termBucket : termBuckets) {
- if (this.dictionaries != null) {
- for (Dictionary dictionary : this.dictionaries) {
- metadata.addMetadata(dictionary.reverseLookup(termBucket));
- }
- }else {
- metadata.addMetadata(this.asMetadata(termBuckets));
- }
- }
- return metadata;
- }
-
- protected Metadata asMetadata(List<TermBucket> termBuckets) {
- Metadata m = new Metadata();
- for (TermBucket bucket : termBuckets) {
- for (Term term : bucket.getTerms()) {
- m.addMetadata(term.getName(), term.getValues());
- }
- }
- return m;
- }
-
- protected List<TermBucket> getTermBuckets(Metadata metadata) {
- List<TermBucket> termBuckets = new Vector<TermBucket>();
- if (this.dictionaries != null) {
- for (Dictionary dictionary : this.dictionaries) {
- TermBucket termBucket = dictionary.lookup(metadata);
- if (termBucket != null) {
- termBuckets.add(termBucket);
- }
- }
- }else {
- LOG.log(Level.WARNING, "Catalog '" + this + "' has no dictionaries defined, attempting to send all Metadata in a default TermBucket");
- TermBucket bucket = new TermBucket();
- for (String key : metadata.getAllKeys()) {
- bucket.addTerm(new Term(key, metadata.getAllMetadata(key)));
- }
- termBuckets.add(bucket);
- }
- return termBuckets;
- }
-
- public int hashCode() {
- return this.toString().hashCode();
- }
-
- public boolean equals(Object obj) {
- if (obj instanceof Catalog) {
- return ((Catalog) obj).getId().equals(this.getId());
- } else if (obj instanceof String) {
- return this.getId().equals((String) obj);
- } else {
- return false;
- }
- }
-
- public String toString() {
- return this.getId();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/system/CatalogFactory.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/system/CatalogFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/system/CatalogFactory.java
deleted file mode 100644
index f540239..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/system/CatalogFactory.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.system;
-
-//JDK imports
-import java.util.List;
-import java.util.Vector;
-
-//OOD imports
-import org.apache.oodt.cas.catalog.struct.Dictionary;
-import org.apache.oodt.cas.catalog.struct.DictionaryFactory;
-import org.apache.oodt.cas.catalog.struct.IndexFactory;
-
-//Spring imports
-import org.springframework.beans.factory.annotation.Required;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- */
-public class CatalogFactory {
-
- protected String catalogId;
- protected IndexFactory indexFactory;
- protected List<DictionaryFactory> dictionaryFactories;
- protected boolean restrictQueryPermissions;
- protected boolean restrictIngestPermissions;
-
- public Catalog createCatalog() {
- Vector<Dictionary> dictionaries = null;
- if (this.dictionaryFactories != null) {
- dictionaries = new Vector<Dictionary>();
- for (DictionaryFactory dictionaryFactory : this.dictionaryFactories) {
- dictionaries.add(dictionaryFactory.createDictionary());
- }
- }
- return new Catalog(this.catalogId, this.indexFactory.createIndex(), dictionaries, this.restrictQueryPermissions, this.restrictIngestPermissions);
- }
-
- @Required
- public void setCatalogId(String catalogId) {
- this.catalogId = catalogId;
- }
-
- @Required
- public void setIndexFactory(IndexFactory indexFactory) {
- this.indexFactory = indexFactory;
- }
-
- @Required
- public void setDictionaryFactories(List<DictionaryFactory> dictionaryFactories) {
- this.dictionaryFactories = dictionaryFactories;
- }
-
- @Required
- public void setRestrictQueryPermissions(boolean restrictQueryPermissions) {
- this.restrictQueryPermissions = restrictQueryPermissions;
- }
-
- @Required
- public void setRestrictIngestPermissions(boolean restrictIngestPermissions) {
- this.restrictIngestPermissions = restrictIngestPermissions;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/system/CatalogService.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/system/CatalogService.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/system/CatalogService.java
deleted file mode 100644
index 28d8ebb..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/system/CatalogService.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.system;
-
-//JDK imports
-import java.net.URL;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.exception.CatalogServiceException;
-import org.apache.oodt.cas.catalog.metadata.TransactionalMetadata;
-import org.apache.oodt.cas.catalog.page.CatalogReceipt;
-import org.apache.oodt.cas.catalog.page.Page;
-import org.apache.oodt.cas.catalog.page.PageInfo;
-import org.apache.oodt.cas.catalog.page.QueryPager;
-import org.apache.oodt.cas.catalog.page.TransactionReceipt;
-import org.apache.oodt.cas.catalog.query.QueryExpression;
-import org.apache.oodt.cas.catalog.struct.Dictionary;
-import org.apache.oodt.cas.catalog.struct.Index;
-import org.apache.oodt.cas.catalog.struct.TransactionId;
-import org.apache.oodt.cas.catalog.util.PluginURL;
-import org.apache.oodt.cas.metadata.Metadata;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * An interface for a Metadata Catalog Manager Service
- * <p>
- */
-public interface CatalogService {
-
- String CATALOG_SERVICE_TRANSACTION_ID_MET_KEY = "urn:CatalogService:TransactionId";
- String CATALOG_IDS_MET_KEY = "urn:CatalogService:CatalogIds";
- String ENABLE_UPDATE_MET_KEY = "urn:CatalogService:EnableUpdate";
- String CATALOG_TRANSACTION_ID_MET_KEY = "urn:Catalog:TransactionId";
- String CATALOG_ID_MET_KEY = "urn:Catalog:Id";
-
- void shutdown() throws CatalogServiceException;
-
- boolean isRestrictQueryPermissions() throws CatalogServiceException;
-
- boolean isRestrictIngestPermissions() throws CatalogServiceException;
-
- void addCatalog(Catalog catalog) throws CatalogServiceException;
-
- void replaceCatalog(Catalog catalog) throws CatalogServiceException;
-
- void addCatalog(String catalogId, Index index) throws CatalogServiceException;
-
- void addCatalog(String catalogId, Index index, List<Dictionary> dictionaries) throws CatalogServiceException;
-
- void addCatalog(String catalogId, Index index, List<Dictionary> dictionaries, boolean restrictQueryPermission,
- boolean restrictIngestPermission) throws CatalogServiceException;
-
- void addDictionary(String catalogId, Dictionary dictionary) throws CatalogServiceException;
-
- void replaceDictionaries(String catalogId, List<Dictionary> dictionaries) throws CatalogServiceException;
-
- void replaceIndex(String catalogId, Index index) throws CatalogServiceException;
-
- void modifyIngestPermission(String catalogId, boolean restrictIngestPermission) throws CatalogServiceException;
-
- void modifyQueryPermission(String catalogId, boolean restrictQueryPermission) throws CatalogServiceException;
-
- void removeCatalog(String catalogId) throws CatalogServiceException;
-
- URL getPluginStorageDir() throws CatalogServiceException;
-
- List<PluginURL> getPluginUrls() throws CatalogServiceException;
-
- void addPluginUrls(List<PluginURL> pluginURLs) throws CatalogServiceException;
-
- Set<String> getCurrentCatalogIds() throws CatalogServiceException;
-
- TransactionReceipt ingest(Metadata metadata) throws CatalogServiceException;
-
- void delete(Metadata metadata) throws CatalogServiceException;
-
- List<String> getProperty(String key) throws CatalogServiceException;
-
- Properties getCalalogProperties() throws CatalogServiceException;
-
- Properties getCalalogProperties(String catalogUrn) throws CatalogServiceException;
-
- Page getNextPage(Page page) throws CatalogServiceException;
-
- Page getPage(PageInfo pageInfo, QueryExpression queryExpression) throws CatalogServiceException;
-
- Page getPage(PageInfo pageInfo, QueryExpression queryExpression, Set<String> catalogIds) throws CatalogServiceException;
-
- List<TransactionalMetadata> getMetadata(Page page) throws CatalogServiceException;
-
- QueryPager query(QueryExpression queryExpression) throws CatalogServiceException;
-
- QueryPager query(QueryExpression queryExpression, Set<String> catalogIds) throws CatalogServiceException;
-
- List<TransactionalMetadata> getNextPage(QueryPager queryPager) throws CatalogServiceException;
-
- List<TransactionalMetadata> getAllPages(QueryPager queryPager) throws CatalogServiceException;
-
- List<TransactionalMetadata> getMetadataFromTransactionIdStrings(List<String> catalogServiceTransactionIdStrings) throws CatalogServiceException;
-
- List<TransactionalMetadata> getMetadataFromTransactionIds(List<TransactionId<?>> catalogServiceTransactionIds) throws CatalogServiceException;
-
- List<TransactionId<?>> getCatalogServiceTransactionIds(List<TransactionId<?>> catalogTransactionIds,
- String catalogUrn) throws CatalogServiceException;
-
- TransactionId<?> getCatalogServiceTransactionId(TransactionId<?> catalogTransactionId, String catalogUrn) throws CatalogServiceException;
-
- TransactionId<?> getCatalogServiceTransactionId(CatalogReceipt catalogReceipt, boolean generateNew) throws CatalogServiceException;
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/system/CatalogServiceFactory.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/system/CatalogServiceFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/system/CatalogServiceFactory.java
deleted file mode 100644
index 360e098..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/system/CatalogServiceFactory.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.system;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A Factory for CatalogService
- * <p>
- */
-public interface CatalogServiceFactory {
-
- CatalogService createCatalogService();
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceClient.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceClient.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceClient.java
deleted file mode 100644
index 623d8b0..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceClient.java
+++ /dev/null
@@ -1,407 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.system.impl;
-
-//JDK imports
-import java.io.File;
-import java.net.URL;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-import java.util.Vector;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.exception.CatalogServiceException;
-import org.apache.oodt.cas.catalog.metadata.TransactionalMetadata;
-import org.apache.oodt.cas.catalog.page.CatalogReceipt;
-import org.apache.oodt.cas.catalog.page.Page;
-import org.apache.oodt.cas.catalog.page.PageInfo;
-import org.apache.oodt.cas.catalog.page.QueryPager;
-import org.apache.oodt.cas.catalog.page.TransactionReceipt;
-import org.apache.oodt.cas.catalog.query.QueryExpression;
-import org.apache.oodt.cas.catalog.server.channel.CommunicationChannelClient;
-import org.apache.oodt.cas.catalog.struct.Dictionary;
-import org.apache.oodt.cas.catalog.struct.Index;
-import org.apache.oodt.cas.catalog.struct.TransactionId;
-import org.apache.oodt.cas.catalog.system.Catalog;
-import org.apache.oodt.cas.catalog.system.CatalogService;
-import org.apache.oodt.cas.catalog.util.PluginURL;
-import org.apache.oodt.cas.metadata.Metadata;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A Client that appears to be a CatalogService, but communicates with a CatalogService Server
- * <p>
- */
-public class CatalogServiceClient implements CatalogService {
-
- protected CommunicationChannelClient communicationChannelClient;
- protected int autoPagerSize;
-
- public CatalogServiceClient(CommunicationChannelClient communicationChannelClient, int autoPagerSize) {
- this.communicationChannelClient = communicationChannelClient;
- this.autoPagerSize = autoPagerSize;
- }
-
- public void shutdown() throws CatalogServiceException {
- try {
- this.communicationChannelClient.shutdown();
- }catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
-
- protected List<PluginURL> transferToServerSide(List<PluginURL> clientSideUrls) throws CatalogServiceException {
- try {
- URL customUrlStorageDir = this.communicationChannelClient.getPluginStorageDir();
- System.out.println("Got Tmp dir : " + customUrlStorageDir);
- Vector<PluginURL> serverSideUrls = new Vector<PluginURL>();
- for (PluginURL pluginURL : clientSideUrls) {
- PluginURL serverSideURL = new PluginURL(pluginURL.getCatalogId(), new URL(customUrlStorageDir, new File(pluginURL.getURL().getFile()).getName()));
- System.out.println("generated server side url : " + customUrlStorageDir);
- this.communicationChannelClient.transferUrl(pluginURL.getURL(), serverSideURL.getURL());
- serverSideUrls.add(serverSideURL);
- }
- return serverSideUrls;
- } catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
-
- public void addCatalog(Catalog catalog) throws CatalogServiceException {
- try {
- this.communicationChannelClient.addCatalog(catalog);
- } catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
-
- public void replaceCatalog(Catalog catalog)
- throws CatalogServiceException {
- try {
- this.communicationChannelClient.replaceCatalog(catalog);
- } catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
-
- public void addCatalog(String catalogId, Index index)
- throws CatalogServiceException {
- try {
- this.communicationChannelClient.addCatalog(catalogId, index);
- } catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
-
- public void addCatalog(String catalogId, Index index, List<Dictionary> dictionaries) throws CatalogServiceException {
- try {
- this.communicationChannelClient.addCatalog(catalogId, index, dictionaries);
- } catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
-
- public void addCatalog(String catalogId, Index index, List<Dictionary> dictionaries, boolean restrictQueryPermission,
- boolean restrictIngestPermission) throws CatalogServiceException {
- try {
- this.communicationChannelClient.addCatalog(catalogId, index, dictionaries, restrictQueryPermission, restrictIngestPermission);
- } catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
-
- public void addDictionary(String catalogId, Dictionary dictionary)
- throws CatalogServiceException {
- try {
- this.communicationChannelClient.addDictionary(catalogId, dictionary);
- } catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
-
- public void replaceDictionaries(String catalogId, List<Dictionary> dictionaries) throws CatalogServiceException {
- try {
- this.communicationChannelClient.replaceDictionaries(catalogId, dictionaries);
- } catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
-
- public void modifyIngestPermission(String catalogId,
- boolean restrictIngestPermission) throws CatalogServiceException {
- try {
- this.communicationChannelClient.modifyIngestPermission(catalogId, restrictIngestPermission);
- } catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
-
- public void modifyQueryPermission(String catalogId,
- boolean restrictQueryPermission) throws CatalogServiceException {
- try {
- this.communicationChannelClient.modifyQueryPermission(catalogId, restrictQueryPermission);
- } catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
-
- public void replaceIndex(String catalogId, Index index)
- throws CatalogServiceException {
- try {
- this.communicationChannelClient.replaceIndex(catalogId, index);
- } catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
-
- public void removeCatalog(String catalogId) throws CatalogServiceException {
- try {
- this.communicationChannelClient.removeCatalog(catalogId);
- } catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
-
- public URL getPluginStorageDir() throws CatalogServiceException {
- try {
- return this.communicationChannelClient.getPluginStorageDir();
- } catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
-
- public List<PluginURL> getPluginUrls() throws CatalogServiceException {
- try {
- return this.communicationChannelClient.getPluginUrls();
- } catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
-
- public void addPluginUrls(List<PluginURL> urls) throws CatalogServiceException {
- try {
- this.communicationChannelClient.addPluginUrls(this.transferToServerSide(urls));
- } catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
-
- public void delete(Metadata metadata) throws CatalogServiceException {
- try {
- this.communicationChannelClient.delete(metadata);
- } catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
-
- public List<TransactionalMetadata> getAllPages(QueryPager queryPager)
- throws CatalogServiceException {
- try {
- List<TransactionalMetadata> metadata = new Vector<TransactionalMetadata>();
- if (queryPager.getTotalPages() > 0) {
- queryPager.setPageInfo(new PageInfo(this.autoPagerSize, PageInfo.FIRST_PAGE));
- while (!queryPager.isLastPage()) {
- metadata.addAll(this.communicationChannelClient.getNextPage(queryPager));
- queryPager.incrementPageNumber();
- }
- metadata.addAll(this.communicationChannelClient.getNextPage(queryPager));
- }
- return metadata;
- } catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
-
- public Properties getCalalogProperties() throws CatalogServiceException {
- try {
- return this.communicationChannelClient.getCalalogProperties();
- } catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
-
- public Properties getCalalogProperties(String catalogUrn)
- throws CatalogServiceException {
- try {
- return this.communicationChannelClient.getCalalogProperties(catalogUrn);
- } catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
-
- public TransactionId<?> getCatalogServiceTransactionId(
- TransactionId<?> catalogTransactionId, String catalogUrn)
- throws CatalogServiceException {
- try {
- return this.communicationChannelClient.getCatalogServiceTransactionId(catalogTransactionId, catalogUrn);
- } catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
-
- public TransactionId<?> getCatalogServiceTransactionId(
- CatalogReceipt catalogReceipt, boolean generateNew) throws CatalogServiceException {
- try {
- return this.communicationChannelClient.getCatalogServiceTransactionId(catalogReceipt, generateNew);
- } catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
-
- public List<TransactionId<?>> getCatalogServiceTransactionIds(
- List<TransactionId<?>> catalogTransactionIds, String catalogUrn)
- throws CatalogServiceException {
- try {
- return this.communicationChannelClient.getCatalogServiceTransactionIds(catalogTransactionIds, catalogUrn);
- } catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
-
- public Set<String> getCurrentCatalogIds() throws CatalogServiceException {
- try {
- return this.communicationChannelClient.getCurrentCatalogIds();
- } catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
-
- public List<TransactionalMetadata> getMetadataFromTransactionIdStrings(
- List<String> catalogServiceTransactionIdStrings)
- throws CatalogServiceException {
- try {
- return this.communicationChannelClient.getMetadataFromTransactionIdStrings(catalogServiceTransactionIdStrings);
- } catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
-
- public List<TransactionalMetadata> getMetadataFromTransactionIds(
- List<TransactionId<?>> catalogServiceTransactionIds)
- throws CatalogServiceException {
- try {
- return this.communicationChannelClient.getMetadataFromTransactionIds(catalogServiceTransactionIds);
- } catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
-
- public List<TransactionalMetadata> getNextPage(QueryPager queryPager)
- throws CatalogServiceException {
- try {
- return this.communicationChannelClient.getNextPage(queryPager);
- } catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
-
- public List<String> getProperty(String key) throws CatalogServiceException {
- try {
- return this.communicationChannelClient.getProperty(key);
- } catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
-
- public List<TransactionId<?>> getTransactionIdsForAllPages(
- QueryPager queryPager) throws CatalogServiceException {
- try {
- return this.communicationChannelClient.getTransactionIdsForAllPages(queryPager);
- } catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
-
- public TransactionReceipt ingest(Metadata metadata)
- throws CatalogServiceException {
- try {
- return this.communicationChannelClient.ingest(metadata);
- } catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
-
- public boolean isRestrictIngestPermissions() throws CatalogServiceException {
- try {
- return this.communicationChannelClient.isRestrictIngestPermissions();
- } catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
-
- public boolean isRestrictQueryPermissions() throws CatalogServiceException {
- try {
- return this.communicationChannelClient.isRestrictQueryPermissions();
- } catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
-
- public Page getNextPage(Page page) throws CatalogServiceException {
- try {
- return this.communicationChannelClient.getNextPage(page);
- } catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
-
- public Page getPage(PageInfo pageInfo, QueryExpression queryExpression) throws CatalogServiceException {
- try {
- return this.communicationChannelClient.getPage(pageInfo, queryExpression);
- } catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
-
- public Page getPage(PageInfo pageInfo, QueryExpression queryExpression, Set<String> catalogIds) throws CatalogServiceException {
- try {
- return this.communicationChannelClient.getPage(pageInfo, queryExpression, catalogIds);
- } catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
-
- public List<TransactionalMetadata> getMetadata(Page page) throws CatalogServiceException {
- try {
- return this.communicationChannelClient.getMetadata(page);
- } catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
-
- public QueryPager query(QueryExpression queryExpression)
- throws CatalogServiceException {
- try {
- return this.communicationChannelClient.query(queryExpression);
- } catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
-
- public QueryPager query(QueryExpression queryExpression, Set<String> catalogIds) throws CatalogServiceException {
- try {
- return this.communicationChannelClient.query(queryExpression, catalogIds);
- } catch (Exception e) {
- throw new CatalogServiceException(e.getMessage(), e);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceClientFactory.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceClientFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceClientFactory.java
deleted file mode 100644
index 78b5d33..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceClientFactory.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.system.impl;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.server.channel.CommunicationChannelClientFactory;
-import org.apache.oodt.cas.catalog.system.CatalogServiceFactory;
-
-//Spring imports
-import org.springframework.beans.factory.annotation.Required;
-
-//OODT imports
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A Factory for CatalogServiceClient
- * <p>
- */
-public class CatalogServiceClientFactory implements CatalogServiceFactory {
-
- public static final int INT = 500;
- protected CommunicationChannelClientFactory communicationChannelClientFactory;
- protected int autoPagerSize;
-
- public CatalogServiceClientFactory() {
- this.autoPagerSize = INT;
- }
-
- public CatalogServiceClient createCatalogService() {
- return new CatalogServiceClient(this.communicationChannelClientFactory.createCommunicationChannelClient(), this.autoPagerSize);
- }
-
- @Required
- public void setCommunicationChannelClientFactory(CommunicationChannelClientFactory communicationChannelClientFactory) {
- this.communicationChannelClientFactory = communicationChannelClientFactory;
- }
-
- @Required
- public void setAutoPagerSize(int autoPagerSize) {
- if (autoPagerSize > 0) {
- this.autoPagerSize = autoPagerSize;
- }
- }
-
- public String getServerUrl() {
- return this.communicationChannelClientFactory.getServerUrl();
- }
-
-}
[53/53] oodt git commit: remove Catalog component: OODT-837.
Posted by ma...@apache.org.
remove Catalog component: OODT-837.
Project: http://git-wip-us.apache.org/repos/asf/oodt/repo
Commit: http://git-wip-us.apache.org/repos/asf/oodt/commit/ad292384
Tree: http://git-wip-us.apache.org/repos/asf/oodt/tree/ad292384
Diff: http://git-wip-us.apache.org/repos/asf/oodt/diff/ad292384
Branch: refs/heads/master
Commit: ad292384e51a66b92fc29749b658cab6b538fa95
Parents: b55e91a
Author: Chris Mattmann <ma...@apache.org>
Authored: Sun Jul 16 09:09:19 2017 -0700
Committer: Chris Mattmann <ma...@apache.org>
Committed: Sun Jul 16 09:09:19 2017 -0700
----------------------------------------------------------------------
pom.xml | 1 -
1 file changed, 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/oodt/blob/ad292384/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 53c24cc..6c607ca 100644
--- a/pom.xml
+++ b/pom.xml
@@ -36,7 +36,6 @@ the License.
<module>pcs/input</module>
<module>metadata</module>
<module>filemgr</module>
- <module>catalog</module>
<module>workflow</module>
<module>crawler</module>
<module>resource</module>
[52/53] oodt git commit: Record change for OODT-836, OODT-837.
Posted by ma...@apache.org.
Record change for OODT-836, OODT-837.
Project: http://git-wip-us.apache.org/repos/asf/oodt/repo
Commit: http://git-wip-us.apache.org/repos/asf/oodt/commit/b55e91aa
Tree: http://git-wip-us.apache.org/repos/asf/oodt/tree/b55e91aa
Diff: http://git-wip-us.apache.org/repos/asf/oodt/diff/b55e91aa
Branch: refs/heads/master
Commit: b55e91aac58c9f3b6aa7eb06b6c4cb1d1e1cf531
Parents: 098cc4f
Author: Chris Mattmann <ma...@apache.org>
Authored: Sun Jul 16 09:05:48 2017 -0700
Committer: Chris Mattmann <ma...@apache.org>
Committed: Sun Jul 16 09:05:48 2017 -0700
----------------------------------------------------------------------
CHANGES.txt | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/oodt/blob/b55e91aa/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 74e802d..ccdeadf 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -3,6 +3,8 @@ Apache OODT Change Log
Release 1.1 - Current Development
+* OODT-836, OODT-837 Remove Non-Essential Components (mattmann, mdstarch, magicaltrout)
+
* OODT-213 Reading/Writing API for XML-based Workflow Task policy (mattmann)
* OODT-775 XSD's for pushpull's mimetypes.xml (Lewis John McGibbney via mattmann)
[21/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/main/java/org/apache/oodt/product/handlers/ofsn/OFSNGetHandler.java
----------------------------------------------------------------------
diff --git a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/OFSNGetHandler.java b/product/src/main/java/org/apache/oodt/product/handlers/ofsn/OFSNGetHandler.java
deleted file mode 100644
index c619883..0000000
--- a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/OFSNGetHandler.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.product.handlers.ofsn;
-
-//JDK imports
-import java.util.Properties;
-
-//OODT imports
-import org.apache.oodt.product.ProductException;
-
-/**
- *
- * The default OFSN handler for getting remote data.
- *
- * @author mattmann
- * @version $Revision$
- *
- */
-public interface OFSNGetHandler {
-
- /**
- * Retrieves a chunk of data from the remote file.
- *
- * @param filepath
- * The path to the remote file.
- * @param offset
- * The offset in the remote data to retrieve.
- * @param length
- * The length of data to read
- * @return The byte[] data, read, or null otherwise.
- * @throws ProductException
- * If any error occurs.
- */
- byte[] retrieveChunk(String filepath, long offset, int length)
- throws ProductException;
-
- /**
- * Returns the size of the remote data, which may be the entire file in
- * question, or some subset/transformation on it.
- *
- * @param filepath
- * The remote file in question.
- * @return The size of the remote file, potentially after a remote
- * transformation has occured.
- */
- long sizeOf(String filepath);
-
- /**
- * Configures this handler with the provided configuration stored in a
- * {@link Properties} object.
- *
- * @param conf
- * The configuration for this list handler.
- */
- void configure(Properties conf);
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/main/java/org/apache/oodt/product/handlers/ofsn/OFSNHandlerConfig.java
----------------------------------------------------------------------
diff --git a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/OFSNHandlerConfig.java b/product/src/main/java/org/apache/oodt/product/handlers/ofsn/OFSNHandlerConfig.java
deleted file mode 100644
index 8c8aa18..0000000
--- a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/OFSNHandlerConfig.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.product.handlers.ofsn;
-
-//JDK imports
-import java.util.Properties;
-
-/**
- *
- * A configuration element in the XML config file for the OFSN handler.
- *
- * @author mattmann
- * @version $Revision$
- *
- */
-public class OFSNHandlerConfig {
-
- private String className;
-
- private String type;
-
- private String name;
-
- private Properties handlerConf;
-
- /**
- * @param className
- * @param type
- * @param name
- */
- public OFSNHandlerConfig(String className, String type, String name) {
- super();
- this.className = className;
- this.type = type;
- this.name = name;
- this.handlerConf = new Properties();
- }
-
- /**
- *
- */
- public OFSNHandlerConfig() {
- super();
- }
-
- /**
- * @return the className
- */
- public String getClassName() {
- return className;
- }
-
- /**
- * @param className
- * the className to set
- */
- public void setClassName(String className) {
- this.className = className;
- }
-
- /**
- * @return the type
- */
- public String getType() {
- return type;
- }
-
- /**
- * @param type
- * the type to set
- */
- public void setType(String type) {
- this.type = type;
- }
-
- /**
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param name
- * the name to set
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * @return the handlerConf
- */
- public Properties getHandlerConf() {
- return handlerConf;
- }
-
- /**
- * @param handlerConf the handlerConf to set
- */
- public void setHandlerConf(Properties handlerConf) {
- this.handlerConf = handlerConf;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/main/java/org/apache/oodt/product/handlers/ofsn/OFSNListHandler.java
----------------------------------------------------------------------
diff --git a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/OFSNListHandler.java b/product/src/main/java/org/apache/oodt/product/handlers/ofsn/OFSNListHandler.java
deleted file mode 100644
index 5e23d58..0000000
--- a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/OFSNListHandler.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.product.handlers.ofsn;
-
-//JDK imports
-import java.io.File;
-import java.util.Properties;
-
-//OODT imports
-import org.apache.oodt.product.ProductException;
-
-/**
- * <p>
- * Classes that implement this interface define how to return file listings on a
- * remote server from an <code>ofsn</code>.
- * </p>
- *
- * @author mattmann
- * @version $Revision$
- *
- */
-public interface OFSNListHandler {
-
- /**
- * Handlers that implement this method take an <code>O</code>nline
- * <code>F</code>ile <code>S</code>pecification <code>N</code>ame and return
- * back a listing of files on the remote server.
- *
- * @param ofsn
- * The OFSN path to list files from.
- * @return An array of {@link File} objects.
- * @throws ProductException
- * If any error occurs performing the listing on the server side.
- */
- File[] getListing(String ofsn) throws ProductException;
-
- /**
- * Configures this handler with the provided configuration stored in a
- * {@link Properties} object.
- *
- * @param conf
- * The configuration for this list handler.
- */
- void configure(Properties conf);
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/main/java/org/apache/oodt/product/handlers/ofsn/RawSizeListHandler.java
----------------------------------------------------------------------
diff --git a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/RawSizeListHandler.java b/product/src/main/java/org/apache/oodt/product/handlers/ofsn/RawSizeListHandler.java
deleted file mode 100644
index 883e1b5..0000000
--- a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/RawSizeListHandler.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.product.handlers.ofsn;
-
-//JDK imports
-import java.io.File;
-import java.util.Properties;
-
-//OODT imports
-import org.apache.oodt.product.ProductException;
-
-/**
- *
- * Handles a listing request for the raw size of a file. This listing
- * returns a single file or directory, which will then have its size
- * computed.
- *
- * @author mattmann
- * @version $Revision$
- *
- */
-public class RawSizeListHandler implements OFSNListHandler {
-
- /* (non-Javadoc)
- * @see org.apache.oodt.product.handlers.ofsn.OFSNListHandler#configure(java.util.Properties)
- */
- public void configure(Properties conf) {
- // TODO Auto-generated method stub
- // nothing yet
-
- }
-
- /* (non-Javadoc)
- * @see org.apache.oodt.product.handlers.ofsn.OFSNListHandler#getListing(java.lang.String)
- */
- public File[] getListing(String ofsn) throws ProductException {
- if (!new File(ofsn).exists()) {
- throw new ProductException("file: [" + ofsn
- + "] does not exist!");
- }
- return new File[] { new File(ofsn) };
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/main/java/org/apache/oodt/product/handlers/ofsn/SingleFileListHandler.java
----------------------------------------------------------------------
diff --git a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/SingleFileListHandler.java b/product/src/main/java/org/apache/oodt/product/handlers/ofsn/SingleFileListHandler.java
deleted file mode 100644
index 45d559c..0000000
--- a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/SingleFileListHandler.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.product.handlers.ofsn;
-
-//JDK imports
-import java.io.File;
-import java.util.Properties;
-
-import org.apache.oodt.product.ProductException;
-
-/**
- *
- * Returns a single remote file listing of the given ofsn.
- *
- * @author mattmann
- * @version $Revision$
- *
- */
-public class SingleFileListHandler implements OFSNListHandler {
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.oodt.product.handlers.ofsn.OFSNListHandler#configure(java.
- * util.Properties)
- */
- public void configure(Properties conf) {
- // TODO Auto-generated method stub
- // nothing yet
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.oodt.product.handlers.ofsn.OFSNListHandler#getListing(java
- * .lang.String)
- */
- public File[] getListing(String ofsn) throws ProductException {
- if (!new File(ofsn).exists()) {
- throw new ProductException("file: [" + ofsn + "] does not exist!");
- }
- return new File[] { new File(ofsn) };
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/main/java/org/apache/oodt/product/handlers/ofsn/SingleZipFileListHandler.java
----------------------------------------------------------------------
diff --git a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/SingleZipFileListHandler.java b/product/src/main/java/org/apache/oodt/product/handlers/ofsn/SingleZipFileListHandler.java
deleted file mode 100644
index 748a534..0000000
--- a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/SingleZipFileListHandler.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.product.handlers.ofsn;
-
-//OODT imports
-import org.apache.oodt.product.handlers.ofsn.util.OFSNUtils;
-import org.apache.oodt.product.ProductException;
-
-//JDK imports
-import java.io.File;
-import java.util.Properties;
-
-
-/**
- *
- * Generates a listing of the size of a remote file identified by its OFSN as a
- * zip would be.
- *
- * @author mattmann
- * @version $Revision$
- *
- */
-public class SingleZipFileListHandler implements OFSNListHandler {
-
- private String cacheRoot;
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.oodt.product.handlers.ofsn.OFSNListHandler#configure(java.
- * util.Properties)
- */
- public void configure(Properties conf) {
- // TODO Auto-generated method stub
-
- this.cacheRoot = conf.getProperty("cacheDirRoot");
-
- if (this.cacheRoot == null) {
- this.cacheRoot = "/tmp";
- }
-
- if (!this.cacheRoot.endsWith("/")) {
- this.cacheRoot += "/";
- }
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.oodt.product.handlers.ofsn.OFSNListHandler#getListing(java
- * .lang.String)
- */
- public File[] getListing(String ofsn) throws ProductException {
- if (!new File(ofsn).exists()) {
- throw new ProductException("file: [" + ofsn + "] does not exist!");
- }
-
- String zipFilePath = this.cacheRoot + new File(ofsn).getName() + ".zip";
- File zipFile = OFSNUtils.buildZipFile(zipFilePath, new File[] { new File(
- ofsn) });
- return new File[] { zipFile };
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/main/java/org/apache/oodt/product/handlers/ofsn/StdOFSNGetHandler.java
----------------------------------------------------------------------
diff --git a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/StdOFSNGetHandler.java b/product/src/main/java/org/apache/oodt/product/handlers/ofsn/StdOFSNGetHandler.java
deleted file mode 100644
index cb344e9..0000000
--- a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/StdOFSNGetHandler.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.product.handlers.ofsn;
-
-//JDK imports
-
-import org.apache.oodt.product.ProductException;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-//OODT imports
-
-/**
- *
- * Standard way of retrieving a file without performing
- * any transformation on it.
- *
- * @author mattmann
- * @version $Revision$
- *
- */
-public class StdOFSNGetHandler implements OFSNGetHandler {
- private static Logger LOG = Logger.getLogger(StdOFSNGetHandler.class.getName());
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.oodt.product.handlers.ofsn.OFSNGetHandler#retrieveChunk(java
- * .lang.String, long, int)
- */
- public byte[] retrieveChunk(String filepath, long offset, int length)
- throws ProductException {
- InputStream in = null;
- byte[] buf = null;
-
- try {
- in = new FileInputStream(new File(filepath));
-
- buf = new byte[length];
- int numRead;
- long numSkipped;
- numSkipped = in.skip(offset);
- if (numSkipped != offset) {
- throw new ProductException("Was not able to skip: [" + offset
- + "] bytes into product: num actually skipped: [" + numSkipped
- + "]");
- }
-
- numRead = in.read(buf, 0, length);
-
- if (numRead != length) {
- throw new ProductException("Was not able to read: [" + length
- + "] bytes from product: num actually read: [" + numRead + "]");
- }
- } catch (IOException e) {
- LOG.log(Level.SEVERE, e.getMessage());
- throw new ProductException("IO exception retrieving chunk of product: ["
- + filepath + "]: Message: " + e.getMessage());
- } finally {
- if (in != null) {
- try {
- in.close();
- } catch (Exception ignore) {
- }
-
- }
- }
-
- return buf;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.oodt.product.handlers.ofsn.OFSNGetHandler#sizeOf(java.lang
- * .String)
- */
- public long sizeOf(String filepath) {
- return new File(filepath).length();
- }
-
- /* (non-Javadoc)
- * @see org.apache.oodt.product.handlers.ofsn.OFSNGetHandler#configure(java.util.Properties)
- */
- public void configure(Properties conf) {
- // no properties to configure
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/main/java/org/apache/oodt/product/handlers/ofsn/URLGetHandler.java
----------------------------------------------------------------------
diff --git a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/URLGetHandler.java b/product/src/main/java/org/apache/oodt/product/handlers/ofsn/URLGetHandler.java
deleted file mode 100644
index 20944f3..0000000
--- a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/URLGetHandler.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.product.handlers.ofsn;
-
-//JDK imports
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Properties;
-import java.util.logging.Logger;
-
-//OODT imports
-import org.apache.oodt.product.ProductException;
-import org.apache.oodt.product.handlers.ofsn.AbstractCrawlLister;
-import org.apache.oodt.product.handlers.ofsn.OFSNGetHandler;
-
-/**
- * A {@link OFSNGetHandler} for returning a URL listing pointing to files within an OFSN
- *
- * NOTE: Configuration parameters for this class include:
- * 1. Server hostname
- * 2. Server port
- * 3. Webapp context-root
- * 4. Path to product-root
- * 5. Return type desired for URLs
- *
- * @author rverma
- * @version $Revision$
- *
- */
-public class URLGetHandler extends AbstractCrawlLister implements OFSNGetHandler {
-
- Logger LOG = Logger.getLogger(URLGetHandler.class.getName());
-
- // Constants
- private static final String PROD_SERVER_HOSTNAME = "prodServerHostname";
- private static final String PROD_SERVER_PORT = "prodServerPort";
- private static final String PROD_SERVER_CONTEXT = "prodServerContextRoot";
- private static final String PRODUCT_ROOT = "productRoot";
- private static final String RETURN_TYPE = "returnType";
-
- protected static final String DEFAULT_RETURN_VALUE="";
- protected static final String DEFAULT_PROD_SERVER_HOSTNAME = "localhost";
- protected static final String DEFAULT_PROD_SERVER_PORT = "8080";
- protected static final String DEFAULT_PROD_SERVER_CONTEXT = "web-grid";
- protected static final String DEFAULT_PRODUCT_ROOT = "/some/path";
- protected static final String DEFAULT_RETURN_TYPE = "RAW";
-
- // Instance
- private String prodServerHostname = "";
- private String prodServerPort = "";
- private String prodServerContext = "";
- private String productRoot = "";
- private String returnType = "";
-
- /*
- * (non-Javadoc)
- * @see org.apache.oodt.product.handlers.ofsn.AbstractCrawlLister#configure(java.util.Properties)
- */
- public void configure(Properties prop) {
-
- if (prop != null) {
- if (prop.getProperty(PROD_SERVER_HOSTNAME) != null) {
- this.prodServerHostname = prop.getProperty(PROD_SERVER_HOSTNAME);
- } else {
- LOG.warning("Configuration property ["+PROD_SERVER_HOSTNAME+"] not specified, using default");
- this.prodServerHostname = DEFAULT_PROD_SERVER_HOSTNAME;
- }
- LOG.info("Property ["+PROD_SERVER_HOSTNAME+"] set with value ["+this.prodServerHostname+"]");
-
- if (prop.getProperty(PROD_SERVER_PORT) != null) {
- this.prodServerPort = prop.getProperty(PROD_SERVER_PORT);
- } else {
- LOG.warning("Configuration property ["+PROD_SERVER_PORT+"] not specified, using default");
- this.prodServerPort = DEFAULT_PROD_SERVER_PORT;
- }
- LOG.info("Property ["+PROD_SERVER_PORT+"] set with value ["+this.prodServerPort+"]");
-
- if (prop.getProperty(PROD_SERVER_CONTEXT) != null) {
- this.prodServerContext = prop.getProperty(PROD_SERVER_CONTEXT);
- } else {
- LOG.warning("Configuration property ["+PROD_SERVER_CONTEXT+"] not specified, using default");
- this.prodServerContext = DEFAULT_PROD_SERVER_CONTEXT;
- }
- LOG.info("Property ["+PROD_SERVER_CONTEXT+"] set with value ["+this.prodServerContext+"]");
-
- if (prop.getProperty(PRODUCT_ROOT) != null) {
- this.productRoot = prop.getProperty(PRODUCT_ROOT);
- } else {
- LOG.warning("Configuration property ["+PRODUCT_ROOT+"] not specified, using default");
- this.productRoot = DEFAULT_PRODUCT_ROOT;
- }
- LOG.info("Property ["+PRODUCT_ROOT+"] set with value ["+this.productRoot+"]");
-
- if (prop.getProperty(RETURN_TYPE) != null) {
- this.returnType = prop.getProperty(RETURN_TYPE);
- } else {
- LOG.warning("Configuration property ["+RETURN_TYPE+"] not specified, using default");
- this.returnType = DEFAULT_RETURN_TYPE;
- }
- LOG.info("Property ["+RETURN_TYPE+"] set with value ["+this.returnType+"]");
-
- } else {
- LOG.warning("Configuration properties could not be loaded");
- }
-
- }
-
- /*
- * (non-Javadoc)
- * @see org.apache.oodt.product.handlers.ofsn.OFSNGetHandler#retrieveChunk(java.lang.String, long, int)
- */
- public byte[] retrieveChunk(String filepath, long offset, int length)
- throws ProductException {
-
- LOG.info("Retrieving chunk of URL listing for path: ["+filepath+"] at offset "
- + offset+" for "+length+" bytes");
-
- String urlListing = DEFAULT_RETURN_VALUE;
- try {
- urlListing = getURLListing(filepath);
- } catch (ProductException e) {
- LOG.warning("Unable to obtain byte chunk ("+offset+" - "+(offset+length)+") "
- + "for filepath listing ["+filepath+"]");
- LOG.warning(e.getMessage());
- } catch (IllegalArgumentException e) {
- LOG.warning("Unable to obtain byte chunk ("+offset+" - "+(offset+length)+") "
- + "for filepath listing ["+filepath+"]");
- LOG.warning(e.getMessage());
- }
-
- // Convert listing to bytes
- byte[] retBytes = new byte[length];
- byte[] metBytes = urlListing.getBytes();
- ByteArrayInputStream is = new ByteArrayInputStream(metBytes);
- is.skip(offset);
- is.read(retBytes, 0, length);
-
- return retBytes;
- }
-
- /**
- * Returns a new-line separated list of URLs for all files located under the given filepath
- *
- * @param filePath the absolute path to a root-directory to get a product listing for
- * @return a string containing a new-line separated list of URLs
- * @throws ProductException
- */
- private String getURLListing(String filePath) throws ProductException,
- IllegalArgumentException {
-
- // crawl and collect all files (including within subdirs) under filepath
- File[] fileListing = getListing(filePath);
-
- // convert each crawled file's path into an OFSN download link
- StringBuilder stringBuilder = new StringBuilder();
- for (File aFileListing : fileListing) {
- File file = (File) aFileListing;
- stringBuilder.append(buildOFSNURL(file).toString());
- stringBuilder.append("\n");
- }
-
- return stringBuilder.toString();
- }
-
- /**
- * Returns a URL object representing the URL associated with this particular product file.
- *
- * The URL is defined to have items such as: hostname, server port, server context root,
- * and return type configured based upon a product server configuration file
- *
- * @param file the product file
- * @return a URL
- */
- private URL buildOFSNURL(File file) {
- URL url = null;
-
- String fileRelativePath = file.getAbsolutePath().substring(this.productRoot.length());
-
- // construct a URL for the file, optionally using a port if available
- String ofsnPath;
- if (this.prodServerPort != null) {
- if (!this.prodServerPort.isEmpty()) {
- ofsnPath = "http://" + this.prodServerHostname
- + ":" + this.prodServerPort + "/" + this.prodServerContext
- + "/prod?q=OFSN=" + fileRelativePath + "+AND+RT%3D" + this.returnType;
- } else {
- ofsnPath = "http://" + this.prodServerHostname
- + "/" + this.prodServerContext + "/prod?q=OFSN=" + fileRelativePath
- + "+AND+RT%3D" + this.returnType;
- }
- } else {
- ofsnPath = "http://" + this.prodServerHostname
- + "/" + this.prodServerContext + "/prod?q=OFSN=" + fileRelativePath
- + "+AND+RT%3D" + this.returnType;
- }
-
- try {
- url = new URL(ofsnPath);
- } catch (MalformedURLException e) {
- LOG.warning(e.getMessage());
- }
-
- return url;
- }
-
- /*
- * (non-Javadoc)
- * @see org.apache.oodt.product.handlers.ofsn.OFSNGetHandler#sizeOf(java.lang.String)
- */
- public long sizeOf(String filepath) {
- String urlListing = DEFAULT_RETURN_VALUE;
- try {
- urlListing = getURLListing(filepath);
- } catch (ProductException e) {
- LOG.warning("Unable to obtain size information for filepath listing ["+filepath+"]");
- LOG.warning(e.getMessage());
- } catch (IllegalArgumentException e) {
- LOG.warning("Unable to obtain size information for filepath listing ["+filepath+"]");
- LOG.warning(e.getMessage());
- }
-
- return urlListing.getBytes().length;
- }
-
- /*
- * (non-Javadoc)
- * @see org.apache.oodt.product.handlers.ofsn.AbstractCrawlLister#getListing(java.lang.String)
- */
- public File[] getListing(String filePath) throws ProductException,
- IllegalArgumentException {
- return crawlFiles(new File(filePath), true, false);
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/main/java/org/apache/oodt/product/handlers/ofsn/metadata/OFSNMetKeys.java
----------------------------------------------------------------------
diff --git a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/metadata/OFSNMetKeys.java b/product/src/main/java/org/apache/oodt/product/handlers/ofsn/metadata/OFSNMetKeys.java
deleted file mode 100644
index e56d7aa..0000000
--- a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/metadata/OFSNMetKeys.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.product.handlers.ofsn.metadata;
-
-/**
- * Met keys for use in OFSN handler definition.
- *
- * @author mattmann
- * @version $Revision$
- *
- */
-public interface OFSNMetKeys {
-
- String LISTING_CMD = "listing";
-
- String GET_CMD = "get";
-
- String OFSN_XML_CONF_FILE_KEY = "org.apache.oodt.product.handlers.ofsn.xmlConfigFilePath";
-
- String OFSN_COMPUTE_DIR_SIZE = "org.apache.oodt.product.handlers.ofsn.computeDirSize";
-
- String OFSN_COMPUTE_FILE_SIZE = "org.apache.oodt.product.handlers.ofsn.computeFileSize";
-
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/main/java/org/apache/oodt/product/handlers/ofsn/metadata/OFSNXMLConfigMetKeys.java
----------------------------------------------------------------------
diff --git a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/metadata/OFSNXMLConfigMetKeys.java b/product/src/main/java/org/apache/oodt/product/handlers/ofsn/metadata/OFSNXMLConfigMetKeys.java
deleted file mode 100644
index f4f8c53..0000000
--- a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/metadata/OFSNXMLConfigMetKeys.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.product.handlers.ofsn.metadata;
-
-
-/**
- *
- * Met Keys for the {@link org.apache.oodt.product.handlers.ofsn.OFSNFileHandlerConfigurationReader}
- *
- * @author mattmann
- * @version $Revision$
- *
- */
-public interface OFSNXMLConfigMetKeys {
-
- String OFSN_CFG_ID_ATTR = "id";
-
- String OFSN_CFG_NAME_ATTR = "name";
-
- String OFSN_PRODUCT_ROOT_ATTR = "productRoot";
-
- String HANDLER_TAG = "handler";
-
- String HANDLER_CLASSNAME_ATTR = "class";
-
- String HANDLER_NAME_ATTR = "name";
-
- String HANDLER_TYPE_ATTR = "type";
-
- String PROPERTY_TAG = "property";
-
- String PROPERTY_NAME_ATTR = "name";
-
- String PROPERTY_VALUE_ATTR = "value";
-
- /* optional handler property attributes supported by all handlers */
- String PROPERTY_MIMETYPE_ATTR = "mimeType";
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/main/java/org/apache/oodt/product/handlers/ofsn/metadata/OFSNXMLMetKeys.java
----------------------------------------------------------------------
diff --git a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/metadata/OFSNXMLMetKeys.java b/product/src/main/java/org/apache/oodt/product/handlers/ofsn/metadata/OFSNXMLMetKeys.java
deleted file mode 100644
index 0bcdd75..0000000
--- a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/metadata/OFSNXMLMetKeys.java
+++ /dev/null
@@ -1,43 +0,0 @@
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.product.handlers.ofsn.metadata;
-
-/**
- * @author mattmann
- * @version $Revision$
- *
- * <p>Describe your class here</p>.
- */
-public interface OFSNXMLMetKeys {
-
- String DIR_RESULT_TAG = "dirResult";
-
- String DIR_ENTRY_TAG = "dirEntry";
-
- String OFSN_TAG = "OFSN";
-
- String FILE_SIZE_TAG = "fileSize";
-
- String XML_MIME_TYPE = "text/xml";
-
- // FIXME: change namespace URI?
- String DIR_LISTING_NS = "http://oodt.jpl.nasa.gov/xml/namespaces/dirlist/1.0";
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/main/java/org/apache/oodt/product/handlers/ofsn/metadata/OODTMetKeys.java
----------------------------------------------------------------------
diff --git a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/metadata/OODTMetKeys.java b/product/src/main/java/org/apache/oodt/product/handlers/ofsn/metadata/OODTMetKeys.java
deleted file mode 100644
index 56ff703..0000000
--- a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/metadata/OODTMetKeys.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.product.handlers.ofsn.metadata;
-
-/**
- * @author mattmann
- * @version $Revision$
- *
- * <p>Describe your class here</p>.
- */
-public interface OODTMetKeys {
-
- String XMLQUERY_QUERYELEM_ROLE_ELEM = "elemName";
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/main/java/org/apache/oodt/product/handlers/ofsn/metadata/XMLQueryMetKeys.java
----------------------------------------------------------------------
diff --git a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/metadata/XMLQueryMetKeys.java b/product/src/main/java/org/apache/oodt/product/handlers/ofsn/metadata/XMLQueryMetKeys.java
deleted file mode 100644
index b9f1f79..0000000
--- a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/metadata/XMLQueryMetKeys.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.product.handlers.ofsn.metadata;
-
-/**
- * @author mattmann
- * @version $Revision$
- *
- * <p>Describe your class here</p>.
- */
-public interface XMLQueryMetKeys {
-
- String OFSN = "OFSN";
-
- String RETURN_TYPE = "RT";
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/main/java/org/apache/oodt/product/handlers/ofsn/util/OFSNObjectFactory.java
----------------------------------------------------------------------
diff --git a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/util/OFSNObjectFactory.java b/product/src/main/java/org/apache/oodt/product/handlers/ofsn/util/OFSNObjectFactory.java
deleted file mode 100644
index 6de92e9..0000000
--- a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/util/OFSNObjectFactory.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.product.handlers.ofsn.util;
-
-//OODT imports
-import org.apache.oodt.product.handlers.ofsn.OFSNGetHandler;
-import org.apache.oodt.product.handlers.ofsn.OFSNListHandler;
-
-//JDK imports
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- *
- * The Object factory to use in the OFSN product server.
- *
- * @author mattmann
- * @version $Revision$
- *
- */
-public final class OFSNObjectFactory {
-
- private static final Logger LOG = Logger.getLogger(OFSNObjectFactory.class
- .getName());
-
- /**
- * <p>
- * Constructs a new {@link OFSNListHandler} from the specified
- * <code>className</code>.
- * </p>
- *
- * @param className
- * The class name of the OFSNListHandler object to create.
- * @return A newly constructed {@link OFSNListHandler} object.
- */
- public static OFSNListHandler getListHandler(String className) {
- try {
- Class<OFSNListHandler> listHandler = (Class<OFSNListHandler>) Class
- .forName(className);
- return listHandler.newInstance();
- } catch (ClassNotFoundException e) {
- LOG.log(Level.SEVERE, e.getMessage());
- LOG.log(Level.WARNING,
- "ClassNotFoundException when loading list handler class " + className
- + " Message: " + e.getMessage());
- } catch (InstantiationException e) {
- LOG.log(Level.SEVERE, e.getMessage());
- LOG.log(Level.WARNING,
- "InstantiationException when loading list handler class " + className
- + " Message: " + e.getMessage());
- } catch (IllegalAccessException e) {
- LOG.log(Level.SEVERE, e.getMessage());
- LOG.log(Level.WARNING,
- "IllegalAccessException when loading list handler class " + className
- + " Message: " + e.getMessage());
- }
-
- return null;
- }
-
- /**
- * <p>
- * Constructs a new {@link OFSNGetHandler} from the specified
- * <code>className</code>.
- * </p>
- *
- * @param className
- * The class name of the OFSNGetHandler object to create.
- * @return A newly constructed {@link OFSNGetHandler} object.
- */
- public static OFSNGetHandler getGetHandler(String className) {
- try {
- Class<OFSNGetHandler> getHandler = (Class<OFSNGetHandler>) Class
- .forName(className);
- return getHandler.newInstance();
- } catch (ClassNotFoundException e) {
- LOG.log(Level.SEVERE, e.getMessage());
- LOG.log(Level.WARNING,
- "ClassNotFoundException when loading get handler class " + className
- + " Message: " + e.getMessage());
- } catch (InstantiationException e) {
- LOG.log(Level.SEVERE, e.getMessage());
- LOG.log(Level.WARNING,
- "InstantiationException when loading get handler class " + className
- + " Message: " + e.getMessage());
- } catch (IllegalAccessException e) {
- LOG.log(Level.SEVERE, e.getMessage());
- LOG.log(Level.WARNING,
- "IllegalAccessException when loading get handler class " + className
- + " Message: " + e.getMessage());
- }
-
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/main/java/org/apache/oodt/product/handlers/ofsn/util/OFSNUtils.java
----------------------------------------------------------------------
diff --git a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/util/OFSNUtils.java b/product/src/main/java/org/apache/oodt/product/handlers/ofsn/util/OFSNUtils.java
deleted file mode 100644
index b8b4583..0000000
--- a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/util/OFSNUtils.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.product.handlers.ofsn.util;
-
-//OODT imports
-
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.FilenameUtils;
-import org.apache.oodt.commons.xml.XMLUtils;
-import org.apache.oodt.product.handlers.ofsn.OFSNHandlerConfig;
-import org.apache.oodt.product.handlers.ofsn.metadata.OFSNMetKeys;
-import org.apache.oodt.product.handlers.ofsn.metadata.OFSNXMLMetKeys;
-import org.apache.oodt.product.handlers.ofsn.metadata.OODTMetKeys;
-import org.apache.oodt.xmlquery.QueryElement;
-import org.apache.oodt.xmlquery.XMLQuery;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-//JDK imports
-//APACHE imports
-
-/**
- *
- *
- * @author mattmann
- * @version $Revision$
- *
- */
-public final class OFSNUtils implements OODTMetKeys, OFSNXMLMetKeys,
- OFSNMetKeys {
- public static final int INT = 1024;
- private static Logger LOG = Logger.getLogger(OFSNUtils.class.getName());
- public static String extractFieldFromQuery(XMLQuery query, String name) {
- for (Iterator<QueryElement> i = query.getWhereElementSet().iterator(); i
- .hasNext();) {
- QueryElement element = i.next();
- if (element.getRole().equals(XMLQUERY_QUERYELEM_ROLE_ELEM)
- && element.getValue().equalsIgnoreCase(name)) {
- // get the next element and ensure that it is a LITERAL, and
- // return that
- QueryElement litElement = i.next();
- return litElement.getValue();
- }
- }
-
- return null;
- }
-
- public static Document getOFSNDoc(List<File> fileList, OFSNHandlerConfig cfg,
- String productRoot, boolean showDirSize, boolean showFileSize) {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- factory.setNamespaceAware(true);
- Document document;
-
- try {
- DocumentBuilder builder = factory.newDocumentBuilder();
- document = builder.newDocument();
-
- Element root = (Element) document.createElement(DIR_RESULT_TAG);
- XMLUtils.addAttribute(document, root, "xmlns", DIR_LISTING_NS);
- document.appendChild(root);
-
- for (File file : fileList) {
- Element dirEntryElem = XMLUtils.addNode(document, root, DIR_ENTRY_TAG);
- String ofsn = toOFSN(file.getAbsolutePath(), productRoot);
- //This ensures that we get ofsn names with unix style separators.
- //On a Windows machine, the product server would return '\'
- //separators.
- String unixStyleOFSN = FilenameUtils.separatorsToUnix(ofsn);
- if (cfg.getType().equals(LISTING_CMD)) {
- if (!Boolean.valueOf(cfg.getHandlerConf().getProperty("isSizeCmd"))) {
- XMLUtils.addNode(document, dirEntryElem, OFSN_TAG, unixStyleOFSN);
- }
- }
-
- long size = Long.MIN_VALUE;
-
- if (file.isDirectory()) {
- if (showDirSize) {
- size = FileUtils.sizeOfDirectory(file);
- }
- } else {
- if (showFileSize) {
- size = file.length();
- }
- }
-
- if (size != Long.MIN_VALUE) {
- XMLUtils.addNode(document, dirEntryElem, FILE_SIZE_TAG, String
- .valueOf(size));
- }
- }
-
- return document;
- } catch (ParserConfigurationException e) {
- LOG.log(Level.SEVERE, e.getMessage());
- return null;
- }
-
- }
-
- public static String relativeize(String path, String productRoot) {
- return productRoot + (path.startsWith("/") ? path.substring(1) : path);
- }
-
- public static File buildZipFile(String zipFileFullPath, File[] files) {
- // Create a buffer for reading the files
- byte[] buf = new byte[INT];
- ZipOutputStream out = null;
-
- try {
- // Create the ZIP file
- out = new ZipOutputStream(new FileOutputStream(zipFileFullPath));
-
- for (File file : files) {
- FileInputStream in = new FileInputStream(file);
-
- // Add ZIP entry to output stream.
- out.putNextEntry(new ZipEntry(file.getName()));
-
- // Transfer bytes from the file to the ZIP file
- int len;
- while ((len = in.read(buf)) > 0) {
- out.write(buf, 0, len);
- }
-
- // Complete the entry
- out.closeEntry();
- in.close();
- }
- } catch (IOException e) {
- LOG.log(Level.SEVERE, e.getMessage());
- } finally {
- if (out != null) {
- try {
- out.close();
- } catch (Exception ignore) {
- }
-
- }
- }
-
- return new File(zipFileFullPath);
-
- }
-
- public static boolean validateOFSN(String ofsn) {
- if (ofsn == null) {
- return false;
- } else {
- return !ofsn.equals("") && !ofsn.matches(".*\\.\\..*");
- }
- }
-
- private static String toOFSN(String absolutePath, String productRootPath) {
- if (absolutePath.startsWith(productRootPath)) {
- return absolutePath.substring(productRootPath.length());
- } else {
- // must have been a *.zip file, generated in some cache dir
- // just return the file name
- return new File(absolutePath).getName();
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/main/java/org/apache/oodt/xmlquery/ChunkedProductInputStream.java
----------------------------------------------------------------------
diff --git a/product/src/main/java/org/apache/oodt/xmlquery/ChunkedProductInputStream.java b/product/src/main/java/org/apache/oodt/xmlquery/ChunkedProductInputStream.java
deleted file mode 100644
index f4376f0..0000000
--- a/product/src/main/java/org/apache/oodt/xmlquery/ChunkedProductInputStream.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.xmlquery;
-
-import org.apache.oodt.product.ProductException;
-import org.apache.oodt.product.Retriever;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * Streamer for chunked products.
- *
- * This streamer starts a background thread to repeatedly read chunks of a product into a
- * bounded buffer. Reads read from chunks in the buffer.
- *
- * @author Kelly
- * @version $Revision: 1.5 $
- */
-final class ChunkedProductInputStream extends InputStream {
- /**
- * Creates a new <code>ChunkedProductInputStream</code> instance.
- *
- * @param id Product ID.
- * @param retriever Retriever to use.
- * @param size How big the product is.
- */
- ChunkedProductInputStream(String id, Retriever retriever, long size) {
- this.id = id; // Save product ID
- this.size = size; // Save size
- this.retriever = retriever; // And the retriever used to get chunks
- open = true; // Start out open
- eof = false; // And not yet reached EOF, even if size=0
- }
-
-
- /**
- * Read a single byte.
- *
- * This method reads from a chunk stored in the bounded buffer. It may block if
- * there are no more blocks in the buffer.
- *
- * @return Byte, or -1 if at end of file.
- * @throws IOException if an error occurs.
- */
- public int read() throws IOException {
- checkOpen(); // Make sure the stream's open
- if (eof) {
- throw new IOException("End of file"); // Already reached EOF? You lose.
- }
- fetchBlock(); // Get a block.
- if (eof) {
- return -1; // No more blocks? Signal EOF.
- }
- return block[blockIndex++]; // Yield next byte (promoted) from block.
- }
-
- /**
- * Read into an array.
- *
- * This method reads from a chunk stored in the bounded buffer. It may block if
- * there are no more blocks in the buffer.
- *
- * @param b a <code>byte[]</code> value.
- * @param offset Where in <var>b</var> to save read bytes.
- * @param length How many bytes to try to read.
- * @return Number of bytes actually read, or -1 at end of file.
- * @throws IOException if an error occurs.
- */
- public int read(byte[] b, int offset, int length) throws IOException {
- checkOpen(); // Check if open
- if (offset < 0 || offset > b.length || length < 0 || (offset + length) > b.length || (offset + length) < 0) {
- throw new IllegalArgumentException("Illegal offset=" + offset + "/length=" + length
- + " for byte array of length " + b.length);
- } else if (length == 0) // Want zero?
- {
- return 0; // Then you get zero
- }
- if (eof) {
- throw new IOException("End of file"); // Already reached EOF? You lose.
- }
- fetchBlock(); // Get a block.
- if (eof) {
- return -1; // No more blocks? Signal EOF.
- }
- int amount = Math.min(length, block.length - blockIndex); // Return requested amount or whatever's left
- System.arraycopy(block, blockIndex, b, offset, amount); // Transfer
- blockIndex += amount; // Advance
- return amount; // Done
- }
-
- /**
- * Fetch another block.
- *
- * @throws IOException if an error occurs.
- */
- private void fetchBlock() throws IOException {
- if (block == null || blockIndex == block.length) {
- try { // No block, or current block exhausted?
- if (productIndex == size) { // No more blocks left to get?
- block = null; // Drop current block
- eof = true; // Signal EOF
- } else { // Otherwise there are more blocks
- int x = (int) Math.min(BLOCK_SIZE, size - productIndex); // Can only fetch so much
- block = retriever.retrieveChunk(id, productIndex, x); // Get x's worth of data
- blockIndex = 0; // Start at block's beginning
- productIndex += block.length; // Advance product index by block size
- }
- } catch (ProductException ex) {
- throw new IOException(ex.getMessage());
- }
- }
- }
-
- /**
- * Return number of bytes currently available.
- *
- * If we have a block, the amount of available bytes is whatever's in the block.
- * Otherwise we don't know how many bytes, and we could block, so say zero are available.
- *
- * @return an <code>int</code> value.
- * @throws IOException if an error occurs.
- */
- public int available() throws IOException {
- checkOpen(); // Open?
- return block == null? 0 : block.length - blockIndex; // If no current block, you can only get 0
- }
-
- public void close() throws IOException {
- checkOpen(); // Open?
- retriever.close(id); // Tell retriever we're done
- open = false; // Flag it
- }
-
- /**
- * Mark is not supported.
- *
- * @param limit Unused parameter.
- */
- public void mark(int limit) {
- throw new UnsupportedOperationException("Mark not supported");
- }
-
- /**
- * Reset is not supported.
- */
- public void reset() {
- throw new UnsupportedOperationException("Reset not supported");
- }
-
- /**
- * Mark/reset operations are not supported.
- *
- * @return False.
- */
- public boolean markSuppoted() {
- return false;
- }
-
- /**
- * Throw an exception if the stream's closed.
- *
- * @throws IOException if the stream's closed.
- */
- private void checkOpen() throws IOException {
- if (open) {
- return;
- }
- throw new IOException("Stream closed");
- }
-
- /** Product ID. */
- private String id;
-
- /** What can retrieve the product. */
- private Retriever retriever;
-
- /** How big the product is. */
- private long size;
-
- /** Current block or null if there's no current block. */
- private byte[] block;
-
- /** From where in <code>block</code> to read. */
- private int blockIndex;
-
- /** From where in the product to read the next block. */
- private long productIndex = 0L;
-
- /** True if we got to the end of file. */
- private boolean eof;
-
- /** Is the stream open? */
- private boolean open;
-
- public static final int VAL = 4096;
- /** Size of chunks. */
- private static final int BLOCK_SIZE = Integer.getInteger("org.apache.oodt.xmlquery.blockSize", VAL);
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/main/java/org/apache/oodt/xmlquery/LargeResult.java
----------------------------------------------------------------------
diff --git a/product/src/main/java/org/apache/oodt/xmlquery/LargeResult.java b/product/src/main/java/org/apache/oodt/xmlquery/LargeResult.java
deleted file mode 100644
index 316650d..0000000
--- a/product/src/main/java/org/apache/oodt/xmlquery/LargeResult.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.xmlquery;
-
-import java.util.List;
-import java.util.StringTokenizer;
-import java.io.InputStream;
-import java.io.IOException;
-
-// FIXME: change MIME type application/vnd.jpl.large-product?
-
-/**
- * A <em>large</em> result is a result for <em>large</em> products.
- *
- * What is large? Some might say large is something that exceeds most other things of
- * like kind in bulk, capacity, quantity, superficial dimensions, or number of constituent
- * units. Large might be big, great, capacious, extensive. Large might be opposed to
- * small; as, a large horse; a large house or room; a large lake or pool; a large jug or
- * spoon; a large vineyard; a large army; a large city. Some might say that particularly
- * if they're named Webster.
- *
- * @author Kelly
- * @version $Revision: 1.2 $
- */
-public class LargeResult extends Result {
- /**
- * Creates a new <code>LargeResult</code> instance.
- *
- * @param result a <code>Result</code> value.
- */
- public LargeResult(Result result) {
- super(result.getID(), "application/vnd.jpl.large-product", result.getProfileID(), result.getResourceID(),
- result.getHeaders(), transformMimeType(result));
- StringTokenizer st = new StringTokenizer((String) value);
- st.nextToken();
- this.size = Long.parseLong(st.nextToken());
- }
-
- /**
- * Creates a new <code>LargeResult</code> instance.
- *
- * @param id Result ID.
- * @param mimeType MIME type.
- * @param profileID Profile ID.
- * @param resourceID Resource ID.
- * @param headers Headers.
- * @param size Size of the product.
- */
- public LargeResult(String id, String mimeType, String profileID, String resourceID, List headers, long size) {
- super(id, "application/vnd.jpl.large-product", profileID, resourceID, headers, mimeType + " " + size);
- this.size = size;
- }
-
- /**
- * Get the size of the product.
- *
- * @return Its size.
- */
- public final long getSize() {
- return size;
- }
-
- public final String getMimeType() {
- return new StringTokenizer((String) value).nextToken();
- }
-
- /**
- * Return the result's value.
- *
- * @return a String.
- * @deprecated This method always treats its value as if it were a String. Worse,
- * for very large results, it cannot contain the entire result in memory. Use
- * {@link #getInputStream} instead to perform stream processing on result data.
- */
- public final Object getValue() {
- Object value = null;
- InputStream in = null;
- try {
- if (size > Integer.MAX_VALUE) {
- throw new IllegalStateException("Cannot use getValue() for this product, result is too large; "
- + "use LargeResult.getInputStream instead");
- }
- int sizeToRead = (int) size;
- byte[] buf = new byte[sizeToRead];
- int index = 0;
- int num;
- in = getInputStream();
- while ((num = in.read(buf, index, sizeToRead)) != -1) {
- index += num;
- sizeToRead -= num;
- if (sizeToRead == 0) {
- break;
- }
- }
-
- // OK, this sucks. Sucks sucks sucks. Look, getValue is not to
- // be used anyway. It sucks. But dammit, there's some annoying
- // code over in EDRN which is using it when they should be using
- // getInputStream. Basically, if you call this, you're a hoser.
- // And if you call it and you're not expecting a String, you're a
- // loser/hoser. DEPRECATED!
- value = new String(buf);
-
- } catch (IOException ex) {
- throw new IllegalStateException("Unexpected IOException: " + ex.getMessage());
- } finally {
- if (in != null) {
- try {
- in.close();
- } catch (IOException ignore) {
- }
- }
- }
- return value;
- }
-
- /** Size of the product. */
- private long size;
-
- /**
- * Get an input stream that streams the result from the product server.
- *
- * @return an <code>InputStream</code> value.
- * @throws IOException if an error occurs.
- */
- public InputStream getInputStream() throws IOException {
- return new ChunkedProductInputStream(id, retriever, size);
- }
-
- /**
- * Given an existing <code>Result</code> yield its MIME type.
- *
- * The existing <code>Result</code> might be a <code>LargeResult</code>, in which
- * case the real MIME type is hidden in the value. Otherwise, it's directly in
- * the object.
- *
- * @param result a <code>Result</code> value.
- * @return The MIME type.
- */
- private static String transformMimeType(Result result) {
- if ("application/vnd.jpl.large-product".equals(result.mimeType)) {
- return (String) result.value;
- } else {
- return result.mimeType + " 0";
- }
- }
-
- /** Serial version unique ID. */
- static final long serialVersionUID = -969838775595705444L;
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/site/resources/images/delegation.png
----------------------------------------------------------------------
diff --git a/product/src/site/resources/images/delegation.png b/product/src/site/resources/images/delegation.png
deleted file mode 100644
index aea86e3..0000000
Binary files a/product/src/site/resources/images/delegation.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/site/resources/images/delegation.psd
----------------------------------------------------------------------
diff --git a/product/src/site/resources/images/delegation.psd b/product/src/site/resources/images/delegation.psd
deleted file mode 100644
index 9b74dca..0000000
Binary files a/product/src/site/resources/images/delegation.psd and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/site/resources/images/grid-product.jpg
----------------------------------------------------------------------
diff --git a/product/src/site/resources/images/grid-product.jpg b/product/src/site/resources/images/grid-product.jpg
deleted file mode 100644
index 7b1126e..0000000
Binary files a/product/src/site/resources/images/grid-product.jpg and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/site/site.xml
----------------------------------------------------------------------
diff --git a/product/src/site/site.xml b/product/src/site/site.xml
deleted file mode 100644
index 0b2c94c..0000000
--- a/product/src/site/site.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more contributor
-license agreements. See the NOTICE.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 name="Product Service">
-
- <body>
- <links>
- <item name="OODT" href="../oodt-site/"/>
- <item name="Grid" href="../grid/"/>
- </links>
-
- <menu ref="reports" inherit="bottom"/>
- <menu name="User's Guide">
- <item name="Tutorials" href="tutorials/"/>
- <item name="Product Servlet" href="servlet/"/>
- </menu>
- </body>
-</project>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/site/xdoc/servlet/index.xml
----------------------------------------------------------------------
diff --git a/product/src/site/xdoc/servlet/index.xml b/product/src/site/xdoc/servlet/index.xml
deleted file mode 100644
index 22f9bd5..0000000
--- a/product/src/site/xdoc/servlet/index.xml
+++ /dev/null
@@ -1,243 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<document>
- <properties>
- <title>Using the Product Servlet</title>
- <author email="kelly@apache.org">Sean Kelly</author>
- </properties>
-
- <body>
- <section name="Using the Product Servlet">
- <p>The query servlet is nice for general purpose queries, but for
- those who just want to retrieve products, it's a bit annoying to
- have to process all that XML and do base-64 conversions. Is there
- a simpler way? Absolutely. The product servlet deals with just
- products, and delivers them in their appropriate form direct over
- HTTP.
- </p>
- </section>
- <section name="Requirements">
-
- <p>The product servlet provides HTTP access to products, so
- naturally, you'll need to use a language or system that supports
- HTTP client access to HTTP servers. Where can you find such a
- system? Your handy-dandy web browser is one! Most programming
- languages also have HTTP APIs either built-in or freely available.
- </p>
-
- <p>You also need to know</p>
-
- <ul>
- <li>The URL of the product servlet that has access to the
- product server you want to query.</li>
- <li>The object name of the product server you want to
- access.</li>
- <li>The keyword query expression that can be understood by the
- product server.</li>
- </ul>
- </section>
- <section name="Making a Query">
-
- <p>The product servlet accepts either <code>GET</code> or
- <code>POST</code> requests of URL-encoded form data. In
- response, it delivers a matching product (if any can be found)
- in the format appropriate to the product's MIME type. You can
- also request a specific MIME type. If there's no matching
- product, you get HTTP error 404 (not found).
- </p>
-
- <p>The parameters that the servlet expects are:</p>
-
- <table border="0" cellpadding="3" cellspacing="0">
-
- <thead>
- <tr>
- <th>Parameter Name</th>
- <th>Obligation</th>
- <th>Meaning</th>
- </tr>
- </thead>
-
- <tbody>
- <tr>
- <td><code>object</code></td>
- <td>Once</td>
- <td>Names the product server to receive the query. This
- parameter must be specified exactly once and takes the form
- <code>urn:eda:<var>proto</var>:<var>name</var></code>, such
- as <code>urn:eda:rmi:PDS.Atmos.Product</code> for the
- RMI-accessed Atmoshpheres node of the Planetary Data System.
- </td>
-
- </tr>
-
- <tr>
- <td><code>keywordQuery</code></td>
- <td>Once</td>
- <td>Lists the keyword query expression to pass to the
- product server, such as <code>PatientID = 19928</code> or
- <code>ONLINE_FILE_SPECIFICATION_NAME =
- data/images/mars.jpg</code>.
- </td>
-
- </tr>
-
- <tr>
- <td><code>id</code></td>
- <td>None or Once</td>
- <td>Optional parameter that identifies a single product to
- retrieve if more than one product match. A product server
- may return multiple matching products. By default, the
- product servlet returns the first matching product only. By
- specifying the <code>id</code> parameter, you can select a
- specific product when more than one match. (In practice,
- not a single product server <em>to date</em> has ever
- returned more than one match.)
- </td>
-
- </tr>
-
- <tr>
- <td><code>mimeType</code></td>
- <td>Zero to Many</td>
- <td>Optional parameter that lists acceptable MIME types for
- the product (see below).
- </td>
-
- </tr>
-
- </tbody>
- </table>
- </section>
- <section name="MIME Types">
-
- <p>Many product servers are capable of conversion of products from
- a system-specific storage medium into an Internet-standard
- interoperable format. Internet-standard MIME types are what
- drives this mechanism. The product servlet can take a list of
- specific MIME types and pass them to the product server for
- consideration in retrieving your products.
- </p>
-
- <p>MIME type conversions are like <em>suggestions</em> to product
- servers. Product servers are not obligated to honor all
- conversions, and indeed you may well receive 404 (not found) for a
- conversion that makes no sense to a particular product server
- (such as an audio clip to <code>text/html</code>).
- </p>
-
- <p>The <code>mimeType</code> parameter is what drives this
- mechanism. By specifying one or more <code>mimeType</code>
- parameters in your <code>GET</code> or <code>POST</code> request,
- you list the preferred MIME types in which you would like the
- product delivered. Furthermore, you can use wildcards to further
- enable a product server to satisfy you. The ordering of the
- parameters is significant.
- </p>
-
- <p>Here are some examples. Suppose the request URI part of the
- URL contained:</p>
-
- <pre>...mimeType=text/rtf&mimeType=text/*...</pre>
-
- <p>This specifies two MIME types:</p>
-
- <ol>
- <li><code>text/rtf</code>, the Rich Text Format, is the
- preferred format for delivering products.
- </li>
-
- <li><code>text/*</code> means any text type. Any text is better
- than no text if for some reason the product server can't give a
- Rich Text Format product.
- </li>
- </ol>
-
- <p>Here's another example:</p>
-
- <pre>...mimeType=image/png&mimeType=image/jpeg...</pre>
-
- <p>This indicates that you'd like a Portable Network Graphic
- format image, if possible, but will settle for a JPEG-JFIF format
- image. No other image format (especially not the proprietary and
- ancient GIF format) is acceptable. Adding an additional
- <code>&mimeType=image/*</code> would mean any image format
- would be fine. Adding <code>&mimeType=*/*</code> means
- <em>any format</em> would be acceptable, be it audio, video, text,
- image, or otherwise.
- </p>
-
- <p>If there are <em>no</em> <code>mimeType</code> parameters, then
- the product servlet uses a default list containing just
- <code>*/*</code>, meaning any type is fine.
- </p>
- </section>
- <section name="Example">
-
- <p>To retrieve an image of Mars from the PDS product server at the
- Imaging Node, in PNG format if possible and any image format
- otherwise, try the following:
- </p>
-
- <p><code><a
- href="http://starbrite.jpl.nasa.gov/prod?mimeType=image/png&mimeType=image/*&object=urn:eda:rmi:PDS.Img.Product&keywordQuery=ONLINE_FILE_SPECIFICATION_NAME+%3D+thumbnail/mgs-m-moc-na_wa-2-sdp-l0-v1.0/mgsc_1082/m09063/m0906352.imq.jpg">http://starbrite.jpl.nasa.gov/prod?<br/>mimeType=image/png&<br/>mimeType=image/*&<br/>object=urn:eda:rmi:PDS.Img.Product&<br/>keywordQuery=OFSN+%3D+thumbnail/mgs-m-moc-na_wa-2-sdp-l0-v1.0/mgsc_1082/m09063/m0906352.imq.jpg</a></code></p>
-
- <p>This URL contains linebreaks for readability only. Let's take
- this URL apart to see what's going on:
- </p>
-
- <ul>
- <li>The URL to the product servlet in this case is
- <code>http://starbrite.jpl.nasa.gov/prod</code>. Often the URL
- will take this form, or may be
- <code>http://<var>hostname</var>/servlet/jpl.oodt.servlets.ProductServlet</code>.
- Most people prefer the shorter form.
- </li>
-
- <li>The question mark <code>?</code> separates the request URI
- from its parameters.
- </li>
-
- <li>The first parameter, <code>mimeType=image/png</code>, says
- that Portable Network Graphics images are preferred.
- </li>
-
- <li>The second parameter, <code>mimeType=image/*</code>, says
- that if the product server can't convert to or other provide
- Portable Network Graphics format images, then <em>any image
- format</em> is acceptable.
- </li>
-
- <li>The third parameter,
- <code>object=urn:eda:rmi:PDS.Img.Product</code>, identifies the
- product server.
- </li>
-
- <li>The fourth parameter, <code>keywordQuery=...</code> names
- the query expression. In this case, it's <code>OFSN =
- thumbnail/mgs-m-moc-na_wa-2-sdp-l0-v1.0/mgsc_1082/m09063/m0906352.imq.jpg</code>.
- </li>
- </ul>
-
- <p>The response to this URL's GET request is a JPEG-JFIF image
- (sorry, PNG's not yet available from the PDS Image Node)
- containing a picture of some planetary surface. Neat, huh?
- </p>
- </section>
- </body>
-</document>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/product/src/site/xdoc/tutorials/index.xml
----------------------------------------------------------------------
diff --git a/product/src/site/xdoc/tutorials/index.xml b/product/src/site/xdoc/tutorials/index.xml
deleted file mode 100755
index e130ea9..0000000
--- a/product/src/site/xdoc/tutorials/index.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<document>
- <properties>
- <title>Product Service Tutorials</title>
- <author email="Sean.Kelly@jpl.nasa.gov">Sean Kelly</author>
- </properties>
-
- <body>
- <section name="Product Service Tutorials">
- <p>The following tutorials are available:</p>
- <ul>
- <li><a href="./ps">Your First Product Service</a></li>
- <li><a href="./qh">Developing a Query Handler</a></li>
- <li><a href="./lh">Serving Large Products</a></li>
- </ul>
- </section>
- </body>
-</document>
-
-
[40/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/profile/classes/LDAPAuthenticationProvider.class.php
----------------------------------------------------------------------
diff --git a/balance/modules/profile/classes/LDAPAuthenticationProvider.class.php b/balance/modules/profile/classes/LDAPAuthenticationProvider.class.php
deleted file mode 100644
index ca69159..0000000
--- a/balance/modules/profile/classes/LDAPAuthenticationProvider.class.php
+++ /dev/null
@@ -1,263 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * LDAPAuthenticationProvider
- *
- * This class provides an extension of the OODT Security 'Single-sign on'
- * functionality that complies with the contract specified in the OODT Balance
- * ApplicationAuthenticationProvider interface.
- *
- * For more information on the functions available here, consult either the
- * OODT Security package or the Balance ApplicationAuthenticationProvider
- * interface documentation.
- *
- * Note: This class has a dependency on the OODT CAS-SSO package
- * (http://oodt.jpl.nasa.gov/repo/framework/cas-sso/trunk/src/php/pear)
- *
- * To build this dependency, check out the above project and then:
- * 1) cd into the checked out project (you should see a package.xml file)
- * 2) pear package
- * 3) (sudo) pear install --force Gov_Nasa_Jpl...tar.gz
- *
- * @author s.khudikyan
- * @author ahart
- *
- */
-
-require("Org/Apache/Oodt/Security/SingleSignOn.php");
-
-class LDAPAuthenticationProvider
- extends Org_Apache_Oodt_Security_SingleSignOn
- implements Org_Apache_Oodt_Balance_Interfaces_IApplicationAuthenticationProvider {
-
- // The LDAP server name
- protected $ldapHost;
-
- // The port on which the LDAP server listens
- protected $ldapPort;
-
-
- /**
- * Constructor
- */
- public function __construct() {
-
- // set LDAP constants
- define("CAS_SECURITY",true);
- define("SSO_LDAP_HOST", App::Get()->settings['ldap_host']);
- define("SSO_LDAP_PORT", App::Get()->settings['ldap_port']);
- define("SSO_BASE_DN", App::Get()->settings['ldap_base_dn']);
- define("SSO_GROUPS_DN", App::Get()->settings['ldap_group_dn']);
- define("SSO_COOKIE_KEY", App::Get()->settings['cookie_key']);
-
- $this->ldapHost = SSO_LDAP_HOST;
- $this->ldapPort = SSO_LDAP_PORT;
- }
-
- /**
- * Connect to the LDAP server
- */
- public function connect() {
- return parent::connect($this->ldapHost,$this->ldapPort);
- }
-
- /**
- * Disconnect from the LDAP server
- */
- public function disconnect() {
- ldap_close($this->conn);
- }
-
- /**
- * Determine whether or not a user has authenticated
- *
- * @return boolean Whether or not the current user has authenticated
- */
- public function isLoggedIn() {
- return parent::isLoggedIn();
- }
-
- /**
- * Process a user login
- *
- * @param string $username The provided username
- * @param string $password The provided password
- */
- public function login( $username, $password ) {
- return parent::login( $username, $password );
- }
-
- /**
- * End an authenticated user's session
- */
- public function logout() {
- parent::logout();
- }
-
- /**
- * Return the unique username of the currently authenticated user
- */
- public function getCurrentUsername() {
- return parent::getCurrentUsername();
- }
-
- /**
- * Process a password change request for the currently authenticated
- * user
- *
- * @param string $newPassword The new password to associate with the user
- */
- public function changePassword( $newPassword ) {
- if ( App::Get()->settings['auth_encryption_method'] ) {
- return parent::changePassword( $newPassword, App::Get()->settings['auth_encryption_method'] );
- }
- return parent::changePassword( $newPassword );
- }
-
- /**
- * Attempt to validate a candidate value for new user password
- *
- * @param string $newPass The candidate password value
- * @param string $encryptionMethod The encryption method to use
- */
- public function validateChangePassword( $newPass, $encryptionMethod = "SHA" ) {
- $isValid = true;
- $messages = array();
- // validate rules from config file
- $rules = App::Get()->settings['security_password_rules'];
-
- if ( isset($rules) ) {
- foreach( $rules as $rule ){
-
- // Separate the rule from the error message
- list($regularExpression,$errorMessage) = explode('|',$rule,2);
-
- // Test the rule
- $rulePassed = preg_match($regularExpression, $newPass);
-
- // If the rule failed, append the error message
- if (!$rulePassed) {
- $messages[] = $errorMessage;
- $isValid = false;
- }
- }
- }
-
- if ($isValid && $this->connect(SSO_LDAP_HOST,SSO_LDAP_PORT)) {
- $result = $this->changePassword($newPass,$encryptionMethod);
- return true;
- } else
- return $messages;
- }
-
- /**
- * Obtain detailed information about the specified user.
- *
- * This function accepts both a username and an array of attributes
- * corresponding to the variables in the LDAP user record for which
- * values should be returned.
- *
- * @param string $username The username to obtain information for
- * @param array $attributes The set of variables to return values for
- */
- public function retrieveUserAttributes( $username, $attributes ) {
- $rawArray = parent::retrieveUserAttributes( $username, $attributes );
- $userAttributes = array();
-
- if ( count($rawArray) > 1 ) {
- $rawArray = $rawArray[0];
- // Get only necessary attributes to return
- foreach ( $rawArray as $key=>$keyValue ) {
- foreach ( $attributes as $value ) {
- if ( $key === $value ) {
- $userAttributes[$key] = $keyValue[0];
- }
- }
- }
- }
- return $userAttributes;
- }
-
- /**
- * Add a user record to the LDAP directory
- *
- * This function accepts an associative array of information about
- * a user. The keys in this array correspond to the named variables
- * in the user object in the LDAP directory. At a minimum, this
- * array must contain a key 'uid' which must be unique across users
- * so that a proper dn can be generated for the new user.
- *
- * @param array $userInfo The information to include in the record
- */
- public function addUser($userInfo) {
- $ldapconn = $this->connect(SSO_LDAP_HOST,SSO_LDAP_PORT);
- if ($ldapconn) {
- $user = "uid={$userInfo[ "uid" ]}," . SSO_BASE_DN;
- return ldap_add($ldapconn,$user,$userInfo);
- }
- // connection failed
- return false;
- }
-
- /**
- * Determine if the specified username is available
- *
- * This function uses the value of the config setting 'username_attr' when
- * determining which key in the LDAP user record to use as the username
- * attribute.
- *
- * @param string $username The username to test for availability
- */
- public function usernameAvailability( $username ) {
- $justthese = array( App::Get()->settings['username_attr'] );
- $profile = $this->retrieveUserAttributes($username, $justthese);
- if (count($profile) > 0) {
- return false;
- } else {
- // available
- return true;
- }
- }
-
- /**
- * Update an existing user profile with new information
- *
- * This function accepts an associative array containing named key/value
- * pairs. The keys in this array correspond to the named variables
- * in the user object in the LDAP directory. The function can only update
- * the record for the currently authenticated user.
- *
- * @param array $newInfo The updated information for the user's profile
- */
- public function updateProfile($newInfo) {
-
- if ($this->isLoggedIn()) {
- $user = "uid={$this->getCurrentUsername()}," . SSO_BASE_DN ;
- $ldapconn = $this->connect(SSO_LDAP_HOST,SSO_LDAP_PORT);
-
- if (ldap_mod_replace($ldapconn,$user,$newInfo)) {
- return true;
- } else {
- return false;
- }
- } else {
- return false;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/profile/classes/LDAPAuthorizationProvider.class.php
----------------------------------------------------------------------
diff --git a/balance/modules/profile/classes/LDAPAuthorizationProvider.class.php b/balance/modules/profile/classes/LDAPAuthorizationProvider.class.php
deleted file mode 100644
index 1ac95fb..0000000
--- a/balance/modules/profile/classes/LDAPAuthorizationProvider.class.php
+++ /dev/null
@@ -1,113 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * LDAPAuthorizationProvider
- *
- * This class provides an implementation of the OODT Balance Application
- * Authorization Provider interface that makes use of the Lightweight
- * Directory Access Protocol (LDAP).
- *
- * For more information on the functions available here, consult the
- * OODT Balance ApplicationAuthenticationProvider interface documentation.
- *
- * @author s.khudikyan
- * @author ahart
- *
- */
-
-class LDAPAuthorizationProvider
- implements Org_Apache_Oodt_Balance_Interfaces_IApplicationAuthorizationProvider {
-
-
- // The LDAP server name
- protected $ldapHost;
-
- // The port on which the LDAP server listens
- protected $ldapPort;
-
- /**
- * Constructor
- */
- public function __construct() {
-
- // Set LDAP constants
- define("AUTH_BASE_DN", App::Get()->settings['authorization_ldap_base_dn']);
- define("AUTH_GROUPS_DN", App::Get()->settings['authorization_ldap_group_dn']);
- define("AUTH_LDAP_HOST", App::Get()->settings['authorization_ldap_host']);
- define("AUTH_LDAP_PORT", App::Get()->settings['authorization_ldap_port']);
-
- $this->ldapHost = AUTH_LDAP_HOST;
- $this->ldapPort = AUTH_LDAP_PORT;
- }
-
- /**
- * Obtain the groups/roles for the current username
- *
- * This function searches {$searchDirectory} for groupOfUniqueName objects whose
- * uniqueMember attribute contains {$username}. The cn attribute of all matching
- * groups is returned as a numeric array.
- *
- * @param string $username The username to test for. Note that just the username
- * portion should be specified, as both 'uid=' and AUTH_BASE_DN
- * are added to the value before searching.
- * @param string $searchDirectory The fully qualified DN (e.g.: ou=system,ou=groups)
- * of the LDAP directory in which to search for groups
- */
- public function retrieveGroupsForUser($username,$searchDirectory = AUTH_GROUPS_DN) {
-
- // attempt to connect to ldap server
- $ldapconn = $this->connect(AUTH_LDAP_HOST,AUTH_LDAP_PORT);
- $groups = array();
- if ($ldapconn) {
- $filter = "(&(objectClass=groupOfUniqueNames)"
- ."(uniqueMember=uid={$username}," . AUTH_BASE_DN . "))";
- $result = ldap_search($ldapconn,$searchDirectory,$filter,array('cn'));
-
- if ($result) {
- $entries = ldap_get_entries($ldapconn,$result);
- foreach ($entries as $rawGroup) {
- if (isset($rawGroup['cn'][0])
- && $rawGroup['cn'][0] != '') {
- $groups[] = $rawGroup['cn'][0];
- }
- }
- }
- }
- return $groups;
- }
-
- /**
- * Connect to the LDAP server
- */
- public function connect() {
- if ($conn = ldap_connect($this->ldapHost,$this->ldapPort)) {
-
- // Connection established
- $this->connectionStatus = 1;
- ldap_set_option($conn, LDAP_OPT_PROTOCOL_VERSION, 3);
- ldap_set_option($conn, LDAP_OPT_DEBUG_LEVEL, 7);
- ldap_set_option($conn, LDAP_OPT_REFERRALS, 0);
- $this->conn = $conn;
- return $conn;
- } else {
- // Connection failed
- return false;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/profile/classes/NullAuthenticationProvider.class.php
----------------------------------------------------------------------
diff --git a/balance/modules/profile/classes/NullAuthenticationProvider.class.php b/balance/modules/profile/classes/NullAuthenticationProvider.class.php
deleted file mode 100644
index 6449d10..0000000
--- a/balance/modules/profile/classes/NullAuthenticationProvider.class.php
+++ /dev/null
@@ -1,96 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * NullAuthenticationProvider
- *
- * An implementation of the iApplicationAuthenticationProvider interface with
- * no external dependencies (and also limited functionality) intended to be used
- * as a development tool for quickly testing and debugging applications without
- * having to set up detailed auth&auth dependencies.
- *
- * This class utilizes the PHP Session construct for storing a provided username.
- * Any username / password combination is treated as valid.
- *
- */
-class Org_Apache_Oodt_Balance_Providers_Authentication_NullAuthenticationProvider
- implements Org_Apache_Oodt_Balance_Interfaces_IApplicationAuthenticationProvider {
-
- public function __construct() {}
-
- public function connect() {
- return true;
- }
-
- public function disconnect() {
- return true;
- }
-
- public function isLoggedIn() {
- return isset($_SESSION['_auth']);
- }
-
- public function login( $username, $password ) {
- $_SESSION['_auth'] = array(
- 'username' => $username
- );
- }
-
- public function logout() {
- unset($_SESSION['_auth']);
- }
-
- public function getCurrentUsername() {
- return ($this->isLoggedIn())
- ? $_SESSION['_auth']['username']
- : false;
- }
-
- public function changePassword( $newPassword ) {
- return true;
- }
-
- public function validateChangePassword( $newPass, $encryptionMethod = "SHA" ) {
- return true;
- }
-
- public function retrieveUserAttributes( $username, $attributes ) {
- return ($this->isLoggedIn())
- ? array(
- "cn" => $this->getCurrentUsername(),
- "givenname" => $this->getCurrentUsername(),
- "sn" => '',
- "uid" => $this->getCurrentUsername(),
- "mail" => 'guest@example.org'
- )
- : false;
- }
-
- public function addUser($userInfo) {
- return false;
- }
-
- public function usernameAvailability( $username ) {
- return false;
- }
-
- public function updateProfile($newInfo) {
- return false;
-
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/profile/classes/NullAuthorizationProvider.class.php
----------------------------------------------------------------------
diff --git a/balance/modules/profile/classes/NullAuthorizationProvider.class.php b/balance/modules/profile/classes/NullAuthorizationProvider.class.php
deleted file mode 100644
index 3f4a220..0000000
--- a/balance/modules/profile/classes/NullAuthorizationProvider.class.php
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * NullAuthorizationProvider
- *
- * An implementation of the iApplicationAuthorizationProvider interface with
- * no external dependencies (and also limited functionality) intended to be used
- * as a development tool for quickly testing and debugging applications without
- * having to set up detailed auth&auth dependencies.
- *
- * This class simply returns an empty array for all usernames, indicating that
- * the user is not part of any groups/roles.
- *
- */
-class Org_Apache_Oodt_Balance_Providers_Authorization_NullAuthorizationProvider
-implements Org_Apache_Oodt_Balance_Interfaces_IApplicationAuthorizationProvider {
-
- public function __construct() {
-
- }
-
- public function retrieveGroupsForUser($username) {
- return array();
- }
-
- public function connect() {
- return true;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/profile/config.ini
----------------------------------------------------------------------
diff --git a/balance/modules/profile/config.ini b/balance/modules/profile/config.ini
deleted file mode 100644
index 5e5e24d..0000000
--- a/balance/modules/profile/config.ini
+++ /dev/null
@@ -1,180 +0,0 @@
- ; Licensed to the Apache Software Foundation (ASF) under one or more
- ; contributor license agreements. See the NOTICE file distributed with
- ; this work for additional information regarding copyright ownership.
- ; The ASF licenses this file to You under the Apache License, Version 2.0
- ; (the "License"); you may not use this file except in compliance with
- ; the License. You may obtain a copy of the License at
- ;
- ; http://www.apache.org/licenses/LICENSE-2.0
- ;
- ; Unless required by applicable law or agreed to in writing, software
- ; distributed under the License is distributed on an "AS IS" BASIS,
- ; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ; See the License for the specific language governing permissions and
- ; limitations under the License.
-
-
-; Profile module configuration file
-; ---------------------------------------------------------------------------
-;
-; The Profile module simplifies the process of managing users of your web
-; application. The primary use case for this module involves authentication
-; and authorization using LDAP, although it should be possible to support
-; additional back-ends with moderate customization.
-;
-
-
-; ***************************************************************************
-; PROFILE AUTHENTICATION SETTINGS
-; ***************************************************************************
-;
-; Responsibility for authentication is delegated to the class specified here.
-; The only requirement of the delegated class is that it implement the
-; Org_Apache_Oodt_Balance_Interfaces_IApplicationAuthenticationProvider
-; interface.
-;
-; The following settings define both the class name (authentication_class) and
-; the filesystem path to the class itself (authentication_class_path). Both
-; are required for authentication to function.
-;
-; Tip: When specifying the authentication_class_path, the token [MODULE_PATH]
-; will be expanded to the root directory of this module (i.e.: the location of
-; this file)
-;
-; If authentication is not required, both of these settings should be left
-; blank.
-;
-authentication_class = LDAPAuthenticationProvider
-authentication_class_path = [MODULE_PATH]/classes/LDAPAuthenticationProvider.class.php
-
-
-; LDAP authentication server connection details
-ldap_host = "host"
-ldap_port = 686
-ldap_base_dn = "dc=people,dc=project"
-cookie_key = "__ac__sc__"
-
-
-; Encryption method used to encrypt user passwords
-; Supported options are:
-; 1. SHA
-; 2. MD5
-auth_encryption_method = SHA
-
-
-; ***************************************************************************
-; PROFILE AUTHORIZATION SETTINGS
-; ***************************************************************************
-;
-; Responsibility for authorization is delegated to the class specified here.
-; The only requirement of the delegated class is that it implement the
-; Org_Apache_Oodt_Balance_Interfaces_IApplicationAuthorizationProvider
-; interface.
-;
-; The following settings define both the class name (authorization_class) and
-; the filesystem path to the class itself (authorization_class_path). Both
-; are required for authentication to function.
-;
-; Tip: When specifying the authorization_class_path, the token [MODULE_PATH]
-; will be expanded to the root directory of this module (i.e.: the location
-; of this file)
-;
-; If authorization is not required, both of these settings should be left
-; blank.
-;
-authorization_class = LDAPAuthorizationProvider
-authorization_class_path = [MODULE_PATH]/classes/LDAPAuthorizationProvider.class.php
-
-
-; LDAP authorization filter details
-authorization_ldap_filter = '&(objectClass=groupOfUniqueNames)'
-authorization_ldap_filter_userid = 'uniqueMember=uid'
-
-; LDAP authorization server connection details
-authorization_ldap_host = 'host'
-authorization_ldap_port = 686
-authorization_ldap_base_dn = 'dc=people,dc=project'
-authorization_ldap_group_dn = 'dc=group,dc=project'
-authorization_cookie_key = '__ac__sc__'
-
-; Page to redirect users to when authorization is required
-authorization_redirect_url = [MODULE_ROOT]/login
-
-
-
-; ***************************************************************************
-; PROFILE ATTRIBUTE SETTINGS
-; ***************************************************************************
-; User profiles consist of various attributes (name, telephone, email, etc.).
-; This section defines the attributes that the profile will expose.
-
-; Attribute Mapping
-; The profile module natively understands the following profile attributes,
-; which are widely applicable across projects. This section defines a mapping
-; between these profile attributes and your specific environment.
-;
-; commonname_attr: The common name of the user (usually first and last name)
-commonname_attr = cn
-; firstname_attr: The first (given) name of the user
-firstname_attr = givenname
-; lastname_attr: The last (surname) name of the user
-lastname_attr = sn
-; username_attr: The unique id/name of the user
-username_attr = uid
-; email_attr: The email address of the user
-email_attr = mail
-
-; Visible Attributes
-; The profile module will expose the profile attributes specified here.
-; These attributes will be displayed for the user to view.
-;
-; Specify the profile attributes to expose here:
-profile_attributes[] = givenname
-profile_attributes[] = sn
-profile_attributes[] = uid
-profile_attributes[] = mail
-
-; Attributes allowed to modify
-; The profile module will expose the profile attributes specified here.
-; These attributes will be displayed for the user to view and the user
-; will be allowed to change values in the ldap directory.
-;
-; Specify the profile attributes to modify here:
-profile_modify_attributes[] = givenname
-profile_modify_attributes[] = sn
-profile_modify_attributes[] = mail
-
-; When displaying the attributes specified above, a human readable label can
-; be defined. This will help users better understand which values they are
-; seeing and/or modifying.
-;
-; Specify an attribute-to-label mapping for each of the above attributes here:
-attr_titles[ 'First name' ] = givenname
-attr_titles[ 'Last name' ] = sn
-attr_titles[ 'Username' ] = uid
-attr_titles[ 'Email' ] = mail
-
-
-; ***************************************************************************
-; PASSWORD VALIDATION SETTINGS
-; ***************************************************************************
-; In the event that there are requirements that define a valid password, they
-; can be specified here as an array of 'tests'. These tests will be invoked
-; whenever the user attempts to set / change his or her password.
-;
-; The general format of these rules is a regular expression followed by a
-; pipe (|) followed by the human-readable exception to display when a password
-; fails to validate.
-;
-; EXAMPLES:
-; - To require passwords with length of 5 or greater:
-; security_password_rules[] = "/.{5,}/|Password must have a length of 5 or greater"
-; - To enfoce the presence of at least one uppercase letter
-; security_password_rules[] = "/[A-Z]+/|Password must contain at least one uppercase letter"
-;
-; The security rules will be enforced in series, and processing will halt
-; after the first failure.
-;
-security_password_rules[] =
-
-
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/profile/hooks.php
----------------------------------------------------------------------
diff --git a/balance/modules/profile/hooks.php b/balance/modules/profile/hooks.php
deleted file mode 100644
index ac66c81..0000000
--- a/balance/modules/profile/hooks.php
+++ /dev/null
@@ -1,91 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * HOOKS.PHP
- *
- * Hooks provide the ability, as the name implies, to hook into various parts of
- * the view rendering process and insert customizations. The contents of these
- * functions are run at the appropriate time *EVERY* time a view is rendered, i.e.
- * the content of the hooks is not by default view-specific but rather will be
- * applied to all views. (However, there is nothing that prevents developers from
- * inserting conditional logic inside a hook that then causes view-specific
- * them to exhibit view-specific behavior).
- *
- * As an example, consider a hook that adds the amount of time Balance took to render
- * the page as an inline HTML comment at the bottom of each page after it has been sent:
- *
- * function hook_after_send() {
- * $timeStart = $GLOBALS['balance_request_start'];
- * $timeNow = microtime(true);
- * $elapsed = $timeNow - $timeStart;
- * echo "<!-- page rendered in {$elapsed} seconds -->";
- * }
- *
- *
- * Take a look at the docblock descriptions of each hook to get a sense of where
- * in the view rendering process the hook is invoked.
- *
- */
-
-/**
- * hook_before_header
- *
- * This hook is executed before the contents of the header file are processed.
- */
-function hook_before_header() {}
-
-/**
- * hook_before_view
- *
- * This hook is executed before the contents of the main view are processed.
- */
-function hook_before_view() {
- $module = App::Get()->loadModule();
- App::Get()->response->addStylesheet($module->moduleStatic.'/css/profile.css');
-}
-
-/**
- * hook_before_footer
- *
- * This hook is executed before the contents of the footer are processed
- */
-function hook_before_footer() {}
-
-/**
- * hook_before_send
- *
- * This hook is after all of the view components (header, view, footer) have been
- * processed but before the processed results are sent out across the wire to the
- * browser. HTTP headers have not yet been sent to the browser.
- */
-function hook_before_send() {}
-
-/**
- * hook_after_send
- *
- * This hook is after all of the view components (header, view, footer) have been
- * processed and sent out across the wire to the browser. It can be used for logging
- * or analytics purposes, or to append a common trailer to all content.
- */
-function hook_after_send() {
- $timeStart = $GLOBALS['balance_request_start'];
- $timeEnd = microtime(true);
- $elapsed = $timeEnd - $timeStart;
-
- echo "\r\n<!-- page rendered in {$elapsed} seconds -->";
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/profile/scripts/access.php
----------------------------------------------------------------------
diff --git a/balance/modules/profile/scripts/access.php b/balance/modules/profile/scripts/access.php
deleted file mode 100644
index 3167409..0000000
--- a/balance/modules/profile/scripts/access.php
+++ /dev/null
@@ -1,107 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * PROFILE MANAGER - CREATE USER
- *
- * Create new user, required attributes:
- *
- * 1. First name
- * 2. Last name
- * 3. Username
- * 4. Email
- *
- * - password
- * - confirm password
- *
- * @author s.khudikyan
-**/
-$module = App::Get()->loadModule();
-$allSet = true;
-
-
-if ( isset($_POST["firstname"]) && $_POST["firstname"] != "" ) {
- $info[ App::Get()->settings['firstname_attr'] ] = $_POST["firstname"];
-} else {
- // first name is required
- App::Get()->SetMessage("First name cannot be blank",CAS_MSG_ERROR);
- $allSet = FALSE;
-}
-
-if ( isset($_POST["lastname"]) && $_POST["lastname"] != "" ) {
- $info[ App::Get()->settings['lastname_attr'] ] = $_POST["lastname"];
-} else {
- // last name is required
- App::Get()->SetMessage("Last name cannot be blank",CAS_MSG_ERROR);
- $allSet = FALSE;
-}
-
-if ( isset($_POST["username"]) && $_POST["username"] != "" ) {
-
- // check username availability
- $isAvailable = App::Get()->getAuthenticationProvider()->usernameAvailability($_POST["username"]);
- if ( $isAvailable ) {
- $info[ App::Get()->settings['username_attr'] ] = $_POST["username"];
- } else{
- App::Get()->SetMessage("Username has been taken",CAS_MSG_ERROR);
- $allSet = FALSE;
- }
-} else {
- // username is required
- App::Get()->SetMessage("Username cannot be blank",CAS_MSG_ERROR);
- $allSet = FALSE;
-}
-
-if ( isset($_POST["email"]) && $_POST["email"] != "") {
- $info[ App::Get()->settings['email_attr'] ] = $_POST["email"];
-} else {
- // email is required
- App::Get()->SetMessage("Email cannot be blank",CAS_MSG_ERROR);
- $allSet = FALSE;
-}
-
-if ( !isset($_POST["password_confirm"]) || $_POST["password_confirm"] == "" ) {
-
- // password confirm is required
- App::Get()->SetMessage("Password cannot be blank and must match",CAS_MSG_ERROR);
- $allSet = FALSE;
-} elseif ( (isset($_POST["password"]) || $_POST["password"] != "") &&
- ( $_POST["password"] == $_POST["password_confirm"] ) ) {
-
- $info['userPassword'] = $_POST["password"];
-} else {
-
- // password is required and must match
- App::Get()->SetMessage("Password cannot be blank and must match",CAS_MSG_ERROR);
- $allSet = FALSE;
-}
-
-if ($allSet) {
-
- $info[ App::Get()->settings['commonname_attr'] ] = $_POST["firstname"] . " " . $_POST["lastname"];
- $info[ "objectClass" ] = "inetOrgPerson";
- if ( App::Get()->getAuthenticationProvider()->addUser($info) ) {
-
- App::Get()->Redirect($module->moduleRoot . "/login" ); // add account successful
- } else {
- App::Get()->setMessage("Could not add user.",CAS_MSG_ERROR);
- }
-} else {
-
- App::Get()->Redirect($module->moduleRoot . "/createUser" );
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/profile/scripts/changePwd.php
----------------------------------------------------------------------
diff --git a/balance/modules/profile/scripts/changePwd.php b/balance/modules/profile/scripts/changePwd.php
deleted file mode 100644
index 140c189..0000000
--- a/balance/modules/profile/scripts/changePwd.php
+++ /dev/null
@@ -1,69 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * PROFILE MANAGER - PASSWORD CHANGE
- *
- * Attempt to change password. This script uses config file to
- * check for password restrictions.
- *
- * @author s.khudikyan
-**/
-$module = App::Get()->loadModule();
-
-// Get instance of authentication class
-$authentication = App::Get()->getAuthenticationProvider();
-
-
-if ( !isset($_POST["password_confirm"]) || $_POST["password_confirm"] == "" ) {
-
- // password confirm is required
- App::Get()->SetMessage("Please confirm password.",CAS_MSG_ERROR);
- App::Get()->Redirect($module->moduleRoot . "/changePwd" );
-
-} elseif ( (isset($_POST["password"]) || $_POST["password"] != "") &&
- ( $_POST["password"] == $_POST["password_confirm"] ) ) {
-
- $message = $authentication->validateChangePassword( $_POST["password"] );
-
- if( is_array($message) ) {
-
- foreach ($message as $value) {
- App::Get()->setMessage($value,CAS_MSG_ERROR);
- }
-
- App::Get()->Redirect($module->moduleRoot . "/changePwd" );
- } else{
-
- // Log the user out
- $authentication->logout();
-
- // End user session
- App::Get()->EndUserSession();
-
- // Redirect to confirmation page
- App::Get()->Redirect($module->moduleRoot . "/passwordChangeConfirmed" ); // password change successful
-
- }
- } else {
-
- // password is required and must match
- App::Get()->SetMessage("Password cannot be blank and must match",CAS_MSG_ERROR);
- App::Get()->Redirect($module->moduleRoot . "/changePwd" );
- }
-
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/profile/scripts/login.php
----------------------------------------------------------------------
diff --git a/balance/modules/profile/scripts/login.php b/balance/modules/profile/scripts/login.php
deleted file mode 100644
index fc6fd43..0000000
--- a/balance/modules/profile/scripts/login.php
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * PROFILE MANAGER - LOGIN
- *
- * Attempt to login.
- *
- * @author s.khudikyan
-**/
-$module = App::Get()->loadModule();
-
-// Get instance of authentication class
-$authentication = App::Get()->getAuthenticationProvider();
-
-$message = '';
-
-// If a user is already logged in, redirect to home page
-if( $authentication->isLoggedIn() ) App::Get()->Redirect(SITE_ROOT . "/");
-
-// Otherwise, if a user is attempting to log in, process:
-else if(isset($_POST["username"]) && isset($_POST["password"])) {
-
- // Check the provided login credentials:
- if($authentication->login($_POST["username"], $_POST["password"])){
- App::Get()->Redirect(SITE_ROOT . "/" ); // login successful
- } else {
- App::Get()->SetMessage("Invalid Credentials Provided",CAS_MSG_ERROR);
- App::Get()->Redirect($module->moduleRoot . "/login");
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/profile/scripts/logout.php
----------------------------------------------------------------------
diff --git a/balance/modules/profile/scripts/logout.php b/balance/modules/profile/scripts/logout.php
deleted file mode 100644
index 59ccce3..0000000
--- a/balance/modules/profile/scripts/logout.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * PROFILE MANAGER - LOGOUT
- *
- * End an authenticated user session
- *
- * @author ahart
- * @author davoodi
- * @author s.khudikyan
-**/
-
-// Log the user out
-App::Get()->getAuthenticationProvider()->logout();
-
-// End user session
-App::Get()->EndUserSession();
-
-// Redirect to the home page
-App::Get()->Redirect(SITE_ROOT . "/");
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/profile/scripts/manage.php
----------------------------------------------------------------------
diff --git a/balance/modules/profile/scripts/manage.php b/balance/modules/profile/scripts/manage.php
deleted file mode 100644
index 0615ec6..0000000
--- a/balance/modules/profile/scripts/manage.php
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * PROFILE MANAGER - MANAGE USER PROFILE
- *
- * Process user's changes to profile information.
- *
- * @author s.khudikyan
-**/
-$module = App::Get()->loadModule();
-$allSet = true;
-
-foreach ($_POST as $key=>$value) {
-
- if ( $key != submit_button) {
- if ( isset($value) && $value != "" ) {
- $info[$key] = $value;
- } else {
- // set error message
- App::Get()->SetMessage(
- array_search( $key, App::Get()->settings['attr_titles'] )
- . " cannot be left blank.", CAS_MSG_ERROR );
- $allSet = false;
- }
- }
-}
-
-if ($allSet) {
- // method to edit user
- if( App::Get()->getAuthenticationProvider()->updateProfile($info) ){
-
- // user info change successful
- App::Get()->Redirect($module->moduleRoot . "/" );
- } else{
-
- // if not logged in - cannot change pwd
- App::Get()->SetMessage("Invalid entry",CAS_MSG_ERROR);
- App::Get()->Redirect($module->moduleRoot . "/manage" );
- }
-} else {
-
- App::Get()->Redirect($module->moduleRoot . "/manage" );
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/profile/scripts/widgets/UserStatusWidget.php
----------------------------------------------------------------------
diff --git a/balance/modules/profile/scripts/widgets/UserStatusWidget.php b/balance/modules/profile/scripts/widgets/UserStatusWidget.php
deleted file mode 100644
index 8c9dd27..0000000
--- a/balance/modules/profile/scripts/widgets/UserStatusWidget.php
+++ /dev/null
@@ -1,91 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * PROFILE MANAGER - User Status Display
- *
- * This widget displays basic information about the user. It provides a link
- * to log in when user is logged out and displays username with a log-out link
- * when user is logged in.
- *
- * This widget also allows the developer to decide whether or not the users will
- * have access to manage their account through the Profile Manager interface.
- *
- * @author s.khudikyan
- *
- */
-
-class UserStatusWidget
- implements Org_Apache_Oodt_Balance_Interfaces_IApplicationWidget {
-
- public $isLoggedIn;
- public $username;
- public $profileLink;
- protected $moduleName;
-
- /**
- * Pass boolean true or false as the first parameter in the options array
- * to generate either a login link or a logout link, whichever is appropriate.
- * True: user is logged in, show logout link
- * False: user is not logged in, show login link
- *
- * Pass username as the second paramerter in the options array
- *
- * Pass boolean true or false as the third parameter in the options array
- * to generate the username as a link to the porfile module.
- * True: link will be created- *Default*
- * False: link will not be created
- *
- * Pass module name as the fourth paramerter in the options array. This way
- * the developer has the option to name the module anything.
- * Default: 'profile'
- */
- public function __construct($options = array()) {
- $this->isLoggedIn = ( isset($options[0]) && $options[0] === true );
- $this->username = ( isset($options[1]) ) ? $options[1] : false;
- $this->profileLink = ( isset($options[2]) ) ? $options[2] : true;
- $this->moduleName = ( isset($options[3]) ) ? $options[3] : 'profile';
- }
-
- public function render($bEcho = true) {
-
- $str = '';
- $module = App::Get()->loadModule($this->moduleName);
-
- // Display the appropriate information about the user
- if($this->isLoggedIn) {
- $str .= "Logged in as ";
- if ($this->profileLink) {
- $str .= '<a href="' . $module->moduleRoot . '/">' . $this->username . '</a> | '
- .'<a href="' . $module->moduleRoot . '/logout.do">Log Out</a>';
- } else {
- $str .= $this->username . ' | '
- .'<a href="' . $module->moduleRoot . '/logout.do">Log Out</a>';
- }
- } else {
- $str .= '<a href="' . $module->moduleRoot . '/login">Log In</a>';
- }
-
- if($bEcho) {
- echo $str;
- } else {
- return $str;
- }
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/profile/static/css/profile.css
----------------------------------------------------------------------
diff --git a/balance/modules/profile/static/css/profile.css b/balance/modules/profile/static/css/profile.css
deleted file mode 100644
index 5ee73df..0000000
--- a/balance/modules/profile/static/css/profile.css
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * PROFILE MANAGER STYLESHEET
- *
- * PAGE ELEMENTS
- *
- */
-fieldset {
-}
-
-label.invalid {
- color:#BF1B02;
- font:1em georgia;
- margin:0 0 2px;
-}
-
-.profile_input {
- height:23px;
- width:200px;
-}
-
-/**
- * DIV.USERDETAILS
- * This provides information about the login-status of the user.
- *
- * top and color can be changed depending on portal
- */
-#userdetails {
- position:absolute;
- top:105px;
- right:15px;
- z-index:10;
-}
-#userdetails a {
- font-size:13px;
-}
-
-/* Unsupported browsers */
-
-.orange_rbcontent { padding: 0.4em; }
-.orange_rbroundbox { width: 100%; }
-
-#unsupported {
- font-weight: bold;
- text-align: left;
-}
-
-/* Signup form */
-
-#signupform table {
- border-spacing: 0;
- border-collapse: collapse;
- empty-cells: show;
-}
-
-#signupform .label {
- padding-top: 2px;
- padding-right: 8px;
- vertical-align: top;
- text-align: right;
- width: 125px;
- white-space: nowrap;
-}
-
-#signupform .field {
- padding-bottom: 10px;
- white-space: nowrap;
-}
-
-#signupform .status {
- padding-top: 2px;
- padding-left: 8px;
- vertical-align: top;
- width: 246px;
- white-space: nowrap;
-}
-
-#signupform .textfield {
- width: 150px;
-}
-
-#signupform .error, .notice, .success {
- padding:0.25em;
- margin-bottom:0.5em 0;
- background-color:#FFFFFF;
- border:1px solid #BBBBBB;
-}
-
-#signupform label.error {
- background:none;
- padding-left: 16px;
- padding-bottom: 2px;
- font-weight: bold;
- color: #EA5200;
- border:none;
-}
-
-#signupform label.checked /*{
- background:none;
-}
-
-#signupform .success_msg {
- font-weight: bold;
- color: #0060BF;
- margin-left: 19px;
-}
-
-#signupform #dateformatStatus, #signupform #termsStatus {
- margin-left: 6px;
-}
-
-#signupform #termswrap {
- float: left;
-}
-
-#signupform #terms {
- vertical-align: middle;
- float: left;
- display: block;
- margin-right: 5px;
-}
-
-#signupform #lterms {
- font-weight: normal;
- vertical-align: middle;
- float: left;
- display: block;
- width: 350px;
- white-space: normal;
-}
-
-#signupform #lsignupsubmit {
- visibility: hidden;
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/profile/static/js/additional-methods.js
----------------------------------------------------------------------
diff --git a/balance/modules/profile/static/js/additional-methods.js b/balance/modules/profile/static/js/additional-methods.js
deleted file mode 100644
index db3ad14..0000000
--- a/balance/modules/profile/static/js/additional-methods.js
+++ /dev/null
@@ -1,259 +0,0 @@
-(function() {
-
- function stripHtml(value) {
- // remove html tags and space chars
- return value.replace(/<.[^<>]*?>/g, ' ').replace(/ | /gi, ' ')
- // remove numbers and punctuation
- .replace(/[0-9.(),;:!?%#$'"_+=\/-]*/g,'');
- }
- jQuery.validator.addMethod("maxWords", function(value, element, params) {
- return this.optional(element) || stripHtml(value).match(/\b\w+\b/g).length < params;
- }, jQuery.validator.format("Please enter {0} words or less."));
-
- jQuery.validator.addMethod("minWords", function(value, element, params) {
- return this.optional(element) || stripHtml(value).match(/\b\w+\b/g).length >= params;
- }, jQuery.validator.format("Please enter at least {0} words."));
-
- jQuery.validator.addMethod("rangeWords", function(value, element, params) {
- return this.optional(element) || stripHtml(value).match(/\b\w+\b/g).length >= params[0] && value.match(/bw+b/g).length < params[1];
- }, jQuery.validator.format("Please enter between {0} and {1} words."));
-
-})();
-
-jQuery.validator.addMethod("letterswithbasicpunc", function(value, element) {
- return this.optional(element) || /^[a-z-.,()'\"\s]+$/i.test(value);
-}, "Letters or punctuation only please");
-
-jQuery.validator.addMethod("alphanumeric", function(value, element) {
- return this.optional(element) || /^\w+$/i.test(value);
-}, "Letters, numbers, spaces or underscores only please");
-
-jQuery.validator.addMethod("lettersonly", function(value, element) {
- return this.optional(element) || /^[a-z]+$/i.test(value);
-}, "Letters only please");
-
-jQuery.validator.addMethod("nowhitespace", function(value, element) {
- return this.optional(element) || /^\S+$/i.test(value);
-}, "No white space please");
-
-jQuery.validator.addMethod("ziprange", function(value, element) {
- return this.optional(element) || /^90[2-5]\d\{2}-\d{4}$/.test(value);
-}, "Your ZIP-code must be in the range 902xx-xxxx to 905-xx-xxxx");
-
-jQuery.validator.addMethod("integer", function(value, element) {
- return this.optional(element) || /^-?\d+$/.test(value);
-}, "A positive or negative non-decimal number please");
-
-/**
-* Return true, if the value is a valid vehicle identification number (VIN).
-*
-* Works with all kind of text inputs.
-*
-* @example <input type="text" size="20" name="VehicleID" class="{required:true,vinUS:true}" />
-* @desc Declares a required input element whose value must be a valid vehicle identification number.
-*
-* @name jQuery.validator.methods.vinUS
-* @type Boolean
-* @cat Plugins/Validate/Methods
-*/
-jQuery.validator.addMethod(
- "vinUS",
- function(v){
- if (v.length != 17)
- return false;
- var i, n, d, f, cd, cdv;
- var LL = ["A","B","C","D","E","F","G","H","J","K","L","M","N","P","R","S","T","U","V","W","X","Y","Z"];
- var VL = [1,2,3,4,5,6,7,8,1,2,3,4,5,7,9,2,3,4,5,6,7,8,9];
- var FL = [8,7,6,5,4,3,2,10,0,9,8,7,6,5,4,3,2];
- var rs = 0;
- for(i = 0; i < 17; i++){
- f = FL[i];
- d = v.slice(i,i+1);
- if(i == 8){
- cdv = d;
- }
- if(!isNaN(d)){
- d *= f;
- }
- else{
- for(n = 0; n < LL.length; n++){
- if(d.toUpperCase() === LL[n]){
- d = VL[n];
- d *= f;
- if(isNaN(cdv) && n == 8){
- cdv = LL[n];
- }
- break;
- }
- }
- }
- rs += d;
- }
- cd = rs % 11;
- if(cd == 10){cd = "X";}
- if(cd == cdv){return true;}
- return false;
- },
- "The specified vehicle identification number (VIN) is invalid."
-);
-
-/**
- * Return true, if the value is a valid date, also making this formal check dd/mm/yyyy.
- *
- * @example jQuery.validator.methods.date("01/01/1900")
- * @result true
- *
- * @example jQuery.validator.methods.date("01/13/1990")
- * @result false
- *
- * @example jQuery.validator.methods.date("01.01.1900")
- * @result false
- *
- * @example <input name="pippo" class="{dateITA:true}" />
- * @desc Declares an optional input element whose value must be a valid date.
- *
- * @name jQuery.validator.methods.dateITA
- * @type Boolean
- * @cat Plugins/Validate/Methods
- */
-jQuery.validator.addMethod(
- "dateITA",
- function(value, element) {
- var check = false;
- var re = /^\d{1,2}\/\d{1,2}\/\d{4}$/;
- if( re.test(value)){
- var adata = value.split('/');
- var gg = parseInt(adata[0],10);
- var mm = parseInt(adata[1],10);
- var aaaa = parseInt(adata[2],10);
- var xdata = new Date(aaaa,mm-1,gg);
- if ( ( xdata.getFullYear() == aaaa ) && ( xdata.getMonth () == mm - 1 ) && ( xdata.getDate() == gg ) )
- check = true;
- else
- check = false;
- } else
- check = false;
- return this.optional(element) || check;
- },
- "Please enter a correct date"
-);
-
-jQuery.validator.addMethod("dateNL", function(value, element) {
- return this.optional(element) || /^\d\d?[\.\/-]\d\d?[\.\/-]\d\d\d?\d?$/.test(value);
- }, "Vul hier een geldige datum in."
-);
-
-jQuery.validator.addMethod("time", function(value, element) {
- return this.optional(element) || /^([01][0-9])|(2[0123]):([0-5])([0-9])$/.test(value);
- }, "Please enter a valid time, between 00:00 and 23:59"
-);
-
-/**
- * matches US phone number format
- *
- * where the area code may not start with 1 and the prefix may not start with 1
- * allows '-' or ' ' as a separator and allows parens around area code
- * some people may want to put a '1' in front of their number
- *
- * 1(212)-999-2345
- * or
- * 212 999 2344
- * or
- * 212-999-0983
- *
- * but not
- * 111-123-5434
- * and not
- * 212 123 4567
- */
-jQuery.validator.addMethod("phoneUS", function(phone_number, element) {
- phone_number = phone_number.replace(/\s+/g, "");
- return this.optional(element) || phone_number.length > 9 &&
- phone_number.match(/^(1-?)?(\([2-9]\d{2}\)|[2-9]\d{2})-?[2-9]\d{2}-?\d{4}$/);
-}, "Please specify a valid phone number");
-
-jQuery.validator.addMethod('phoneUK', function(phone_number, element) {
-return this.optional(element) || phone_number.length > 9 &&
-phone_number.match(/^(\(?(0|\+44)[1-9]{1}\d{1,4}?\)?\s?\d{3,4}\s?\d{3,4})$/);
-}, 'Please specify a valid phone number');
-
-jQuery.validator.addMethod('mobileUK', function(phone_number, element) {
-return this.optional(element) || phone_number.length > 9 &&
-phone_number.match(/^((0|\+44)7(5|6|7|8|9){1}\d{2}\s?\d{6})$/);
-}, 'Please specify a valid mobile number');
-
-// TODO check if value starts with <, otherwise don't try stripping anything
-jQuery.validator.addMethod("strippedminlength", function(value, element, param) {
- return jQuery(value).text().length >= param;
-}, jQuery.validator.format("Please enter at least {0} characters"));
-
-// same as email, but TLD is optional
-jQuery.validator.addMethod("email2", function(value, element, param) {
- return this.optional(element) || /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);
-}, jQuery.validator.messages.email);
-
-// same as url, but TLD is optional
-jQuery.validator.addMethod("url2", function(value, element, param) {
- return this.optional(element) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_
|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);
-}, jQuery.validator.messages.url);
-
-// NOTICE: Modified version of Castle.Components.Validator.CreditCardValidator
-// Redistributed under the the Apache License 2.0 at http://www.apache.org/licenses/LICENSE-2.0
-// Valid Types: mastercard, visa, amex, dinersclub, enroute, discover, jcb, unknown, all (overrides all other settings)
-jQuery.validator.addMethod("creditcardtypes", function(value, element, param) {
-
- if (/[^0-9-]+/.test(value))
- return false;
-
- value = value.replace(/\D/g, "");
-
- var validTypes = 0x0000;
-
- if (param.mastercard)
- validTypes |= 0x0001;
- if (param.visa)
- validTypes |= 0x0002;
- if (param.amex)
- validTypes |= 0x0004;
- if (param.dinersclub)
- validTypes |= 0x0008;
- if (param.enroute)
- validTypes |= 0x0010;
- if (param.discover)
- validTypes |= 0x0020;
- if (param.jcb)
- validTypes |= 0x0040;
- if (param.unknown)
- validTypes |= 0x0080;
- if (param.all)
- validTypes = 0x0001 | 0x0002 | 0x0004 | 0x0008 | 0x0010 | 0x0020 | 0x0040 | 0x0080;
-
- if (validTypes & 0x0001 && /^(51|52|53|54|55)/.test(value)) { //mastercard
- return value.length == 16;
- }
- if (validTypes & 0x0002 && /^(4)/.test(value)) { //visa
- return value.length == 16;
- }
- if (validTypes & 0x0004 && /^(34|37)/.test(value)) { //amex
- return value.length == 15;
- }
- if (validTypes & 0x0008 && /^(300|301|302|303|304|305|36|38)/.test(value)) { //dinersclub
- return value.length == 14;
- }
- if (validTypes & 0x0010 && /^(2014|2149)/.test(value)) { //enroute
- return value.length == 15;
- }
- if (validTypes & 0x0020 && /^(6011)/.test(value)) { //discover
- return value.length == 16;
- }
- if (validTypes & 0x0040 && /^(3)/.test(value)) { //jcb
- return value.length == 16;
- }
- if (validTypes & 0x0040 && /^(2131|1800)/.test(value)) { //jcb
- return value.length == 15;
- }
- if (validTypes & 0x0080) { //unknown
- return true;
- }
- return false;
-}, "Please enter a valid credit card number.");
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/profile/static/js/jquery.validate.min.js
----------------------------------------------------------------------
diff --git a/balance/modules/profile/static/js/jquery.validate.min.js b/balance/modules/profile/static/js/jquery.validate.min.js
deleted file mode 100644
index 6264866..0000000
--- a/balance/modules/profile/static/js/jquery.validate.min.js
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * jQuery validation plug-in 1.7
- *
- * http://bassistance.de/jquery-plugins/jquery-plugin-validation/
- * http://docs.jquery.com/Plugins/Validation
- *
- * Copyright (c) 2006 - 2008 Jörn Zaefferer
- *
- * $Id: jquery.validate.js 6403 2009-06-17 14:27:16Z joern.zaefferer $
- *
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
- */
-(function($){$.extend($.fn,{validate:function(options){if(!this.length){options&&options.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing");return;}var validator=$.data(this[0],'validator');if(validator){return validator;}validator=new $.validator(options,this[0]);$.data(this[0],'validator',validator);if(validator.settings.onsubmit){this.find("input, button").filter(".cancel").click(function(){validator.cancelSubmit=true;});if(validator.settings.submitHandler){this.find("input, button").filter(":submit").click(function(){validator.submitButton=this;});}this.submit(function(event){if(validator.settings.debug)event.preventDefault();function handle(){if(validator.settings.submitHandler){if(validator.submitButton){var hidden=$("<input type='hidden'/>").attr("name",validator.submitButton.name).val(validator.submitButton.value).appendTo(validator.currentForm);}validator.settings.submitHandler.call(validator,validator.currentForm);if(validator.submit
Button){hidden.remove();}return false;}return true;}if(validator.cancelSubmit){validator.cancelSubmit=false;return handle();}if(validator.form()){if(validator.pendingRequest){validator.formSubmitted=true;return false;}return handle();}else{validator.focusInvalid();return false;}});}return validator;},valid:function(){if($(this[0]).is('form')){return this.validate().form();}else{var valid=true;var validator=$(this[0].form).validate();this.each(function(){valid&=validator.element(this);});return valid;}},removeAttrs:function(attributes){var result={},$element=this;$.each(attributes.split(/\s/),function(index,value){result[value]=$element.attr(value);$element.removeAttr(value);});return result;},rules:function(command,argument){var element=this[0];if(command){var settings=$.data(element.form,'validator').settings;var staticRules=settings.rules;var existingRules=$.validator.staticRules(element);switch(command){case"add":$.extend(existingRules,$.validator.normalizeRule(argument));staticR
ules[element.name]=existingRules;if(argument.messages)settings.messages[element.name]=$.extend(settings.messages[element.name],argument.messages);break;case"remove":if(!argument){delete staticRules[element.name];return existingRules;}var filtered={};$.each(argument.split(/\s/),function(index,method){filtered[method]=existingRules[method];delete existingRules[method];});return filtered;}}var data=$.validator.normalizeRules($.extend({},$.validator.metadataRules(element),$.validator.classRules(element),$.validator.attributeRules(element),$.validator.staticRules(element)),element);if(data.required){var param=data.required;delete data.required;data=$.extend({required:param},data);}return data;}});$.extend($.expr[":"],{blank:function(a){return!$.trim(""+a.value);},filled:function(a){return!!$.trim(""+a.value);},unchecked:function(a){return!a.checked;}});$.validator=function(options,form){this.settings=$.extend(true,{},$.validator.defaults,options);this.currentForm=form;this.init();};$.val
idator.format=function(source,params){if(arguments.length==1)return function(){var args=$.makeArray(arguments);args.unshift(source);return $.validator.format.apply(this,args);};if(arguments.length>2&¶ms.constructor!=Array){params=$.makeArray(arguments).slice(1);}if(params.constructor!=Array){params=[params];}$.each(params,function(i,n){source=source.replace(new RegExp("\\{"+i+"\\}","g"),n);});return source;};$.extend($.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:true,errorContainer:$([]),errorLabelContainer:$([]),onsubmit:true,ignore:[],ignoreTitle:false,onfocusin:function(element){this.lastActive=element;if(this.settings.focusCleanup&&!this.blockFocusCleanup){this.settings.unhighlight&&this.settings.unhighlight.call(this,element,this.settings.errorClass,this.settings.validClass);this.errorsFor(element).hide();}},onfocusout:function(element){if(!this.checkable(element)&&(element.name in this.submitte
d||!this.optional(element))){this.element(element);}},onkeyup:function(element){if(element.name in this.submitted||element==this.lastElement){this.element(element);}},onclick:function(element){if(element.name in this.submitted)this.element(element);else if(element.parentNode.name in this.submitted)this.element(element.parentNode);},highlight:function(element,errorClass,validClass){$(element).addClass(errorClass).removeClass(validClass);},unhighlight:function(element,errorClass,validClass){$(element).removeClass(errorClass).addClass(validClass);}},setDefaults:function(settings){$.extend($.validator.defaults,settings);},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Pleas
e enter the same value again.",accept:"Please enter a value with a valid extension.",maxlength:$.validator.format("Please enter no more than {0} characters."),minlength:$.validator.format("Please enter at least {0} characters."),rangelength:$.validator.format("Please enter a value between {0} and {1} characters long."),range:$.validator.format("Please enter a value between {0} and {1}."),max:$.validator.format("Please enter a value less than or equal to {0}."),min:$.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:false,prototype:{init:function(){this.labelContainer=$(this.settings.errorLabelContainer);this.errorContext=this.labelContainer.length&&this.labelContainer||$(this.currentForm);this.containers=$(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();var groups=(this.groups={});$.each(this.settings.groups,function(key,
value){$.each(value.split(/\s/),function(index,name){groups[name]=key;});});var rules=this.settings.rules;$.each(rules,function(key,value){rules[key]=$.validator.normalizeRule(value);});function delegate(event){var validator=$.data(this[0].form,"validator"),eventType="on"+event.type.replace(/^validate/,"");validator.settings[eventType]&&validator.settings[eventType].call(validator,this[0]);}$(this.currentForm).validateDelegate(":text, :password, :file, select, textarea","focusin focusout keyup",delegate).validateDelegate(":radio, :checkbox, select, option","click",delegate);if(this.settings.invalidHandler)$(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler);},form:function(){this.checkForm();$.extend(this.submitted,this.errorMap);this.invalid=$.extend({},this.errorMap);if(!this.valid())$(this.currentForm).triggerHandler("invalid-form",[this]);this.showErrors();return this.valid();},checkForm:function(){this.prepareForm();for(var i=0,elements=(this.currentEl
ements=this.elements());elements[i];i++){this.check(elements[i]);}return this.valid();},element:function(element){element=this.clean(element);this.lastElement=element;this.prepareElement(element);this.currentElements=$(element);var result=this.check(element);if(result){delete this.invalid[element.name];}else{this.invalid[element.name]=true;}if(!this.numberOfInvalids()){this.toHide=this.toHide.add(this.containers);}this.showErrors();return result;},showErrors:function(errors){if(errors){$.extend(this.errorMap,errors);this.errorList=[];for(var name in errors){this.errorList.push({message:errors[name],element:this.findByName(name)[0]});}this.successList=$.grep(this.successList,function(element){return!(element.name in errors);});}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors();},resetForm:function(){if($.fn.resetForm)$(this.currentForm).resetForm();this.submitted={};this.prepareForm();this.hideErrors();this.elements().r
emoveClass(this.settings.errorClass);},numberOfInvalids:function(){return this.objectLength(this.invalid);},objectLength:function(obj){var count=0;for(var i in obj)count++;return count;},hideErrors:function(){this.addWrapper(this.toHide).hide();},valid:function(){return this.size()==0;},size:function(){return this.errorList.length;},focusInvalid:function(){if(this.settings.focusInvalid){try{$(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin");}catch(e){}}},findLastActive:function(){var lastActive=this.lastActive;return lastActive&&$.grep(this.errorList,function(n){return n.element.name==lastActive.name;}).length==1&&lastActive;},elements:function(){var validator=this,rulesCache={};return $([]).add(this.currentForm.elements).filter(":input").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){!this.name&&validator.settings.debug&&window.console&&console.error("%o has no name ass
igned",this);if(this.name in rulesCache||!validator.objectLength($(this).rules()))return false;rulesCache[this.name]=true;return true;});},clean:function(selector){return $(selector)[0];},errors:function(){return $(this.settings.errorElement+"."+this.settings.errorClass,this.errorContext);},reset:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=$([]);this.toHide=$([]);this.currentElements=$([]);},prepareForm:function(){this.reset();this.toHide=this.errors().add(this.containers);},prepareElement:function(element){this.reset();this.toHide=this.errorsFor(element);},check:function(element){element=this.clean(element);if(this.checkable(element)){element=this.findByName(element.name)[0];}var rules=$(element).rules();var dependencyMismatch=false;for(method in rules){var rule={method:method,parameters:rules[method]};try{var result=$.validator.methods[method].call(this,element.value.replace(/\r/g,""),element,rule.parameters);if(result=="dependency-mismatch"){depe
ndencyMismatch=true;continue;}dependencyMismatch=false;if(result=="pending"){this.toHide=this.toHide.not(this.errorsFor(element));return;}if(!result){this.formatAndAdd(element,rule);return false;}}catch(e){this.settings.debug&&window.console&&console.log("exception occured when checking element "+element.id
-+", check the '"+rule.method+"' method",e);throw e;}}if(dependencyMismatch)return;if(this.objectLength(rules))this.successList.push(element);return true;},customMetaMessage:function(element,method){if(!$.metadata)return;var meta=this.settings.meta?$(element).metadata()[this.settings.meta]:$(element).metadata();return meta&&meta.messages&&meta.messages[method];},customMessage:function(name,method){var m=this.settings.messages[name];return m&&(m.constructor==String?m:m[method]);},findDefined:function(){for(var i=0;i<arguments.length;i++){if(arguments[i]!==undefined)return arguments[i];}return undefined;},defaultMessage:function(element,method){return this.findDefined(this.customMessage(element.name,method),this.customMetaMessage(element,method),!this.settings.ignoreTitle&&element.title||undefined,$.validator.messages[method],"<strong>Warning: No message defined for "+element.name+"</strong>");},formatAndAdd:function(element,rule){var message=this.defaultMessage(element,rule.method),th
eregex=/\$?\{(\d+)\}/g;if(typeof message=="function"){message=message.call(this,rule.parameters,element);}else if(theregex.test(message)){message=jQuery.format(message.replace(theregex,'{$1}'),rule.parameters);}this.errorList.push({message:message,element:element});this.errorMap[element.name]=message;this.submitted[element.name]=message;},addWrapper:function(toToggle){if(this.settings.wrapper)toToggle=toToggle.add(toToggle.parent(this.settings.wrapper));return toToggle;},defaultShowErrors:function(){for(var i=0;this.errorList[i];i++){var error=this.errorList[i];this.settings.highlight&&this.settings.highlight.call(this,error.element,this.settings.errorClass,this.settings.validClass);this.showLabel(error.element,error.message);}if(this.errorList.length){this.toShow=this.toShow.add(this.containers);}if(this.settings.success){for(var i=0;this.successList[i];i++){this.showLabel(this.successList[i]);}}if(this.settings.unhighlight){for(var i=0,elements=this.validElements();elements[i];i++
){this.settings.unhighlight.call(this,elements[i],this.settings.errorClass,this.settings.validClass);}}this.toHide=this.toHide.not(this.toShow);this.hideErrors();this.addWrapper(this.toShow).show();},validElements:function(){return this.currentElements.not(this.invalidElements());},invalidElements:function(){return $(this.errorList).map(function(){return this.element;});},showLabel:function(element,message){var label=this.errorsFor(element);if(label.length){label.removeClass().addClass(this.settings.errorClass);label.attr("generated")&&label.html(message);}else{label=$("<"+this.settings.errorElement+"/>").attr({"for":this.idOrName(element),generated:true}).addClass(this.settings.errorClass).html(message||"");if(this.settings.wrapper){label=label.hide().show().wrap("<"+this.settings.wrapper+"/>").parent();}if(!this.labelContainer.append(label).length)this.settings.errorPlacement?this.settings.errorPlacement(label,$(element)):label.insertAfter(element);}if(!message&&this.settings.succ
ess){label.text("");typeof this.settings.success=="string"?label.addClass(this.settings.success):this.settings.success(label);}this.toShow=this.toShow.add(label);},errorsFor:function(element){var name=this.idOrName(element);return this.errors().filter(function(){return $(this).attr('for')==name;});},idOrName:function(element){return this.groups[element.name]||(this.checkable(element)?element.name:element.id||element.name);},checkable:function(element){return/radio|checkbox/i.test(element.type);},findByName:function(name){var form=this.currentForm;return $(document.getElementsByName(name)).map(function(index,element){return element.form==form&&element.name==name&&element||null;});},getLength:function(value,element){switch(element.nodeName.toLowerCase()){case'select':return $("option:selected",element).length;case'input':if(this.checkable(element))return this.findByName(element.name).filter(':checked').length;}return value.length;},depend:function(param,element){return this.dependType
s[typeof param]?this.dependTypes[typeof param](param,element):true;},dependTypes:{"boolean":function(param,element){return param;},"string":function(param,element){return!!$(param,element.form).length;},"function":function(param,element){return param(element);}},optional:function(element){return!$.validator.methods.required.call(this,$.trim(element.value),element)&&"dependency-mismatch";},startRequest:function(element){if(!this.pending[element.name]){this.pendingRequest++;this.pending[element.name]=true;}},stopRequest:function(element,valid){this.pendingRequest--;if(this.pendingRequest<0)this.pendingRequest=0;delete this.pending[element.name];if(valid&&this.pendingRequest==0&&this.formSubmitted&&this.form()){$(this.currentForm).submit();this.formSubmitted=false;}else if(!valid&&this.pendingRequest==0&&this.formSubmitted){$(this.currentForm).triggerHandler("invalid-form",[this]);this.formSubmitted=false;}},previousValue:function(element){return $.data(element,"previousValue")||$.data
(element,"previousValue",{old:null,valid:true,message:this.defaultMessage(element,"remote")});}},classRuleSettings:{required:{required:true},email:{email:true},url:{url:true},date:{date:true},dateISO:{dateISO:true},dateDE:{dateDE:true},number:{number:true},numberDE:{numberDE:true},digits:{digits:true},creditcard:{creditcard:true}},addClassRules:function(className,rules){className.constructor==String?this.classRuleSettings[className]=rules:$.extend(this.classRuleSettings,className);},classRules:function(element){var rules={};var classes=$(element).attr('class');classes&&$.each(classes.split(' '),function(){if(this in $.validator.classRuleSettings){$.extend(rules,$.validator.classRuleSettings[this]);}});return rules;},attributeRules:function(element){var rules={};var $element=$(element);for(method in $.validator.methods){var value=$element.attr(method);if(value){rules[method]=value;}}if(rules.maxlength&&/-1|2147483647|524288/.test(rules.maxlength)){delete rules.maxlength;}return rules
;},metadataRules:function(element){if(!$.metadata)return{};var meta=$.data(element.form,'validator').settings.meta;return meta?$(element).metadata()[meta]:$(element).metadata();},staticRules:function(element){var rules={};var validator=$.data(element.form,'validator');if(validator.settings.rules){rules=$.validator.normalizeRule(validator.settings.rules[element.name])||{};}return rules;},normalizeRules:function(rules,element){$.each(rules,function(prop,val){if(val===false){delete rules[prop];return;}if(val.param||val.depends){var keepRule=true;switch(typeof val.depends){case"string":keepRule=!!$(val.depends,element.form).length;break;case"function":keepRule=val.depends.call(element,element);break;}if(keepRule){rules[prop]=val.param!==undefined?val.param:true;}else{delete rules[prop];}}});$.each(rules,function(rule,parameter){rules[rule]=$.isFunction(parameter)?parameter(element):parameter;});$.each(['minlength','maxlength','min','max'],function(){if(rules[this]){rules[this]=Number(ru
les[this]);}});$.each(['rangelength','range'],function(){if(rules[this]){rules[this]=[Number(rules[this][0]),Number(rules[this][1])];}});if($.validator.autoCreateRanges){if(rules.min&&rules.max){rules.range=[rules.min,rules.max];delete rules.min;delete rules.max;}if(rules.minlength&&rules.maxlength){rules.rangelength=[rules.minlength,rules.maxlength];delete rules.minlength;delete rules.maxlength;}}if(rules.messages){delete rules.messages;}return rules;},normalizeRule:function(data){if(typeof data=="string"){var transformed={};$.each(data.split(/\s/),function(){transformed[this]=true;});data=transformed;}return data;},addMethod:function(name,method,message){$.validator.methods[name]=method;$.validator.messages[name]=message!=undefined?message:$.validator.messages[name];if(method.length<3){$.validator.addClassRules(name,$.validator.normalizeRule(name));}},methods:{required:function(value,element,param){if(!this.depend(param,element))return"dependency-mismatch";switch(element.nodeName.
toLowerCase()){case'select':var val=$(element).val();return val&&val.length>0;case'input':if(this.checkable(element))return this.getLength(value,element)>0;default:return $.trim(value).length>0;}},remote:function(value,element,param){if(this.optional(element))return"dependency-mismatch";var previous=this.previousValue(element);if(!this.settings.messages[element.name])this.settings.messages[element.name]={};previous.originalMessage=this.settings.messages[element.name].remote;this.settings.messages[element.name].remote=previous.message;param=typeof param=="string"&&{url:param}||param;if(previous.old!==value){previous.old=value;var validator=this;this.startRequest(element);var data={};data[element.name]=value;$.ajax($.extend(true,{url:param,mode:"abort",port:"validate"+element.name,dataType:"json",data:data,success:function(response){validator.settings.messages[element.name].remote=previous.originalMessage;var valid=response===true;if(valid){var submitted=validator.formSubmitted;valida
tor.prepareElement(element);validator.formSubmitted=submitted;validator.successList.push(element);validator.showErrors();}else{var errors={};var message=(previous.message=response||validator.defaultMessage(element,"remote"));errors[element.name]=$.isFunction(message)?message(value):message;validator.showErrors(errors);}previous.valid=valid;validator.stopRequest(element,valid);}},param));return"pending";}else if(this.pending[element.name]){return"pending";}return previous.valid;},minlength:function(value,element,param){return this.optional(element)||this.getLength($.trim(value),element)>=param;},maxlength:function(value,element,param){return this.optional(element)||this.getLength($.trim(value),element)<=param;},rangelength:function(value,element,param){var length=this.getLength($.trim(value),element);return this.optional(element)||(length>=param[0]&&length<=param[1]);},min:function(value,element,param){return this.optional(element)||value>=param;},max:function(value,element,param){re
turn this.optional(element)||value<=param;},range:function(value,element,param){return this.optional(element)||(value>=param[0]&&value<=param[1]);},email:function(value,element){return this.optional(element)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]
)([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);},url:function(value,element){return this.optional(element)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]
{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);},date:function(value,element){return this.optional(element)||!/Invalid|NaN/.test(new Date(value));},dateISO:function(value,element){return this.optional(element)||/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(value);},number:function(value,element){return this.optional(element)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(value);},digits:function(value,element){return this.optional(element)||/^\d+$/.test(value);},creditcard:function(value,element){if(this.optional(element))return"dependency-mismatch";if(/[^0-9-]+/.test(value))return false;var nCheck=0,nDigit=0,bEven=false;value=value.replace(/
\D/g,"");for(var n=value.length-1;n>=0;n--){var cDigit=value.charAt(n);var nDigit=parseInt(cDigit,10);if(bEven){if((nDigit*=2)>9)nDigit-=9;}nCheck+=nDigit;bEven=!bEven;}return(nCheck%10)==0;},accept:function(value,element,param){param=typeof param=="string"?param.replace(/,/g,'|'):"png|jpe?g|gif";return this.optional(element)||value.match(new RegExp(".("+param+")$","i"));},equalTo:function(value,element,param){var target=$(param).unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){$(element).valid();});return value==target.val();}}});$.format=$.validator.format;})(jQuery);;(function($){var ajax=$.ajax;var pendingRequests={};$.ajax=function(settings){settings=$.extend(settings,$.extend({},$.ajaxSettings,settings));var port=settings.port;if(settings.mode=="abort"){if(pendingRequests[port]){pendingRequests[port].abort();}return(pendingRequests[port]=ajax.apply(this,arguments));}return ajax.apply(this,arguments);};})(jQuery);;(function($){if(!jQuery.event.special.focusin
&&!jQuery.event.special.focusout&&document.addEventListener){$.each({focus:'focusin',blur:'focusout'},function(original,fix){$.event.special[fix]={setup:function(){this.addEventListener(original,handler,true);},teardown:function(){this.removeEventListener(original,handler,true);},handler:function(e){arguments[0]=$.event.fix(e);arguments[0].type=fix;return $.event.handle.apply(this,arguments);}};function handler(e){e=$.event.fix(e);e.type=fix;return $.event.handle.call(this,e);}});};$.extend($.fn,{validateDelegate:function(delegate,type,handler){return this.bind(type,function(event){var target=$(event.target);if(target.is(delegate)){return handler.apply(target,arguments);}});}});})(jQuery);
\ No newline at end of file
[23/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/opendapps/src/main/java/org/apache/oodt/opendapps/OpendapProfileElementExtractor.java
----------------------------------------------------------------------
diff --git a/opendapps/src/main/java/org/apache/oodt/opendapps/OpendapProfileElementExtractor.java b/opendapps/src/main/java/org/apache/oodt/opendapps/OpendapProfileElementExtractor.java
deleted file mode 100644
index 04f5089..0000000
--- a/opendapps/src/main/java/org/apache/oodt/opendapps/OpendapProfileElementExtractor.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.opendapps;
-
-//OODT imports
-import org.apache.oodt.opendapps.config.OpendapConfig;
-import org.apache.oodt.profile.EnumeratedProfileElement;
-import org.apache.oodt.profile.Profile;
-import org.apache.oodt.profile.RangedProfileElement;
-
-//JDK imports
-import java.util.Arrays;
-import java.util.Enumeration;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-//OPeNDAP/THREDDS imports
-import opendap.dap.Attribute;
-import opendap.dap.AttributeTable;
-import opendap.dap.DAS;
-import opendap.dap.NoSuchAttributeException;
-
-import static org.apache.oodt.opendapps.DapNames.*;
-
-/**
- *
- *
- * This class is used to set custom functionality for scraping data into
- * different types of objects. The class looks at the {@link OpendapConfig} and
- * then tries to stuff what's in each <var> into
- * {@link RangedProfileElement} or {@link EnumeratedProfileElement}. The class
- * is designed with extensibility in mind in case new {@link org.apache.oodt.profile.ProfileElement}
- * types are created in the future.
- *
- */
-public class OpendapProfileElementExtractor {
-
- private static final Logger LOG = Logger
- .getLogger(OpendapProfileElementExtractor.class.getName());
-
- private OpendapConfig conf;
-
- public OpendapProfileElementExtractor(OpendapConfig conf) {
- this.conf = conf;
- }
-
- public RangedProfileElement extractRangedProfileElement(String elemName, String varname,
- Profile profile, DAS das) throws NoSuchAttributeException {
- RangedProfileElement elem = new RangedProfileElement(profile);
- elem.setName(elemName);
- AttributeTable attTable;
- try {
- attTable = das.getAttributeTable(varname);
-
- // make variable names case insensitive
- if(attTable == null) {
- attTable = das.getAttributeTable(varname.toLowerCase());
- }
- if(attTable == null) {
- attTable = das.getAttributeTable(varname.toUpperCase());
- }
- if(attTable == null) {
- throw new NoSuchAttributeException("Att table for [" + varname + "] is null!");
- }
- } catch (NoSuchAttributeException e) {
- LOG.log(Level.SEVERE, e.getMessage());
- LOG.log(Level.WARNING, "Error extracting attribute table for element: ["
- + elemName + "]: Message: " + e.getMessage());
- throw e;
-
- }
-
- Enumeration attributeNames = attTable.getNames();
-
- while (attributeNames.hasMoreElements()) {
- String attrName = (String) attributeNames.nextElement();
- Attribute attr = attTable.getAttribute(attrName);
-
- if (!attr.isContainer()) {
- Enumeration attrValues;
-
- try {
- attrValues = attr.getValues();
- } catch (NoSuchAttributeException e) {
- LOG.log(Level.SEVERE, e.getMessage());
- LOG.log(Level.WARNING, "Attempt to resolve attribute: [" + attrName
- + "] failed: Message: " + e.getMessage());
- continue;
- }
-
- while (attrValues.hasMoreElements()) {
- String attrValue = (String) attrValues.nextElement();
- if (attrName.equals(ACTUAL_RANGE)) {
- elem.setMinValue(attrValue);
- if (attrValues.hasMoreElements()) {
- elem.setMaxValue((String) attrValues.nextElement());
- }
- } else if (attrName.equals(UNITS)) {
- elem.setUnit(attrValue);
- } else if (attrName.equals(START)) {
- elem.setMinValue(attrValue);
- } else if (attrName.equals(END)) {
- elem.setMaxValue(attrValue);
- }
- }
- }
-
- } // not a container attribute
-
- return elem;
- }
-
- @SuppressWarnings("unchecked")
- public EnumeratedProfileElement extractEnumeratedProfileElement(String elemName, String varname,
- Profile profile, DAS das)
- throws NoSuchAttributeException {
- EnumeratedProfileElement elem = new EnumeratedProfileElement(profile);
- elem.setName(elemName);
-
- AttributeTable attTable;
- try {
- attTable = das.getAttributeTable(elemName);
- } catch (NoSuchAttributeException e) {
- LOG.log(Level.WARNING, "Error extracting attribute table for element: ["
- + elemName + "]: Message: " + e.getMessage());
- throw e;
-
- }
-
- Enumeration attributeNames = attTable.getNames();
- while (attributeNames.hasMoreElements()) {
- String attrName = (String) attributeNames.nextElement();
- Attribute attr = attTable.getAttribute(attrName);
- Enumeration attrValues;
- try {
- attrValues = attr.getValues();
- } catch (NoSuchAttributeException e) {
- LOG.log(Level.WARNING, "Attempt to resolve attribute: [" + attrName
- + "] failed: Message: " + e.getMessage());
- continue;
- }
-
- while (attrValues.hasMoreElements()) {
- String attrValue = (String) attrValues.nextElement();
- if (attrName.equals(ACTUAL_RANGE)) {
- String[] vals = attrValue.split(" ");
- elem.getValues().addAll(Arrays.asList(vals));
- } else if (attrName.equals(UNITS)) {
- elem.setUnit(attrValue);
- } else {
- elem.getValues().add(attrValue);
- }
- }
-
- }
-
- return elem;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/opendapps/src/main/java/org/apache/oodt/opendapps/OpendapProfileHandler.java
----------------------------------------------------------------------
diff --git a/opendapps/src/main/java/org/apache/oodt/opendapps/OpendapProfileHandler.java b/opendapps/src/main/java/org/apache/oodt/opendapps/OpendapProfileHandler.java
deleted file mode 100644
index 871cd0c..0000000
--- a/opendapps/src/main/java/org/apache/oodt/opendapps/OpendapProfileHandler.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.opendapps;
-
-//JDK imports
-import java.io.FileNotFoundException;
-import java.net.MalformedURLException;
-import java.util.List;
-import java.util.Vector;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import opendap.dap.DConnect;
-
-import org.apache.oodt.cas.metadata.Metadata;
-import org.apache.oodt.opendapps.config.DapRoot;
-import org.apache.oodt.opendapps.config.OpendapConfig;
-import org.apache.oodt.opendapps.config.OpendapConfigReader;
-import org.apache.oodt.opendapps.extractors.DasMetadataExtractor;
-import org.apache.oodt.opendapps.extractors.MetadataExtractor;
-import org.apache.oodt.opendapps.extractors.NcmlMetadataExtractor;
-import org.apache.oodt.opendapps.extractors.ThreddsMetadataExtractor;
-import org.apache.oodt.opendapps.util.ProfileUtils;
-import org.apache.oodt.profile.Profile;
-import org.apache.oodt.profile.ProfileException;
-import org.apache.oodt.profile.handlers.ProfileHandler;
-import org.apache.oodt.xmlquery.XMLQuery;
-
-/**
- *
- *
- * A generic reusable OODT {@link ProfileHandler} for use in extracting metadata
- * from OPeNDAP and THREDDS-accessible datasets.
- *
- */
-public class OpendapProfileHandler implements ProfileHandler {
-
- private static final String PROFILE_HANDLER_ID = "OODT OPeNDAP Profile Handler";
-
- private static Logger LOG = Logger.getLogger(OpendapProfileHandler.class
- .getName());
-
- private OpendapConfig conf;
-
- public OpendapProfileHandler(){
- }
-
- /**
- * Implementation of interface method
- */
- public List<Profile> findProfiles(XMLQuery xmlQuery) throws ProfileException {
- String configFileLoc = null;
- String q = xmlQuery.getKwdQueryString();
- if (q.contains("ConfigUrl=")){
- Pattern parameterPattern = Pattern.compile("ConfigUrl=(.+?)( .*)?$");
- Matcher fileMatch = parameterPattern.matcher(q);
- while (fileMatch.find()) {
- configFileLoc = fileMatch.group(1);
- }
- } else {
- configFileLoc = System.getProperty("org.apache.oodt.opendap.config.filePath");
- }
-
- if (configFileLoc.isEmpty()){
- throw new ProfileException(
- "Configuration file not found. Please specify in System property opendap.config.filePath or as URL parameter ConfigUrl");
- } else {
- try {
- this.conf = OpendapConfigReader.read(configFileLoc);
- } catch (FileNotFoundException e) {
- throw new ProfileException("FileNotFoundException: File not found!");
- } catch (MalformedURLException e) {
- throw new ProfileException("MalformedURLException: please fix file URL");
- }
- }
-
- List<Profile> profiles = new Vector<Profile>();
- List<DapRoot> roots = this.conf.getRoots();
-
- // loop over THREDDS catalogs
- for (DapRoot root : roots) {
- LOG.log(Level.INFO,"Parsing DapRoot="+root.getDatasetUrl());
-
- DatasetExtractor d = new DatasetExtractor(xmlQuery, root.getCatalogUrl()
- .toExternalForm(), root.getDatasetUrl().toExternalForm(), conf);
- if (d.getDapUrls() != null) {
- for (String opendapUrl : d.getDapUrls()) {
-
- // wrap the profile generation in try-catch to avoid stopping the whole harvesting process in case an exception is thrown
- try {
-
- LOG.log(Level.FINE,"Connecting to opendapurl="+opendapUrl);
-
- Profile profile = new Profile();
- DConnect dConn;
- try {
- dConn = new DConnect(opendapUrl, true);
- } catch (FileNotFoundException e) {
- LOG.log(Level.WARNING, "Opendap URL not found: [" + opendapUrl
- + "]: Message: " + e.getMessage());
- throw new ProfileException("Opendap URL not found: [" + opendapUrl
- + "]: Message: " + e.getMessage());
- }
-
- // retrieve already extracted THREDDS metadata
- Metadata datasetMet = d.getDatasetMet(opendapUrl);
-
- // extract DAS metadata
- MetadataExtractor dasExtractor = new DasMetadataExtractor(dConn);
- dasExtractor.extract(datasetMet, conf);
-
- // extract NcML metadata, if available
- if (datasetMet.containsKey(ThreddsMetadataExtractor.SERVICE_TYPE_NCML)) {
- // retrieve URL of NcML document, previously stored
- final String ncmlUrl = datasetMet.getMetadata(ThreddsMetadataExtractor.SERVICE_TYPE_NCML);
- MetadataExtractor ncmlExtractor = new NcmlMetadataExtractor(ncmlUrl);
- ncmlExtractor.extract(datasetMet, conf);
- }
-
- // debug: write out all metadata entries
- for (String key : datasetMet.getAllKeys()) {
- LOG.log(Level.FINER, "Metadata key="+key+" value="+datasetMet.getMetadata(key));
- }
-
- // <resAttributes>
- profile.setResourceAttributes(ProfileUtils.getResourceAttributes(
- this.conf, opendapUrl, dConn, datasetMet));
-
- // <profAttributes>
- profile.setProfileAttributes(ProfileUtils
- .getProfileAttributes(this.conf, datasetMet));
- // <profElement>
- profile.getProfileElements().putAll(
- ProfileUtils.getProfileElements(this.conf, dConn, datasetMet, profile));
- profiles.add(profile);
- LOG.log(Level.FINE, "Added profile id="+profile.getProfileAttributes().getID());
-
-
- } catch(Exception e) {
- // in case of exception, don't harvest this dataset, but keep going
- LOG.log(Level.WARNING,"Error while building profile for opendapurl="+opendapUrl);
- LOG.log(Level.WARNING,e.getMessage());
- }
-
- }
- }
- }
- return profiles;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.oodt.profile.handlers.ProfileHandler#get(java.lang.String)
- */
- public Profile get(String id) throws ProfileException {
- throw new ProfileException("method not implemented yet!");
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.oodt.profile.handlers.ProfileHandler#getID()
- */
- public String getID() {
- return PROFILE_HANDLER_ID;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/opendapps/src/main/java/org/apache/oodt/opendapps/Profiler.java
----------------------------------------------------------------------
diff --git a/opendapps/src/main/java/org/apache/oodt/opendapps/Profiler.java b/opendapps/src/main/java/org/apache/oodt/opendapps/Profiler.java
deleted file mode 100644
index 8884db9..0000000
--- a/opendapps/src/main/java/org/apache/oodt/opendapps/Profiler.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.opendapps;
-
-//JDK imports
-import java.io.File;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-//OODT imports
-import org.apache.commons.io.FileUtils;
-import org.apache.oodt.opendapps.util.ProfileChecker;
-import org.apache.oodt.opendapps.util.ProfileSerializer;
-import org.apache.oodt.profile.Profile;
-import org.apache.oodt.profile.handlers.ProfileHandler;
-import org.apache.oodt.xmlquery.XMLQuery;
-import org.xml.sax.SAXException;
-
-/**
- * Command line class to drive the creation of OODT profiles from THREDDS
- * catalogs with OpenDAP endpoints.
- * <p/>
- * This class reads the list of THREDDS catalog URLs from the given opendapps
- * configuration file, parses the catalogs, and it writes the OODT profiles (one
- * for each THREDDS dataset) in the file "profiles.xml" in the specified
- * directory, or in the local execution directory if none is specified.
- * <p/>
- * Usage: java -classpath [path to opendapps-version-jar-with-dependencies.jar]
- * org.apache.oodt.opendapps.Profiler [config_file_location]
- * [optional_output_dir]
- * <p/>
- * Usage example: java -classpath
- * ./target/opendapps-0.4-SNAPSHOT-jar-with-dependencies.jar
- * org.apache.oodt.opendapps.Profiler /home/users/testuser/opendap.config.xml
- * /tmp
- *
- * @author Luca Cinquini
- *
- */
-public class Profiler {
-
- private static Logger LOG = Logger.getLogger(Profiler.class.getName());
-
- /**
- * Optional directory to serialize the profiles to.
- */
- private File outputDir;
-
- /**
- * Command line invocation method.
- *
- * @param args
- */
- public static void main(String[] args) throws Exception {
-
- // parse command line input
- if (args.length != 1 && args.length != 2) {
- usage();
- }
- File configFile = new File(args[0]);
- Profiler profiler = new Profiler();
- if (args.length == 2) {
- profiler.setOutputDir( new File(args[1]) );
- }
-
- // run profiler
- profiler.makeProfiles(configFile);
-
- }
-
- /**
- * No argument constructor.
- */
- public Profiler() {}
-
- /**
- * Setter method for output directory.
- * @param outputDir
- */
- public void setOutputDir(File outputDir) {
- this.outputDir = outputDir;
- }
-
- /**
- * Method to generate OODT profiles according to the specifications contained in a configuration file.
- *
- * @param configFile
- * @return
- */
- public List<Profile> makeProfiles(final File configFile) throws Exception {
-
- // parse THREDDS catalogs, create OODT profiles
- ProfileHandler profileHandler = new OpendapProfileHandler();
- XMLQuery xmlQuery = Profiler.buildXMLQuery(configFile);
- @SuppressWarnings(value = "unchecked")
- final List<Profile> profiles = profileHandler.findProfiles(xmlQuery);
-
- // check profiles
- for (final Profile profile : profiles) {
- final StringBuilder sb = new StringBuilder();
- boolean ok = ProfileChecker.check(profile, sb);
- // print out the profile summary for quick review by the publisher
- System.out.println(sb.toString());
- if (!ok) {
- LOG.log(Level.SEVERE, "ERROR: invalid profile:"+profile.getResourceAttributes().getIdentifier());
- }
- }
-
- // serialize profiles to XML
- String xml = ProfileSerializer.toXML(profiles);
- LOG.log(Level.FINE, xml);
-
- // write XML to disk
- if (outputDir != null) {
- final File file = new File(outputDir, "profiles.xml");
- FileUtils.writeStringToFile(file, xml);
- }
-
- return profiles;
-
- }
-
- private static XMLQuery buildXMLQuery(final File file) throws SAXException {
-
- final String query = "<query><queryKWQString>"
- + "PFunction=findall?ConfigUrl=" + file.getAbsolutePath()
- + "</queryKWQString></query>";
- return new XMLQuery(query);
-
- }
-
- private static void usage() {
- System.out
- .println("Usage: java -classpath [path to opendapps-version-jar-with-dependencies.jar] org.apache.oodt.opendapps.Profiler <config file location> [<output_dir>]");
- System.out
- .println("Example: java -classpath ./target/opendapps-0.4-SNAPSHOT-jar-with-dependencies.jar org.apache.oodt.opendapps.Profiler /home/users/testuser/opendap.config.xml /tmp");
- System.exit(-1);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/opendapps/src/main/java/org/apache/oodt/opendapps/config/ConstantSpec.java
----------------------------------------------------------------------
diff --git a/opendapps/src/main/java/org/apache/oodt/opendapps/config/ConstantSpec.java b/opendapps/src/main/java/org/apache/oodt/opendapps/config/ConstantSpec.java
deleted file mode 100644
index 118621e..0000000
--- a/opendapps/src/main/java/org/apache/oodt/opendapps/config/ConstantSpec.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.opendapps.config;
-
-/**
- *
- * A specification of a constant field to flow through into either the generated
- * {@link org.apache.oodt.profile.Profile}s {@link org.apache.oodt.profile.ProfileAttributes} section or its
- * {@link org.apache.oodt.profile.ResourceAttributes} section. Part of the {@link OpendapConfig}.
- *
- */
-public class ConstantSpec {
-
- private String type;
-
- private String name;
-
- private String value;
-
- public ConstantSpec() {
- this.type = null;
- this.name = null;
- this.value = null;
- }
-
- /**
- * @return the type
- */
- public String getType() {
- return type;
- }
-
- /**
- * @param type
- * the type to set
- */
- public void setType(String type) {
- this.type = type;
- }
-
- /**
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param name
- * the name to set
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * @return the value
- */
- public String getValue() {
- return value;
- }
-
- /**
- * @param value
- * the value to set
- */
- public void setValue(String value) {
- this.value = value;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/opendapps/src/main/java/org/apache/oodt/opendapps/config/DapRoot.java
----------------------------------------------------------------------
diff --git a/opendapps/src/main/java/org/apache/oodt/opendapps/config/DapRoot.java b/opendapps/src/main/java/org/apache/oodt/opendapps/config/DapRoot.java
deleted file mode 100644
index 2784368..0000000
--- a/opendapps/src/main/java/org/apache/oodt/opendapps/config/DapRoot.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.opendapps.config;
-
-//JDK imports
-import java.net.URL;
-
-/**
- *
- * A set of root {@link URL} information for OPeNDAP/THREDDS catalogs to crawl
- * and obtain dataset metadata from.
- *
- */
-public class DapRoot {
-
- private URL datasetUrl;
-
- private URL catalogUrl;
-
- private String filter;
-
- public DapRoot() {
- this.datasetUrl = null;
- this.catalogUrl = null;
- this.filter = null;
- }
-
- /**
- * @return the datasetUrl
- */
- public URL getDatasetUrl() {
- return datasetUrl;
- }
-
- /**
- * @param datasetUrl
- * the datasetUrl to set
- */
- public void setDatasetUrl(URL datasetUrl) {
- this.datasetUrl = datasetUrl;
- }
-
- /**
- * @return the catalogUrl
- */
- public URL getCatalogUrl() {
- return catalogUrl;
- }
-
- /**
- * @param catalogUrl
- * the catalogUrl to set
- */
- public void setCatalogUrl(URL catalogUrl) {
- this.catalogUrl = catalogUrl;
- }
-
- /**
- * @return the filter
- */
- public String getFilter() {
- return filter;
- }
-
- /**
- * @param filter
- * the filter to set
- */
- public void setFilter(String filter) {
- this.filter = filter;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/opendapps/src/main/java/org/apache/oodt/opendapps/config/DatasetMetElem.java
----------------------------------------------------------------------
diff --git a/opendapps/src/main/java/org/apache/oodt/opendapps/config/DatasetMetElem.java b/opendapps/src/main/java/org/apache/oodt/opendapps/config/DatasetMetElem.java
deleted file mode 100644
index 2c1f10a..0000000
--- a/opendapps/src/main/java/org/apache/oodt/opendapps/config/DatasetMetElem.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.opendapps.config;
-
-
-/**
- *
- * Specification for the {@link OpendapConfig} that specifies what THREDDS
- * dataset met to use to create {@link org.apache.oodt.profile.EnumeratedProfileElement}s from.
- *
- */
-public class DatasetMetElem {
-
- private String profileElementName;
-
- private String value;
-
- public DatasetMetElem() {
- this.profileElementName = null;
- this.value = null;
- }
-
- /**
- * @return the profileElementName
- */
- public String getProfileElementName() {
- return profileElementName;
- }
-
- /**
- * @param profileElementName
- * the profileElementName to set
- */
- public void setProfileElementName(String profileElementName) {
- this.profileElementName = profileElementName;
- }
-
- /**
- * @return the value
- */
- public String getValue() {
- return value;
- }
-
- /**
- * @param value
- * the value to set
- */
- public void setValue(String value) {
- this.value = value;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/opendapps/src/main/java/org/apache/oodt/opendapps/config/OpendapConfig.java
----------------------------------------------------------------------
diff --git a/opendapps/src/main/java/org/apache/oodt/opendapps/config/OpendapConfig.java b/opendapps/src/main/java/org/apache/oodt/opendapps/config/OpendapConfig.java
deleted file mode 100644
index 7d9dacb..0000000
--- a/opendapps/src/main/java/org/apache/oodt/opendapps/config/OpendapConfig.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.opendapps.config;
-
-//JDK imports
-import java.util.List;
-import java.util.Vector;
-
-/**
- *
- * The configuration object for the {@link OpendapProfileHandler}.
- *
- */
-public class OpendapConfig {
-
- private List<DapRoot> roots;
-
- private List<RewriteSpec> rewriteSpecs;
-
- private List<ConstantSpec> constSpecs;
-
- private List<DatasetMetElem> datasetMetSpecs;
-
- private ProcessingInstructions processingInstructions;
-
- public OpendapConfig() {
- this.roots = new Vector<DapRoot>();
- this.rewriteSpecs = new Vector<RewriteSpec>();
- this.constSpecs = new Vector<ConstantSpec>();
- this.datasetMetSpecs = new Vector<DatasetMetElem>();
- this.processingInstructions = new ProcessingInstructions();
- }
-
- /**
- * @return the roots
- */
- public List<DapRoot> getRoots() {
- return roots;
- }
-
- /**
- * @param roots
- * the roots to set
- */
- public void setRoots(List<DapRoot> roots) {
- this.roots = roots;
- }
-
- /**
- * @return the rewriteSpecs
- */
- public List<RewriteSpec> getRewriteSpecs() {
- return rewriteSpecs;
- }
-
- /**
- * @param rewriteSpecs
- * the rewriteSpecs to set
- */
- public void setRewriteSpecs(List<RewriteSpec> rewriteSpecs) {
- this.rewriteSpecs = rewriteSpecs;
- }
-
- /**
- * @return the constSpecs
- */
- public List<ConstantSpec> getConstSpecs() {
- return constSpecs;
- }
-
- /**
- * @param constSpecs
- * the constSpecs to set
- */
- public void setConstSpecs(List<ConstantSpec> constSpecs) {
- this.constSpecs = constSpecs;
- }
-
- /**
- * @return the datasetMetSpecs
- */
- public List<DatasetMetElem> getDatasetMetSpecs() {
- return datasetMetSpecs;
- }
-
- /**
- * @param datasetMetSpecs
- * the datasetMetSpecs to set
- */
- public void setDatasetMetSpecs(List<DatasetMetElem> datasetMetSpecs) {
- this.datasetMetSpecs = datasetMetSpecs;
- }
-
- /**
- * Returns all processing instructions.
- *
- * @return the processingInstructions
- */
- public ProcessingInstructions getProcessingInstructions() {
- return this.processingInstructions;
- }
-
- /**
- * Adds a processing instruction.
- *
- * @param key
- * @param value
- */
- public void addProcessingInstruction(String key, String value) {
- this.processingInstructions.addInstruction(key, value);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/opendapps/src/main/java/org/apache/oodt/opendapps/config/OpendapConfigMetKeys.java
----------------------------------------------------------------------
diff --git a/opendapps/src/main/java/org/apache/oodt/opendapps/config/OpendapConfigMetKeys.java b/opendapps/src/main/java/org/apache/oodt/opendapps/config/OpendapConfigMetKeys.java
deleted file mode 100644
index cf68dab..0000000
--- a/opendapps/src/main/java/org/apache/oodt/opendapps/config/OpendapConfigMetKeys.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.opendapps.config;
-
-/**
- *
- * A set of metadata keys for reading the {@link OpendapConfig}.
- *
- */
-public interface OpendapConfigMetKeys {
-
- String RES_ATTR_SPEC_TYPE = "resAttr";
-
- String PROF_ATTR_SPEC_TYPE = "profAttr";
-
- String PROF_ELEM_SPEC_TYPE = "profElem";
-
- String ENUM_ELEMENT_TYPE = "EnumeratedProfileElement";
-
- String RANGED_ELEMENT_TYPE = "RangedProfileElement";
-
- String DAP_ROOT_TAG = "root";
-
- String DATASET_URL_ATTR = "datasetURL";
-
- String CATALOG_URL_ATTR = "catalogURL";
-
- String FILTER_ATTR = "filter";
-
- String REWRITE_ROOT_TAG = "rewrite";
-
- String REWRITE_VAR_TAG = "var";
-
- String REWRITE_VAR_NAME_ATTR = "name";
-
- String REWRITE_VAR_RENAME_ATTR = "rename";
-
- String REWRITE_VAR_TYPE_ATTR = "type";
-
- String CONSTANT_ROOT_TAG = "constants";
-
- String CONSTANT_TAG = "const";
-
- String CONSTANT_NAME_ATTR = "name";
-
- String CONSTANT_TYPE_ATTR = "type";
-
- String CONSTANT_VALUE_ATTR = "value";
-
- String DATASET_MET_ROOT_TAG = "datasetMetadata";
-
- String DATASET_MET_ELEM_TAG = "elem";
-
- String DATASET_MET_NAME_ATTR = "name";
-
- String DATASET_MET_VALUE_ATTR = "value";
-
- String RES_LOCATION_ATTR = "resLocation";
-
- String PROCESSING_INSTRUCTIONS_TAG = "processingInstructions";
-
- String PROCESSING_INSTRUCTION_TAG = "processingInstruction";
-
- String PROCESSING_INSTRUCTION_NAME_ATTR = "name";
-
- String PROCESSING_INSTRUCTION_VALUE_ATTR = "value";
-
- String EXCLUDE_VARIABLES_ATTR = "excludeVariables";
-
- String DATETIME_FORMAT_ATTR = "datetimeFormat";
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/opendapps/src/main/java/org/apache/oodt/opendapps/config/OpendapConfigReader.java
----------------------------------------------------------------------
diff --git a/opendapps/src/main/java/org/apache/oodt/opendapps/config/OpendapConfigReader.java b/opendapps/src/main/java/org/apache/oodt/opendapps/config/OpendapConfigReader.java
deleted file mode 100644
index 4137805..0000000
--- a/opendapps/src/main/java/org/apache/oodt/opendapps/config/OpendapConfigReader.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.opendapps.config;
-
-// OODT imports
-import static org.apache.oodt.opendapps.config.OpendapConfigMetKeys.CATALOG_URL_ATTR;
-import static org.apache.oodt.opendapps.config.OpendapConfigMetKeys.CONSTANT_NAME_ATTR;
-import static org.apache.oodt.opendapps.config.OpendapConfigMetKeys.CONSTANT_ROOT_TAG;
-import static org.apache.oodt.opendapps.config.OpendapConfigMetKeys.CONSTANT_TAG;
-import static org.apache.oodt.opendapps.config.OpendapConfigMetKeys.CONSTANT_TYPE_ATTR;
-import static org.apache.oodt.opendapps.config.OpendapConfigMetKeys.CONSTANT_VALUE_ATTR;
-import static org.apache.oodt.opendapps.config.OpendapConfigMetKeys.DAP_ROOT_TAG;
-import static org.apache.oodt.opendapps.config.OpendapConfigMetKeys.DATASET_MET_ELEM_TAG;
-import static org.apache.oodt.opendapps.config.OpendapConfigMetKeys.DATASET_MET_NAME_ATTR;
-import static org.apache.oodt.opendapps.config.OpendapConfigMetKeys.DATASET_MET_ROOT_TAG;
-import static org.apache.oodt.opendapps.config.OpendapConfigMetKeys.DATASET_MET_VALUE_ATTR;
-import static org.apache.oodt.opendapps.config.OpendapConfigMetKeys.DATASET_URL_ATTR;
-import static org.apache.oodt.opendapps.config.OpendapConfigMetKeys.FILTER_ATTR;
-import static org.apache.oodt.opendapps.config.OpendapConfigMetKeys.PROCESSING_INSTRUCTIONS_TAG;
-import static org.apache.oodt.opendapps.config.OpendapConfigMetKeys.PROCESSING_INSTRUCTION_NAME_ATTR;
-import static org.apache.oodt.opendapps.config.OpendapConfigMetKeys.PROCESSING_INSTRUCTION_TAG;
-import static org.apache.oodt.opendapps.config.OpendapConfigMetKeys.PROCESSING_INSTRUCTION_VALUE_ATTR;
-import static org.apache.oodt.opendapps.config.OpendapConfigMetKeys.REWRITE_ROOT_TAG;
-import static org.apache.oodt.opendapps.config.OpendapConfigMetKeys.REWRITE_VAR_NAME_ATTR;
-import static org.apache.oodt.opendapps.config.OpendapConfigMetKeys.REWRITE_VAR_RENAME_ATTR;
-import static org.apache.oodt.opendapps.config.OpendapConfigMetKeys.REWRITE_VAR_TAG;
-import static org.apache.oodt.opendapps.config.OpendapConfigMetKeys.REWRITE_VAR_TYPE_ATTR;
-
-//JDK imports
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.apache.oodt.commons.xml.XMLUtils;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-
-/**
- *
- * Reads the {@link OpendapConfig} from a provided file and returns it.
- *
- */
-public class OpendapConfigReader {
-
- public static OpendapConfig read(String confFilePath)
- throws FileNotFoundException, MalformedURLException {
- OpendapConfig conf = new OpendapConfig();
- Document doc = XMLUtils.getDocumentRoot(new FileInputStream(new File(
- confFilePath)));
- Element rootElem = doc.getDocumentElement();
-
- NodeList dapRootNodeList = rootElem.getElementsByTagName(DAP_ROOT_TAG);
- for (int i = 0; i < dapRootNodeList.getLength(); i++) {
- Element dapRootElem = (Element) dapRootNodeList.item(i);
- DapRoot root = new DapRoot();
- root.setCatalogUrl(new URL(dapRootElem.getAttribute(CATALOG_URL_ATTR)));
- root.setDatasetUrl(new URL(dapRootElem.getAttribute(DATASET_URL_ATTR)));
- root.setFilter(dapRootElem.getAttribute(FILTER_ATTR));
- conf.getRoots().add(root);
- }
-
- Element rewriteRootElem = XMLUtils.getFirstElement(REWRITE_ROOT_TAG,
- rootElem);
- NodeList rewriteNodeList = rewriteRootElem
- .getElementsByTagName(REWRITE_VAR_TAG);
- for (int i = 0; i < rewriteNodeList.getLength(); i++) {
- Element rewriteElem = (Element) rewriteNodeList.item(i);
- RewriteSpec spec = new RewriteSpec();
- spec.setOrigName(rewriteElem.getAttribute(REWRITE_VAR_NAME_ATTR));
- spec.setRename(rewriteElem.getAttribute(REWRITE_VAR_RENAME_ATTR));
- spec.setElementType(rewriteElem.getAttribute(REWRITE_VAR_TYPE_ATTR));
- conf.getRewriteSpecs().add(spec);
- }
-
- Element datasetMetRootElem = XMLUtils.getFirstElement(DATASET_MET_ROOT_TAG,
- rootElem);
- NodeList datasetMetElemNodeList = datasetMetRootElem
- .getElementsByTagName(DATASET_MET_ELEM_TAG);
- for (int i = 0; i < datasetMetElemNodeList.getLength(); i++) {
- Element datasetMetElem = (Element) datasetMetElemNodeList.item(i);
- DatasetMetElem datasetMetSpec = new DatasetMetElem();
- datasetMetSpec.setProfileElementName(datasetMetElem
- .getAttribute(DATASET_MET_NAME_ATTR));
- datasetMetSpec.setValue(datasetMetElem
- .getAttribute(DATASET_MET_VALUE_ATTR));
- conf.getDatasetMetSpecs().add(datasetMetSpec);
- }
-
- Element constRootElem = XMLUtils.getFirstElement(CONSTANT_ROOT_TAG,
- rootElem);
- NodeList constNodeList = constRootElem.getElementsByTagName(CONSTANT_TAG);
- for (int i = 0; i < constNodeList.getLength(); i++) {
- Element constElem = (Element) constNodeList.item(i);
- ConstantSpec constSpec = new ConstantSpec();
- constSpec.setName(constElem.getAttribute(CONSTANT_NAME_ATTR));
- constSpec.setType(constElem.getAttribute(CONSTANT_TYPE_ATTR));
- constSpec.setValue(constElem
- .getAttribute(CONSTANT_VALUE_ATTR));
- conf.getConstSpecs().add(constSpec);
- }
-
- Element processingInstructionsElem = XMLUtils.getFirstElement(PROCESSING_INSTRUCTIONS_TAG, rootElem);
- if (processingInstructionsElem!=null) {
- NodeList instNodeList = processingInstructionsElem.getElementsByTagName(PROCESSING_INSTRUCTION_TAG);
- for (int i = 0; i < instNodeList.getLength(); i++) {
- Element instElem = (Element) instNodeList.item(i);
- conf.addProcessingInstruction(instElem.getAttribute(PROCESSING_INSTRUCTION_NAME_ATTR),
- instElem.getAttribute(PROCESSING_INSTRUCTION_VALUE_ATTR) );
- }
- }
-
- return conf;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/opendapps/src/main/java/org/apache/oodt/opendapps/config/OpendapProfileMetKeys.java
----------------------------------------------------------------------
diff --git a/opendapps/src/main/java/org/apache/oodt/opendapps/config/OpendapProfileMetKeys.java b/opendapps/src/main/java/org/apache/oodt/opendapps/config/OpendapProfileMetKeys.java
deleted file mode 100644
index f833be8..0000000
--- a/opendapps/src/main/java/org/apache/oodt/opendapps/config/OpendapProfileMetKeys.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.opendapps.config;
-
-/**
- * Interface containing names for the metadata keys written to an OpenDAP profile document.
- *
- * @author Luca Cinquini
- *
- */
-public interface OpendapProfileMetKeys {
-
- String VARIABLES = "Variables";
-
- String COORDINATES = "Coordinates";
-
- String VARIABLES_LONG_NAMES = "Variable Long Names";
-
- String CF_STANDARD_NAMES = "CF Standard Names";
-
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/opendapps/src/main/java/org/apache/oodt/opendapps/config/ProcessingInstructions.java
----------------------------------------------------------------------
diff --git a/opendapps/src/main/java/org/apache/oodt/opendapps/config/ProcessingInstructions.java b/opendapps/src/main/java/org/apache/oodt/opendapps/config/ProcessingInstructions.java
deleted file mode 100644
index 4e2e01f..0000000
--- a/opendapps/src/main/java/org/apache/oodt/opendapps/config/ProcessingInstructions.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.opendapps.config;
-
-import java.util.Collections;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.springframework.util.StringUtils;
-
-/**
- * Class that holds special configuration instructions for generating an Opendap profile.
- * Instructions are stored as (name, values) pairs: each named instruction can have multiple values.
- * An instructions may be specified in the Opendap XML configuration file as a single element with comma-separated values,
- * or as multiple elements with the same name (and one or more values each).
- *
- * @author Luca Cinquini
- *
- */
-public class ProcessingInstructions {
-
- /**
- * Local storage for processing instructions.
- * Note that the order of the XML elements is not preserved (on purpose).
- */
- private final Map<String, Set<String>> instructions = new ConcurrentHashMap<String, Set<String>>();
-
- /**
- * Returns all values for a named instruction,
- * or an empty set if the instruction was not specified.
- * @param key
- * @return
- */
- public Set<String> getInstructionValues(String key) {
- if (instructions.containsKey(key)) {
- return Collections.unmodifiableSet( instructions.get(key) );
- } else {
- return Collections.unmodifiableSet( new HashSet<String>() );
- }
- }
-
- /**
- * If an instruction contains a single value, it is returned.
- * If the instruction has no values or multiple values, returns null instead.
- * @param key
- * @return
- */
- public String getInstructionValue(String key) {
- if (instructions.get(key)!=null && instructions.get(key).size()==1) {
- for (String value : instructions.get(key)) {
- return value;
- }
- }
- return null;
- }
-
- /**
- * Returns all instructions.
- * @return
- */
- public Map<String, Set<String>> getInstructions() {
- return Collections.unmodifiableMap(instructions);
- }
-
- /**
- * Method to add a value to a named instruction.
- * Value can be a comma separated list of values.
- * Leading and trailing spaces for each value are removed.
- * @param key
- * @param value
- */
- public void addInstruction(String key, String value) {
- if (StringUtils.hasText(key)) {
- if (!instructions.containsKey(key)) {
- instructions.put(key, new HashSet<String>());
- }
- String[] vals = value.split(",");
- for (String val : vals) {
- if (StringUtils.hasText(val)) {
- instructions.get(key).add(val.trim());
- }
- }
- }
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/opendapps/src/main/java/org/apache/oodt/opendapps/config/RewriteSpec.java
----------------------------------------------------------------------
diff --git a/opendapps/src/main/java/org/apache/oodt/opendapps/config/RewriteSpec.java b/opendapps/src/main/java/org/apache/oodt/opendapps/config/RewriteSpec.java
deleted file mode 100644
index fd8a0fe..0000000
--- a/opendapps/src/main/java/org/apache/oodt/opendapps/config/RewriteSpec.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.opendapps.config;
-
-/**
- *
- * A specification for rewriting OPeNDAP element names and tags from their
- * original OPeNDAP/THREDDS names into OODT profile elements, and their names
- * and types. Part of the {@link OpendapConfig}.
- *
- */
-public class RewriteSpec {
-
- private String origName;
-
- private String rename;
-
- private String elementType;
-
- public RewriteSpec() {
- this.origName = null;
- this.rename = null;
- this.elementType = null;
- }
-
- /**
- * @return the origName
- */
- public String getOrigName() {
- return origName;
- }
-
- /**
- * @param origName
- * the origName to set
- */
- public void setOrigName(String origName) {
- this.origName = origName;
- }
-
- /**
- * @return the rename
- */
- public String getRename() {
- return rename;
- }
-
- /**
- * @param rename
- * the rename to set
- */
- public void setRename(String rename) {
- this.rename = rename;
- }
-
- /**
- * @return the elementType
- */
- public String getElementType() {
- return elementType;
- }
-
- /**
- * @param elementType
- * the elementType to set
- */
- public void setElementType(String elementType) {
- this.elementType = elementType;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/opendapps/src/main/java/org/apache/oodt/opendapps/extractors/DasMetadataExtractor.java
----------------------------------------------------------------------
diff --git a/opendapps/src/main/java/org/apache/oodt/opendapps/extractors/DasMetadataExtractor.java b/opendapps/src/main/java/org/apache/oodt/opendapps/extractors/DasMetadataExtractor.java
deleted file mode 100644
index 7b01ed1..0000000
--- a/opendapps/src/main/java/org/apache/oodt/opendapps/extractors/DasMetadataExtractor.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.opendapps.extractors;
-
-//JDK imports
-import org.apache.oodt.cas.metadata.Metadata;
-import org.apache.oodt.opendapps.config.OpendapConfig;
-import org.apache.oodt.opendapps.config.OpendapConfigMetKeys;
-import org.apache.oodt.opendapps.config.OpendapProfileMetKeys;
-import org.apache.oodt.opendapps.config.ProcessingInstructions;
-import org.apache.oodt.opendapps.util.ProfileUtils;
-
-import org.springframework.util.StringUtils;
-
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Enumeration;
-import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import opendap.dap.Attribute;
-import opendap.dap.AttributeTable;
-import opendap.dap.DAS;
-import opendap.dap.DConnect;
-
-//OPENDAP imports
-//OODT imports
-
-/**
- * Implementation of {@link MetadataExtractor} to extract metadata from an
- * OpenDAP DAS source. Currently this class only extracts metadata from the
- * NetCDF global attributes of type String, disregarding all others.
- *
- * @author Luca Cinquini
- *
- */
-public class DasMetadataExtractor implements MetadataExtractor {
-
- // constants from NetCDF metadata convention
- public static final String NC_GLOBAL = "NC_GLOBAL";
- public static final String LONG_NAME = "long_name";
- public static final String STANDARD_NAME = "standard_name";
-
- // NetCDF data types
- public static final int INT32_TYPE = 6;
- public static final int INT64_TYPE = 7;
- public static final int FLOAT32_TYPE = 8;
- public static final int FLOAT64_TYPE = 9;
- public static final int STRING_TYPE = 10;
-
- // output format for all global attributes interpreted as dates
- private final static String OUTPUT_DATETIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss'Z'";
- private final static DateFormat outputDatetimeFormat = new SimpleDateFormat(OUTPUT_DATETIME_FORMAT);
-
- private static Logger LOG = Logger.getLogger(DasMetadataExtractor.class
- .getName());
-
- /**
- * The DAS stream which is the metadata source.
- */
- private final DConnect dConn;
-
- public DasMetadataExtractor(DConnect dConn) {
- this.dConn = dConn;
- }
-
- /**
- * The main metadata extraction method.
- *
- * @param metadata
- * : the metadata target, specifically the CAS metadata container.
- */
- public void extract(Metadata metadata, OpendapConfig config) {
-
- LOG.log(Level.INFO, "Parsing DAS metadata from: " + dConn.URL());
-
- // list of excluded variables
- Set<String> excludedVariables
- = config.getProcessingInstructions().getInstructionValues(OpendapConfigMetKeys.EXCLUDE_VARIABLES_ATTR);
-
- try {
- DAS das = dConn.getDAS();
- @SuppressWarnings("unchecked")
- Enumeration<String> names = das.getNames();
- while (names.hasMoreElements()) {
- String attName = names.nextElement();
- LOG.log(Level.FINE, "Extracting DAS attribute: " + attName);
- AttributeTable at = das.getAttributeTable(attName);
- Enumeration<String> e = at.getNames();
-
- // NetCDF global attributes
- // store attribute name, all values for ALL attributes (strings and numerics)
- ProcessingInstructions processingInstructions = config.getProcessingInstructions();
- if (attName.equals(NC_GLOBAL)) {
- while (e.hasMoreElements()) {
- String key = e.nextElement();
- Attribute att = at.getAttribute(key);
- // convert all DAS attribute names to lower case
- String lkey = key.toLowerCase();
-
- // look for global attribute name in date/time configuration specification
- String dateTimeFormatKey = OpendapConfigMetKeys.DATETIME_FORMAT_ATTR + ":" + lkey;
- String dateTimeFormatValue = processingInstructions.getInstructionValue(dateTimeFormatKey);
- // add this attribute as properly formatted date/time
- if (StringUtils.hasText(dateTimeFormatValue)) {
- DateFormat inFormat = new SimpleDateFormat(dateTimeFormatValue);
- Enumeration<String> edt = att.getValues();
- while (edt.hasMoreElements()) {
- String value = edt.nextElement();
- try {
- Date date = inFormat.parse(value);
- ProfileUtils.addIfNotNull(metadata, lkey, outputDatetimeFormat.format(date));
- } catch(ParseException pe) {
- LOG.log(Level.WARNING,
- "Error parsing date/time from DAS attribute: "+key+" value="+value+" error="+pe.getMessage());
- }
- }
- // add this global attribute as string
- } else {
- ProfileUtils.addIfNotExisting(metadata, lkey, att.getValues());
- }
- }
-
- // NetCDF coordinates
- } else {
-
- if ( attName.equalsIgnoreCase("lat") || attName.equalsIgnoreCase("latitude")
- || attName.equalsIgnoreCase("lon") || attName.equalsIgnoreCase("longitude")
- || attName.equalsIgnoreCase("time")
- || attName.equalsIgnoreCase("alt") || attName.equalsIgnoreCase("altitude")
- || attName.equalsIgnoreCase("lev") || attName.equalsIgnoreCase("level")
- || attName.equalsIgnoreCase("depth")
- ) {
-
- if (!excludedVariables.contains(attName)) {
- // store coordinate name
- ProfileUtils.addIfNotNull(metadata, OpendapProfileMetKeys.COORDINATES, attName);
- }
-
- } else {
-
- if (!excludedVariables.contains(attName)) {
- // store variable name
- ProfileUtils.addIfNotNull(metadata, OpendapProfileMetKeys.VARIABLES, attName);
- // store "standard_name", "long_name"
- while (e.hasMoreElements()) {
- String key = e.nextElement();
- Attribute att = at.getAttribute(key);
- if (key.equalsIgnoreCase(STANDARD_NAME)) {
- ProfileUtils.addIfNotNull(metadata, OpendapProfileMetKeys.CF_STANDARD_NAMES, att.getValueAt(0));
- } else if (key.equalsIgnoreCase(LONG_NAME)) {
- ProfileUtils.addIfNotNull(metadata, OpendapProfileMetKeys.VARIABLES_LONG_NAMES, att.getValueAt(0));
- }
- }
- }
-
- }
- }
-
- }
-
- } catch (Exception e) {
- LOG.log(Level.WARNING, "Error parsing DAS metadata: " + e.getMessage());
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/opendapps/src/main/java/org/apache/oodt/opendapps/extractors/MetadataExtractor.java
----------------------------------------------------------------------
diff --git a/opendapps/src/main/java/org/apache/oodt/opendapps/extractors/MetadataExtractor.java b/opendapps/src/main/java/org/apache/oodt/opendapps/extractors/MetadataExtractor.java
deleted file mode 100644
index 1cf9805..0000000
--- a/opendapps/src/main/java/org/apache/oodt/opendapps/extractors/MetadataExtractor.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.opendapps.extractors;
-
-//OODT imports
-import org.apache.oodt.cas.metadata.Metadata;
-import org.apache.oodt.opendapps.config.OpendapConfig;
-
-/**
- * Interface for extracting metadata from a generic web accessible resource into
- * a CAS metadata container. Each implementation class must be responsible for
- * instantiating and accessing the specific metadata source as appropriate.
- *
- * @author Luca Cinquini
- *
- */
-public interface MetadataExtractor {
-
- /**
- * Method to (further) populate the metadata container.
- * Any extracted metadata is added to the current metadata content.
- *
- * @param metadata
- * @param config
- */
- void extract(Metadata metadata, OpendapConfig config);
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/opendapps/src/main/java/org/apache/oodt/opendapps/extractors/NcmlMetadataExtractor.java
----------------------------------------------------------------------
diff --git a/opendapps/src/main/java/org/apache/oodt/opendapps/extractors/NcmlMetadataExtractor.java b/opendapps/src/main/java/org/apache/oodt/opendapps/extractors/NcmlMetadataExtractor.java
deleted file mode 100644
index 9b40330..0000000
--- a/opendapps/src/main/java/org/apache/oodt/opendapps/extractors/NcmlMetadataExtractor.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.opendapps.extractors;
-
-//JDK imports
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-//OODT imports
-import org.apache.oodt.cas.metadata.Metadata;
-import org.apache.oodt.opendapps.config.OpendapConfig;
-
-/**
- * Implementation of {@link MetadataExtractor} that parses an NcML XML document.
- * Currently this class is simply a stub that doesn't do anything.
- *
- * @author Luca Cinquini
- *
- */
-public class NcmlMetadataExtractor implements MetadataExtractor {
-
- private final String ncmlUrl;
-
- private static Logger LOG = Logger.getLogger(NcmlMetadataExtractor.class
- .getName());
-
- public NcmlMetadataExtractor(String ncmlUrl) {
- this.ncmlUrl = ncmlUrl;
- }
-
- /**
- * Stub implementation of interface method.
- */
- public void extract(Metadata metadata, OpendapConfig config) {
-
- LOG.log(Level.FINE, "Parsing NcML metadata from: " + ncmlUrl);
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/opendapps/src/main/java/org/apache/oodt/opendapps/extractors/ThreddsMetadataExtractor.java
----------------------------------------------------------------------
diff --git a/opendapps/src/main/java/org/apache/oodt/opendapps/extractors/ThreddsMetadataExtractor.java b/opendapps/src/main/java/org/apache/oodt/opendapps/extractors/ThreddsMetadataExtractor.java
deleted file mode 100644
index 406feb4..0000000
--- a/opendapps/src/main/java/org/apache/oodt/opendapps/extractors/ThreddsMetadataExtractor.java
+++ /dev/null
@@ -1,315 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.opendapps.extractors;
-
-//JDK imports
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.UUID;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-//OODT imports
-import org.apache.oodt.cas.metadata.Metadata;
-import org.apache.oodt.opendapps.config.OpendapConfig;
-import org.apache.oodt.opendapps.util.ProfileUtils;
-
-
-//Spring imports
-import org.springframework.util.StringUtils;
-
-//THREDDS imports
-import thredds.catalog.InvAccess;
-import thredds.catalog.InvDataset;
-import thredds.catalog.InvDocumentation;
-import thredds.catalog.InvProperty;
-import thredds.catalog.ServiceType;
-import thredds.catalog.ThreddsMetadata.Contributor;
-import thredds.catalog.ThreddsMetadata.GeospatialCoverage;
-import thredds.catalog.ThreddsMetadata.Range;
-import thredds.catalog.ThreddsMetadata.Source;
-import thredds.catalog.ThreddsMetadata.Vocab;
-import ucar.nc2.units.DateType;
-import ucar.unidata.geoloc.LatLonRect;
-
-/**
- * Implementation of {@link MetadataExtractor} that extracts metadata from a
- * Thredds dataset.
- *
- * @author Luca Cinquini
- *
- */
-public class ThreddsMetadataExtractor implements MetadataExtractor {
-
- private static Logger LOG = Logger.getLogger(ThreddsMetadataExtractor.class
- .getName());
-
- // constant missing for 4.2 version of NetCDF library
- public final static String SERVICE_TYPE_NCML = "NCML";
-
- /**
- * The source of metadata to be extracted.
- */
- private final InvDataset dataset;
-
- public ThreddsMetadataExtractor(final InvDataset dataset) {
- this.dataset = dataset;
- }
-
- public void extract(Metadata met, OpendapConfig config) {
-
- LOG.log(Level.INFO, "Crawling catalog URL=" + dataset.getCatalogUrl()
- + " dataset ID=" + dataset.getID());
-
- ProfileUtils.addIfNotNull(met, "Authority", dataset.getAuthority());
- ProfileUtils.addIfNotNull(met, "CatalogUrl", dataset.getCatalogUrl());
- try {
- ProfileUtils.addIfNotNull(met, "Host", (new URL(dataset.getCatalogUrl())).getHost() );
- } catch(MalformedURLException e) {
- LOG.log(Level.WARNING, e.getMessage());
- }
- ProfileUtils.addIfNotNull(met, "DatasetFullName", dataset.getFullName());
- if (dataset.getContributors() != null) {
- for (Contributor contributor : dataset.getContributors()) {
- ProfileUtils.addIfNotNull(met, "Contributor", contributor.getName());
- }
- }
-
- if (dataset.getCreators() != null) {
- for (Source source : dataset.getCreators()) {
- ProfileUtils.addIfNotNull(met, "Creator", source.getName());
- }
- }
-
- if (dataset.getDataFormatType() != null) {
- ProfileUtils.addIfNotNull(met, "DataFormatType", dataset
- .getDataFormatType().toString());
- }
-
- if (dataset.getDataType() != null) {
- ProfileUtils.addIfNotNull(met, "DataType", dataset.getDataType()
- .toString());
- }
-
- if (dataset.getDates() != null) {
- for (DateType dateType : dataset.getDates()) {
- String dateString = null;
- try {
- dateString = ProfileUtils.toISO8601(dateType.getDate());
- } catch (Exception e) {
- LOG.log(Level.WARNING,
- "Error converting date: [" + dateType.getDate() + "]: Message: "
- + e.getMessage());
- }
- ProfileUtils.addIfNotNull(met, "Dates", dateString);
- }
- }
-
- if (dataset.getDocumentation() != null) {
- for (InvDocumentation doc : dataset.getDocumentation()) {
- // textual documentation
- if (StringUtils.hasText(doc.getInlineContent())) {
- if (StringUtils.hasText(doc.getType())) {
- // use specific documentation type, when available
- ProfileUtils.addIfNotNull(met, doc.getType(), doc.getInlineContent());
- } else {
- // otherwise use generic "Documentation" tag
- ProfileUtils.addIfNotNull(met, "Documentation", doc.getInlineContent());
- }
- }
- // hyperlinked documentation
- if (StringUtils.hasText(doc.getXlinkHref())) {
- String tuple = this.encodeXlinkTuple(doc.getXlinkHref(), doc.getXlinkTitle(), doc.getType());
- ProfileUtils.addIfNotNull(met, "Xlink", tuple);
- }
-
- }
- }
-
- ProfileUtils.addIfNotNull(met, "FullName", dataset.getFullName());
- GeospatialCoverage geoCoverage = dataset.getGeospatialCoverage();
-
- if (geoCoverage != null) {
-
- LatLonRect bbox = geoCoverage.getBoundingBox();
- if (bbox != null) {
- ProfileUtils.addIfNotNull(met, "SouthwestBC", bbox.getLowerLeftPoint()
- .toString());
- ProfileUtils.addIfNotNull(met, "NorthwestBC", bbox.getUpperLeftPoint()
- .toString());
- ProfileUtils.addIfNotNull(met, "NortheastBC", bbox.getUpperRightPoint()
- .toString());
- ProfileUtils.addIfNotNull(met, "SoutheastBC", bbox.getLowerRightPoint()
- .toString());
- }
-
- // try north south, east west
- if (geoCoverage.getNorthSouthRange() != null) {
- Range nsRange = geoCoverage.getNorthSouthRange();
- ProfileUtils.addIfNotNull(met, "NorthSouthRangeStart",
- String.valueOf(nsRange.getStart()));
- ProfileUtils.addIfNotNull(met, "NorthSouthRangeResolution",
- String.valueOf(nsRange.getResolution()));
- ProfileUtils.addIfNotNull(met, "NorthSouthRangeSize",
- String.valueOf(nsRange.getSize()));
- ProfileUtils.addIfNotNull(met, "NorthSouthRangeUnits",
- nsRange.getUnits());
- ProfileUtils.addIfNotNull(met, "NorthSouthRangeStop",
- String.valueOf(nsRange.getStart()+nsRange.getSize()));
- }
-
- if (geoCoverage.getEastWestRange() != null) {
- Range nsRange = geoCoverage.getEastWestRange();
- ProfileUtils.addIfNotNull(met, "EastWestRangeStart",
- String.valueOf(nsRange.getStart()));
- ProfileUtils.addIfNotNull(met, "EastWestRangeResolution",
- String.valueOf(nsRange.getResolution()));
- ProfileUtils.addIfNotNull(met, "EastWestRangeSize",
- String.valueOf(nsRange.getSize()));
- ProfileUtils.addIfNotNull(met, "EastWestRangeUnits",
- nsRange.getUnits());
- ProfileUtils.addIfNotNull(met, "EastWestRangeStop",
- String.valueOf(nsRange.getStart()+nsRange.getSize()));
- }
-
- ProfileUtils.addIfNotNull(met, "GeospatialCoverageLatitudeResolution",
- String.valueOf(dataset.getGeospatialCoverage().getLatResolution()));
- ProfileUtils.addIfNotNull(met, "GeospatialCoverageLongitudeResolution",
- String.valueOf(dataset.getGeospatialCoverage().getLonResolution()));
-
- // add geo-spatial coverage alternative form
- ProfileUtils.addIfNotNull(met, "GeospatialCoverageLatSouth", String.valueOf(dataset.getGeospatialCoverage().getLatSouth()));
- ProfileUtils.addIfNotNull(met, "GeospatialCoverageLatNorth", String.valueOf(dataset.getGeospatialCoverage().getLatNorth()));
- ProfileUtils.addIfNotNull(met, "GeospatialCoverageLonWest", String.valueOf(dataset.getGeospatialCoverage().getLonWest()));
- ProfileUtils.addIfNotNull(met, "GeospatialCoverageLonEast", String.valueOf(dataset.getGeospatialCoverage().getLonEast()));
-
- if (dataset.getGeospatialCoverage().getNames() != null) {
- for (Vocab gName : dataset.getGeospatialCoverage().getNames()) {
- ProfileUtils.addIfNotNull(met, "GeospatialCoverage", gName.getText());
- }
- }
-
- }
-
- ProfileUtils.addIfNotNull(met, "History", dataset.getHistory());
- if (dataset.getKeywords() != null) {
- for (Vocab vocab : dataset.getKeywords()) {
- ProfileUtils.addIfNotNull(met, "Keywords", vocab.getText());
- }
- }
- ProfileUtils.addIfNotNull(met, "Name", dataset.getName());
- ProfileUtils.addIfNotNull(met, "Processing", dataset.getProcessing());
- if (dataset.getProjects() != null) {
- for (Vocab vocab : dataset.getProjects()) {
- ProfileUtils.addIfNotNull(met, "Projects", vocab.getText());
- }
- }
-
- if (dataset.getProperties() != null) {
- for (InvProperty prop : dataset.getProperties()) {
- ProfileUtils.addIfNotNull(met, prop.getName(), prop.getValue());
- }
- }
-
- if (dataset.getPublishers() != null) {
- for (Source source : dataset.getPublishers()) {
- // Note: use "Publisher" (singular) as from the OODT profile specification
- ProfileUtils.addIfNotNull(met, "Publisher", source.getName());
- }
- }
-
- ProfileUtils.addIfNotNull(met, "RestrictAccess",
- dataset.getRestrictAccess());
- if (dataset.getTimeCoverage() != null) {
- String startDateTimeStr = null, endDateTimeStr = null;
- try {
- startDateTimeStr = ProfileUtils.toISO8601(dataset.getTimeCoverage()
- .getStart().getDate());
- endDateTimeStr = ProfileUtils.toISO8601(dataset.getTimeCoverage()
- .getEnd().getDate());
- } catch (Exception e) {
- LOG.log(
- Level.WARNING,
- "Error converting start/end date time strings: Message: "
- + e.getMessage());
- }
-
- ProfileUtils.addIfNotNull(met, "StartDateTime", startDateTimeStr);
- ProfileUtils.addIfNotNull(met, "EndDateTime", endDateTimeStr);
- }
-
- if (dataset.getTimeCoverage() != null
- && dataset.getTimeCoverage().getResolution() != null) {
- ProfileUtils.addIfNotNull(met, "TimeCoverageResolution", dataset
- .getTimeCoverage().getResolution().getText());
- }
- // dataset unique ID
- ProfileUtils.addIfNotNull(met, "UniqueID", dataset.getUniqueID());
-
- // dataset ID is typically not null
- ProfileUtils.addIfNotNull(met, "ID", dataset.getID());
-
- // generate a UUID for each dataset, to be used as profile ID
- ProfileUtils.addIfNotNull(met, "UUID", UUID.randomUUID().toString());
-
- // store access services - only the OpenDAP endpoint for now
- for (InvAccess access : dataset.getAccess()) {
- String url = access.getStandardUri().toString();
- String type = access.getService().getServiceType().toString();
- String name = access.getService().getName();
-
- // add opendap access URL
- if (type.equalsIgnoreCase(ServiceType.OPENDAP.toString())) {
- // store opendap URL
- ProfileUtils.addIfNotNull(met,"OpendapUrl",url);
- // note: special processing of opendap endpoints since URL in thredds catalog is unusable without a suffix
- ProfileUtils.addIfNotNull(met,"Access", this.encodeAccessTuple(url+".html", ProfileUtils.MIME_TYPE_OPENDAP_HTML, type));
- }
- }
- // add TREDDS XML catalog URL
- String url = dataset.getCatalogUrl(); // catalog_url.xml#dataset_id
- ProfileUtils.addIfNotNull(met,"Access", this.encodeAccessTuple(url, ProfileUtils.MIME_TYPE_THREDDS, "Catalog/XML"));
- ProfileUtils.addIfNotNull(met,"Access", this.encodeAccessTuple(url.replaceAll("\\.xml", ".html"), ProfileUtils.MIME_TYPE_HTML, "Catalog/HTML"));
-
- }
-
- /**
- * Utility method that joins the parts of an xlink tuple (href, title, type) with a delimiting character.
- * @param href : the xlink URL, must be not null
- * @param title : the xlink title, may be null
- * @param type : the xlink type, may be null
- * @return
- */
- private String encodeXlinkTuple(final String href, final String title, final String type) {
- return href + ProfileUtils.CHAR + (StringUtils.hasText(title) ? title : "Reference") + ProfileUtils.CHAR + (
- StringUtils.hasText(type) ? type : "HTML");
- }
-
- /**
- * Utility method that joins the part of A THREDDS access point (url, service type, service name) with a delimiting character
- * @param url : the access URL
- * @param type : the service type, mapped to a mime type
- * @param name : the service name
- * @return
- */
- private String encodeAccessTuple(final String url, final String type, final String name) {
- return url + ProfileUtils.CHAR + (StringUtils.hasText(type) ? type : "") + ProfileUtils.CHAR + (
- StringUtils.hasText(name) ? name : "");
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/opendapps/src/main/java/org/apache/oodt/opendapps/util/OpendapURLEvaluator.java
----------------------------------------------------------------------
diff --git a/opendapps/src/main/java/org/apache/oodt/opendapps/util/OpendapURLEvaluator.java b/opendapps/src/main/java/org/apache/oodt/opendapps/util/OpendapURLEvaluator.java
deleted file mode 100644
index eeec45c..0000000
--- a/opendapps/src/main/java/org/apache/oodt/opendapps/util/OpendapURLEvaluator.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.opendapps.util;
-
-//JDK imports
-import java.io.IOException;
-
-import org.apache.oodt.opendapps.DatasetExtractor;
-import org.apache.oodt.xmlquery.XMLQuery;
-
-/**
- *
- * Evaluates the resultant OPeNDAP URLs returned from a THREDDS catalog by the
- * {@link DatasetExtractor}.
- *
- */
-public class OpendapURLEvaluator {
-
- public static void main(String[] args) throws IOException {
- String datasetUrl = args[0];
- String catalogUrl = args[1];
-
- DatasetExtractor gen = new DatasetExtractor(getQuery(), catalogUrl,
- datasetUrl, null);
- System.out.println(gen.getDapUrls());
- }
-
- private static XMLQuery getQuery() {
- return new XMLQuery("PFunction=findall", "cmdline", "cmdline", null, null,
- null, null, null, XMLQuery.DEFAULT_MAX_RESULTS, true);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/opendapps/src/main/java/org/apache/oodt/opendapps/util/ProfileChecker.java
----------------------------------------------------------------------
diff --git a/opendapps/src/main/java/org/apache/oodt/opendapps/util/ProfileChecker.java b/opendapps/src/main/java/org/apache/oodt/opendapps/util/ProfileChecker.java
deleted file mode 100644
index 1996381..0000000
--- a/opendapps/src/main/java/org/apache/oodt/opendapps/util/ProfileChecker.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.opendapps.util;
-
-// JDK imports
-import java.util.List;
-
-// OODT imports
-import org.apache.oodt.profile.Profile;
-import org.apache.oodt.profile.ProfileElement;
-
-// Spring imports
-import org.springframework.util.StringUtils;
-
-/**
- * Utility class that checks an OODT Profile versus a list of required/optional elements,
- * and provides a validation summary for quick inspection by the publisher.
- *
- * @author Luca Cinquini
- *
- */
-public class ProfileChecker {
-
- // list of mandatory profile elements
- private final static String[] mandatoryProfileElements = new String[] { };
-
- // list of optional profile elements
- private final static String[] optionalProfileElements = new String[] { "mission_name", "sensor", "institute",
- "variable", "cf_standard_name", "variable_long_name",
- "spatial_coverage",
- "north_degrees", "east_degrees", "south_degrees", "west_degrees",
- "datetime_start", "datetime_stop" };
-
- /**
- * Main method to check an OODT profile.
- *
- * @param profile : the OODT profile that needs validation.
- * @param sb : buffer to write the output to.
- * @return : true if the profile is valid, false otherwise.
- */
- public static boolean check(final Profile profile, final StringBuilder sb) {
-
- // profile passes by default
- boolean ok = true;
- sb.append("\nChecking profile=").append(profile.getProfileAttributes().getID());
-
- ok = checkResourceAttribute("Identifier", profile.getResourceAttributes().getIdentifier(), true, sb);
-
- ok = ok && checkResourceAttribute("Title", profile.getResourceAttributes().getTitle(), true, sb);
-
- ok = ok && checkResourceAttribute("Description", profile.getResourceAttributes().getDescription(), false, sb);
-
- ok = ok && checkResourceAttribute("Location of type "+ProfileUtils.MIME_TYPE_OPENDAP_HTML,
- selectResourceLocationByMimeType(profile.getResourceAttributes().getResLocations(), ProfileUtils.MIME_TYPE_OPENDAP_HTML),
- true, sb);
-
- ok = ok && checkResourceAttribute("Location of type "+ProfileUtils.MIME_TYPE_THREDDS,
- selectResourceLocationByMimeType(profile.getResourceAttributes().getResLocations(), ProfileUtils.MIME_TYPE_THREDDS),
- true, sb);
-
- ok = ok && checkResourceAttribute("Location of type "+ProfileUtils.MIME_TYPE_HTML,
- selectResourceLocationByMimeType(profile.getResourceAttributes().getResLocations(), ProfileUtils.MIME_TYPE_HTML),
- true, sb);
-
- ok = ok && checkResourceAttribute("Location of type "+ProfileUtils.MIME_TYPE_GIS,
- selectResourceLocationByMimeType(profile.getResourceAttributes().getResLocations(), ProfileUtils.MIME_TYPE_GIS),
- true, sb);
-
- for (String name : mandatoryProfileElements) {
- ok = ok && checkProfileElement(profile, name, true, sb);
- }
- for (String name : optionalProfileElements) {
- ok = ok && checkProfileElement(profile, name, false, sb);
- }
-
- return ok;
- }
-
- /**
- * Method to check that a profile Resource Attribute has a valid value.
- *
- * @param name
- * @param value
- * @param mandatory
- * @param sb
- * @return
- */
- private static boolean checkResourceAttribute(String name, String value, boolean mandatory, StringBuilder sb) {
- sb.append("\n\tResource Attribute '").append(name).append("' = ");
- if (!StringUtils.hasText(value) || value.equalsIgnoreCase("null")) {
- if (mandatory) {
- return false; // bad value
- }
- } else {
- sb.append(value);
- }
- return true;
- }
-
- /**
- * Method to check that the profile contains at least one valid value for of a specific element name.
- *
- * @param profile
- * @param name
- * @param mandatory
- * @param sb
- * @return
- */
- private static boolean checkProfileElement(Profile profile, String name, boolean mandatory, StringBuilder sb) {
-
- sb.append("\n\tProfile Element '").append(name).append("' = ");
- // profile element is valid by default
- boolean ok = true;
-
- if (profile.getProfileElements().containsKey(name)) {
- ProfileElement profElement = (ProfileElement)profile.getProfileElements().get(name);
-
- // profile element found
- List<String> values = profElement.getValues();
- if (values.size()>0) {
- boolean first = true;
- for (String value : values) {
- if (!StringUtils.hasText(value) || value.equalsIgnoreCase("null")) {
- if (mandatory) {
- ok = false; // invalid value for this profile element
- }
- } else {
- if (!first) {
- sb.append(", ");
- }
- sb.append(value);
- first = false;
- }
- }
- } else {
- if (mandatory) {
- ok = false; // no values found for this profile element
- }
- }
-
- } else {
- if (mandatory) {
- ok = false; // no profile element found
- }
- }
-
- return ok;
-
- }
-
- /**
- * Method to select the resource location of a specific mime type, if found.
- *
- * @param resLocations
- * @param mimeType
- * @return
- */
- private static String selectResourceLocationByMimeType(List<String> resLocations, String mimeType) {
-
- for (String resLocation : resLocations) {
- String[] parts = resLocation.split("\\|"); // regular expression of ProfileUtils.CHAR
- if (parts[1].equals(mimeType)) {
- return parts[0];
- }
- }
-
- // resource location not found
- return null;
-
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/opendapps/src/main/java/org/apache/oodt/opendapps/util/ProfileSerializer.java
----------------------------------------------------------------------
diff --git a/opendapps/src/main/java/org/apache/oodt/opendapps/util/ProfileSerializer.java b/opendapps/src/main/java/org/apache/oodt/opendapps/util/ProfileSerializer.java
deleted file mode 100644
index 56de711..0000000
--- a/opendapps/src/main/java/org/apache/oodt/opendapps/util/ProfileSerializer.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.opendapps.util;
-
-//JDK imports
-import java.io.StringWriter;
-import java.util.List;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
-//OODT imports
-import org.apache.oodt.profile.Profile;
-
-/**
- * Utility class to serialize a list of profiles to an XML document.
- * <p/>
- * Based on functionality already contained in the OODT grid ProfileQueryServlet
- * class, but separated as a stand alone utility to reduce dependencies.
- *
- * @author Luca Cinquini
- *
- */
-public class ProfileSerializer {
-
- /**
- * Function to serialize a list of {@link Profile}s to XML.
- *
- * @param profiles
- * @return
- * @throws TransformerException
- */
- public static String toXML(final List<Profile> profiles)
- throws TransformerException {
-
- final StringWriter writer = new StringWriter();
- writer.append("<?xml version='1.0' encoding='UTF-8'?>");
- writer.append("<!DOCTYPE profiles PUBLIC '" + Profile.PROFILES_DTD_FPI + "' '").append(Profile.PROFILES_DTD_URL)
- .append("'>");
- writer.append("<profiles>");
-
- final Transformer transformer = createTransformer();
- final Document doc = Profile.createProfileDocument();
- for (final Profile profile : profiles) {
-
- Node profileNode = profile.toXML(doc);
- DOMSource source = new DOMSource(profileNode);
- StreamResult result = new StreamResult(writer);
- transformer.transform(source, result);
-
- }
-
- writer.append("</profiles>");
-
- return writer.toString();
-
- }
-
- /**
- * Create a transformer, properly configured for XML text serialization.
- *
- * @return a <code>Transformer</code> value.
- * @throws TransformerException
- * if an error occurs.
- */
- private static Transformer createTransformer() throws TransformerException {
-
- Transformer transformer;
- synchronized (TRANSFORMER_FACTORY) {
- transformer = TRANSFORMER_FACTORY.newTransformer();
- }
-
- transformer.setOutputProperty(OutputKeys.METHOD, "xml");
- transformer.setOutputProperty(OutputKeys.VERSION, "1.0");
- transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
- transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
- transformer.setOutputProperty(OutputKeys.STANDALONE, "no");
- transformer.setOutputProperty(OutputKeys.INDENT, "yes");
- transformer.setOutputProperty(OutputKeys.MEDIA_TYPE, "text/xml");
- transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount",
- "4");
-
- return transformer;
- }
-
- /** Sole transformer factory this class will ever need. */
- private static final TransformerFactory TRANSFORMER_FACTORY = TransformerFactory
- .newInstance();
-
-}
[13/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/api/src/main/java/org/apache/oodt/cas/protocol/verify/BasicProtocolVerifier.java
----------------------------------------------------------------------
diff --git a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/verify/BasicProtocolVerifier.java b/protocol/api/src/main/java/org/apache/oodt/cas/protocol/verify/BasicProtocolVerifier.java
deleted file mode 100644
index b276d14..0000000
--- a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/verify/BasicProtocolVerifier.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.verify;
-
-//JDK imports
-import java.net.URI;
-import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-//OODT imports
-import org.apache.oodt.cas.protocol.Protocol;
-import org.apache.oodt.cas.protocol.ProtocolFile;
-import org.apache.oodt.cas.protocol.auth.Authentication;
-import org.apache.oodt.cas.protocol.exceptions.ProtocolException;
-
-/**
- * {@link ProtocolVerifier} which performs basic verification of a given {@link Protocol} to
- * a given site. It check that {@link Protocol} can connect to the site, cd to a directory,
- * cd back to HOME directory, and able to perform an ls and pwd.
- *
- * @author bfoster
- */
-public class BasicProtocolVerifier implements ProtocolVerifier {
-
- private static final Logger LOG = Logger.getLogger(BasicProtocolVerifier.class.getName());
-
- private Map<URI, ProtocolFile> uriTestCdMap;
-
- public BasicProtocolVerifier(Map<URI, ProtocolFile> uriTestCdMap) {
- this.uriTestCdMap = uriTestCdMap;
- }
-
- public boolean verify(Protocol protocol, URI site, Authentication auth) {
- try {
- LOG.log(Level.INFO, "Testing protocol "
- + protocol.getClass().getCanonicalName()
- + " . . . this may take a few minutes . . .");
-
- // Test connectivity
- protocol.connect(site.getHost(), auth);
-
- // Test ls, cd, and pwd
- protocol.cdHome();
- ProtocolFile home = protocol.pwd();
- protocol.ls();
- if (uriTestCdMap.containsKey(site)) {
- protocol.cd(uriTestCdMap.get(site));
- } else {
- protocol.cdHome();
- }
- protocol.cdHome();
-
- // Verify again at home directory
- if (home == null || !home.equals(protocol.pwd())) {
- throw new ProtocolException(
- "Home directory not the same after cd");
- }
- } catch (Exception e) {
- LOG.log(Level.SEVERE, "Protocol "
- + protocol.getClass().getCanonicalName()
- + " failed compatibility test : " + e.getMessage(), e);
- return false;
- } finally {
- try { protocol.close(); } catch (Exception ignored) {}
- }
- return true;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/api/src/main/java/org/apache/oodt/cas/protocol/verify/BasicProtocolVerifierFactory.java
----------------------------------------------------------------------
diff --git a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/verify/BasicProtocolVerifierFactory.java b/protocol/api/src/main/java/org/apache/oodt/cas/protocol/verify/BasicProtocolVerifierFactory.java
deleted file mode 100644
index e4646fc..0000000
--- a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/verify/BasicProtocolVerifierFactory.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.verify;
-
-//JDK imports
-import java.net.URI;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.Map;
-
-//OODT imports
-import org.apache.oodt.cas.protocol.ProtocolFile;
-
-/**
- * {@link ProtocolVerifierFactory} which creates {@link BasicProtocolVerifier}.
- *
- * @author bfoster
- */
-public class BasicProtocolVerifierFactory implements ProtocolVerifierFactory {
-
- private Map<URI, ProtocolFile> testCdMap;
-
- public ProtocolVerifier newInstance() {
- if (testCdMap != null) {
- return new BasicProtocolVerifier(testCdMap);
- } else {
- return new BasicProtocolVerifier(new ConcurrentHashMap<URI, ProtocolFile>());
- }
- }
-
- public void setTestCdMap(Map<URI, ProtocolFile> testCdMap) {
- this.testCdMap = testCdMap;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/api/src/main/java/org/apache/oodt/cas/protocol/verify/ProtocolVerifier.java
----------------------------------------------------------------------
diff --git a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/verify/ProtocolVerifier.java b/protocol/api/src/main/java/org/apache/oodt/cas/protocol/verify/ProtocolVerifier.java
deleted file mode 100644
index 6463006..0000000
--- a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/verify/ProtocolVerifier.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.verify;
-
-//JDK imports
-import java.net.URI;
-
-//OODT imports
-import org.apache.oodt.cas.protocol.Protocol;
-import org.apache.oodt.cas.protocol.auth.Authentication;
-
-/**
- * Interface for verifying {@link Protocol}s can connect to sites.
- *
- * @author bfoster
- */
-public interface ProtocolVerifier {
-
- boolean verify(Protocol protocol, URI site, Authentication auth);
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/api/src/main/java/org/apache/oodt/cas/protocol/verify/ProtocolVerifierFactory.java
----------------------------------------------------------------------
diff --git a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/verify/ProtocolVerifierFactory.java b/protocol/api/src/main/java/org/apache/oodt/cas/protocol/verify/ProtocolVerifierFactory.java
deleted file mode 100644
index 3d257a3..0000000
--- a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/verify/ProtocolVerifierFactory.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.verify;
-
-/**
- * Factory for creating {@link ProtocolVerifier}s
- *
- * @author bfoster
- */
-public interface ProtocolVerifierFactory {
-
- ProtocolVerifier newInstance();
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/api/src/main/resources/policy/cmd-line-actions.xml
----------------------------------------------------------------------
diff --git a/protocol/api/src/main/resources/policy/cmd-line-actions.xml b/protocol/api/src/main/resources/policy/cmd-line-actions.xml
deleted file mode 100644
index 90487bf..0000000
--- a/protocol/api/src/main/resources/policy/cmd-line-actions.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!--
- Author: bfoster
- Description: ProtocolManager Configuration
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
- <bean id="Download" class="org.apache.oodt.cas.protocol.cli.action.DownloadCliAction">
- <property name="description" value="Downloads a file" />
- </bean>
- <bean id="GetSupportedFactories" class="org.apache.oodt.cas.protocol.cli.action.GetSupportedFactoriesCliAction">
- <property name="description" value="Prints out list of supported ProtocolFactory(s)" />
- </bean>
- <bean id="CrossProtocolTransfer" class="org.apache.oodt.cas.protocol.cli.action.CrossProtocolTransferCliAction">
- <property name="description" value="Transfers a file across 2 different protocols" />
- <property name="verifierFactory" ref="BasicVerifier" />
- </bean>
- <bean id="DeleteEmptyDirectories" class="org.apache.oodt.cas.protocol.cli.action.DeleteEmptyDirectoriesCliAction">
- <property name="description" value="Deletes empty directories from a given site" />
- <property name="verifierFactory" ref="BasicVerifier" />
- </bean>
-
- <bean id="BasicVerifier" class="org.apache.oodt.cas.protocol.verify.BasicProtocolVerifierFactory" />
-</beans>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/api/src/main/resources/policy/cmd-line-options.xml
----------------------------------------------------------------------
diff --git a/protocol/api/src/main/resources/policy/cmd-line-options.xml b/protocol/api/src/main/resources/policy/cmd-line-options.xml
deleted file mode 100644
index 66eaa9c..0000000
--- a/protocol/api/src/main/resources/policy/cmd-line-options.xml
+++ /dev/null
@@ -1,166 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!-- Author: bfoster Description: ProtocolManager Configuration -->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
- <bean id="user" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
- <property name="shortOption" value="u" />
- <property name="longOption" value="user" />
- <property name="description" value="Username for authentication" />
- <property name="hasArgs" value="true" />
- <property name="argsDescription" value="username" />
- <property name="requirementRules">
- <list>
- <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
- p:actionName="Download" p:relation="OPTIONAL" />
- </list>
- </property>
- <property name="handler">
- <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler">
- <property name="applyToActions">
- <list>
- <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
- p:actionName="Download" />
- </list>
- </property>
- </bean>
- </property>
- </bean>
-
- <bean id="pass" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
- <property name="shortOption" value="p" />
- <property name="longOption" value="pass" />
- <property name="description" value="Password for authentication" />
- <property name="hasArgs" value="true" />
- <property name="argsDescription" value="password" />
- <property name="requirementRules">
- <list>
- <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
- p:actionName="Download" p:relation="OPTIONAL" />
- </list>
- </property>
- <property name="handler">
- <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler">
- <property name="applyToActions">
- <list>
- <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
- p:actionName="Download" />
- </list>
- </property>
- </bean>
- </property>
- </bean>
-
- <bean id="url" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
- <property name="shortOption" value="url" />
- <property name="longOption" value="url" />
- <property name="description" value="URL to download" />
- <property name="hasArgs" value="true" />
- <property name="argsDescription" value="URL" />
- <property name="requirementRules">
- <list>
- <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
- p:actionName="Download" p:relation="REQUIRED" />
- </list>
- </property>
- <property name="handler">
- <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler">
- <property name="applyToActions">
- <list>
- <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
- p:actionName="Download" />
- </list>
- </property>
- </bean>
- </property>
- </bean>
-
- <bean id="fromUrl" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
- <property name="shortOption" value="fu" />
- <property name="longOption" value="fromUrl" />
- <property name="description" value="URL to get file" />
- <property name="hasArgs" value="true" />
- <property name="argsDescription" value="URL" />
- <property name="requirementRules">
- <list>
- <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
- p:actionName="CrossProtocolTransfer" p:relation="REQUIRED" />
- </list>
- </property>
- <property name="handler">
- <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler">
- <property name="applyToActions">
- <list>
- <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
- p:actionName="CrossProtocolTransfer" p:methodName="setFromUri" />
- </list>
- </property>
- </bean>
- </property>
- </bean>
-
- <bean id="toUrl" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
- <property name="shortOption" value="tu" />
- <property name="longOption" value="toUrl" />
- <property name="description" value="URL to send file" />
- <property name="hasArgs" value="true" />
- <property name="argsDescription" value="URL" />
- <property name="requirementRules">
- <list>
- <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
- p:actionName="CrossProtocolTransfer" p:relation="REQUIRED" />
- </list>
- </property>
- <property name="handler">
- <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler">
- <property name="applyToActions">
- <list>
- <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
- p:actionName="CrossProtocolTransfer" p:methodName="setToUri" />
- </list>
- </property>
- </bean>
- </property>
- </bean>
-
- <bean id="directoriesRegex" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
- <property name="shortOption" value="dr" />
- <property name="longOption" value="dirsRegex" />
- <property name="description" value="Directory regex of directories to delete" />
- <property name="hasArgs" value="true" />
- <property name="argsDescription" value="URL" />
- <property name="requirementRules">
- <list>
- <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
- p:actionName="DeleteEmptyDirectories" p:relation="REQUIRED" />
- </list>
- </property>
- <property name="handler">
- <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler">
- <property name="applyToActions">
- <list>
- <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
- p:actionName="DeleteEmptyDirectories" p:methodName="setDirectoryRegex" />
- </list>
- </property>
- </bean>
- </property>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/api/src/main/resources/policy/protocol-config.xml
----------------------------------------------------------------------
diff --git a/protocol/api/src/main/resources/policy/protocol-config.xml b/protocol/api/src/main/resources/policy/protocol-config.xml
deleted file mode 100644
index 0142004..0000000
--- a/protocol/api/src/main/resources/policy/protocol-config.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!--
-
- Author: bfoster
- Description: ProtocolManager Configuration
-
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:p="http://www.springframework.org/schema/p"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
- <import resource="classpath*:/org/apache/oodt/cas/protocol/**/*-protocol-config.xml"/>
-
-</beans>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/api/src/test/java/org/apache/oodt/cas/protocol/MockProtocol.java
----------------------------------------------------------------------
diff --git a/protocol/api/src/test/java/org/apache/oodt/cas/protocol/MockProtocol.java b/protocol/api/src/test/java/org/apache/oodt/cas/protocol/MockProtocol.java
deleted file mode 100644
index 4677a77..0000000
--- a/protocol/api/src/test/java/org/apache/oodt/cas/protocol/MockProtocol.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol;
-
-//JDK imports
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-//OODT imports
-import org.apache.oodt.cas.protocol.auth.Authentication;
-import org.apache.oodt.cas.protocol.exceptions.ProtocolException;
-import org.apache.oodt.cas.protocol.util.ProtocolFileFilter;
-
-/**
- * Mock {@link Protocol} for testing
- *
- * @author bfoster
- */
-public class MockProtocol implements Protocol {
-
- private boolean connected;
- private ProtocolFile cwd;
- private String factoryId;
-
- private List<ProtocolFile> deletedFiles;
- private List<ProtocolFile> putFiles;
- private List<ProtocolFile> getFiles;
- private int timesConnected;
-
- public MockProtocol(String factoryId) {
- connected = false;
- this.factoryId = factoryId;
- deletedFiles = new ArrayList<ProtocolFile>();
- putFiles = new ArrayList<ProtocolFile>();
- getFiles = new ArrayList<ProtocolFile>();
- timesConnected = 0;
- }
-
- public String getFactoryId() {
- return factoryId;
- }
-
- public void connect(String host, Authentication authentication)
- throws ProtocolException {
- connected = true;
- deletedFiles.clear();
- putFiles.clear();
- getFiles.clear();
- timesConnected++;
- }
-
- public int getTimesConnected() {
- return timesConnected;
- }
-
- public void close() throws ProtocolException {
- connected = false;
- }
-
- public boolean connected() {
- return connected;
- }
-
- public void cd(ProtocolFile file) throws ProtocolException {
- cwd = file;
- }
-
- public void cdHome() throws ProtocolException {
- cwd = new ProtocolFile("", true);
- }
-
- public void cdRoot() throws ProtocolException {
- cwd = new ProtocolFile("/", true);
- }
-
- public void get(ProtocolFile fromFile, File toFile)
- throws ProtocolException {
- getFiles.add(fromFile);
- }
-
- public List<ProtocolFile> getGetFiles() {
- return getFiles;
- }
-
- public void put(File fromFile, ProtocolFile toFile)
- throws ProtocolException {
- putFiles.add(toFile);
- }
-
- public List<ProtocolFile> getPutFiles() {
- return putFiles;
- }
-
- public ProtocolFile pwd() throws ProtocolException {
- return cwd;
- }
-
- public List<ProtocolFile> ls() throws ProtocolException {
- return Collections.emptyList();
- }
-
- public List<ProtocolFile> ls(ProtocolFileFilter filter) throws ProtocolException {
- return Collections.emptyList();
- }
-
- public void delete(ProtocolFile file) throws ProtocolException {
- deletedFiles.add(file);
- }
-
- public List<ProtocolFile> getDeletedFiles() {
- return deletedFiles;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/api/src/test/java/org/apache/oodt/cas/protocol/MockProtocolFactory.java
----------------------------------------------------------------------
diff --git a/protocol/api/src/test/java/org/apache/oodt/cas/protocol/MockProtocolFactory.java b/protocol/api/src/test/java/org/apache/oodt/cas/protocol/MockProtocolFactory.java
deleted file mode 100644
index ee80362..0000000
--- a/protocol/api/src/test/java/org/apache/oodt/cas/protocol/MockProtocolFactory.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol;
-
-//OODT imports
-import org.apache.oodt.commons.spring.SpringSetIdInjectionType;
-
-/**
- * Mock {@link ProtocolFactory} for testing
- *
- * @author bfoster
- */
-public class MockProtocolFactory implements ProtocolFactory, SpringSetIdInjectionType {
-
- private String schema;
- private String id;
-
- public MockProtocol newInstance() {
- return new MockProtocol(id);
- }
-
- public String getSchema() {
- return schema;
- }
-
- public void setSchema(String schema) {
- this.schema = schema;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/api/src/test/java/org/apache/oodt/cas/protocol/TestProtocolFile.java
----------------------------------------------------------------------
diff --git a/protocol/api/src/test/java/org/apache/oodt/cas/protocol/TestProtocolFile.java b/protocol/api/src/test/java/org/apache/oodt/cas/protocol/TestProtocolFile.java
deleted file mode 100644
index 0d7cdeb..0000000
--- a/protocol/api/src/test/java/org/apache/oodt/cas/protocol/TestProtocolFile.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol;
-
-//JDK imports
-
-//JUnit imports
-import junit.framework.TestCase;
-
-/**
- * Test class for {@link ProtocolFile}
- *
- * @author bfoster
- */
-public class TestProtocolFile extends TestCase {
-
- public void testInitialState() {
- String filePath = ProtocolFile.SEPARATOR + "path" + ProtocolFile.SEPARATOR + "to" + ProtocolFile.SEPARATOR + "file";
- ProtocolFile pFile = new ProtocolFile(filePath, false);
- assertEquals(filePath, pFile.getPath());
- assertEquals("file", pFile.getName());
- assertFalse(pFile.isDir());
- assertFalse(pFile.isRelative());
-
- // Test Parent file
- String parentPath = ProtocolFile.SEPARATOR + "path" + ProtocolFile.SEPARATOR + "to";
- assertEquals(parentPath, pFile.getParent().getPath());
- assertEquals("to", pFile.getParent().getName());
- assertTrue(pFile.getParent().isDir());
- assertFalse(pFile.getParent().isRelative());
- }
-
- public void testEquals() {
- assertEquals(new ProtocolFile("/test/directory", true), new ProtocolFile(
- new ProtocolFile("/test", true), "directory", true));
- assertEquals(new ProtocolFile(new ProtocolFile("/", true), "repo", true), new ProtocolFile("/repo", true));
- assertEquals(new ProtocolFile(new ProtocolFile("/", true), "", true), new ProtocolFile("/", true));
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/api/src/test/java/org/apache/oodt/cas/protocol/auth/TestBasicAuthentication.java
----------------------------------------------------------------------
diff --git a/protocol/api/src/test/java/org/apache/oodt/cas/protocol/auth/TestBasicAuthentication.java b/protocol/api/src/test/java/org/apache/oodt/cas/protocol/auth/TestBasicAuthentication.java
deleted file mode 100644
index ab40e7f..0000000
--- a/protocol/api/src/test/java/org/apache/oodt/cas/protocol/auth/TestBasicAuthentication.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.auth;
-
-//JUnit imports
-import junit.framework.TestCase;
-
-/**
- * Test class for {@link BasicAuthentication}
- *
- * @author bfoster
- */
-public class TestBasicAuthentication extends TestCase {
-
- public void testInitialState() {
- BasicAuthentication auth = new BasicAuthentication("user", "pass");
- assertEquals("user", auth.getUser());
- assertEquals("pass", auth.getPass());
- }
-
- public void testNullCase() {
- try {
- new BasicAuthentication(null, "pass");
- fail("Should have thrown IllegalArgumentException");
- }catch (IllegalArgumentException ignored) {}
- try {
- new BasicAuthentication("user", null);
- fail("Should have thrown IllegalArgumentException");
- }catch (IllegalArgumentException ignored) {}
- try {
- new BasicAuthentication(null, null);
- fail("Should have thrown IllegalArgumentException");
- }catch (IllegalArgumentException ignored) {}
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/api/src/test/java/org/apache/oodt/cas/protocol/auth/TestNoAuthentication.java
----------------------------------------------------------------------
diff --git a/protocol/api/src/test/java/org/apache/oodt/cas/protocol/auth/TestNoAuthentication.java b/protocol/api/src/test/java/org/apache/oodt/cas/protocol/auth/TestNoAuthentication.java
deleted file mode 100644
index 51195e4..0000000
--- a/protocol/api/src/test/java/org/apache/oodt/cas/protocol/auth/TestNoAuthentication.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.auth;
-
-//JUnit imports
-import junit.framework.TestCase;
-
-/**
- * Test class for {@link NoAuthentication}.
- *
- * @author bfoster
- */
-public class TestNoAuthentication extends TestCase {
-
- public void testInitialState() {
- NoAuthentication auth = new NoAuthentication();
- assertEquals("", auth.getUser());
- assertEquals("", auth.getPass());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/api/src/test/java/org/apache/oodt/cas/protocol/cli/action/MockProtocolCliAction.java
----------------------------------------------------------------------
diff --git a/protocol/api/src/test/java/org/apache/oodt/cas/protocol/cli/action/MockProtocolCliAction.java b/protocol/api/src/test/java/org/apache/oodt/cas/protocol/cli/action/MockProtocolCliAction.java
deleted file mode 100644
index 351fc62..0000000
--- a/protocol/api/src/test/java/org/apache/oodt/cas/protocol/cli/action/MockProtocolCliAction.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.cli.action;
-
-//OODT imports
-import org.apache.oodt.cas.cli.exception.CmdLineActionException;
-
-/**
- * Mock class for {@ProtocolAction}.
- *
- * @author bfoster (Brian Foster)
- */
-public class MockProtocolCliAction extends ProtocolCliAction {
-
- @Override
- public void execute(ActionMessagePrinter printer)
- throws CmdLineActionException {
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/api/src/test/java/org/apache/oodt/cas/protocol/cli/action/TestBasicVerifyCliAction.java
----------------------------------------------------------------------
diff --git a/protocol/api/src/test/java/org/apache/oodt/cas/protocol/cli/action/TestBasicVerifyCliAction.java b/protocol/api/src/test/java/org/apache/oodt/cas/protocol/cli/action/TestBasicVerifyCliAction.java
deleted file mode 100644
index c46671f..0000000
--- a/protocol/api/src/test/java/org/apache/oodt/cas/protocol/cli/action/TestBasicVerifyCliAction.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.cli.action;
-
-//JDK imports
-import java.net.URI;
-
-//JUnit imports
-import junit.framework.TestCase;
-
-//OODT imports
-import org.apache.oodt.cas.cli.action.CmdLineAction.ActionMessagePrinter;
-import org.apache.oodt.cas.protocol.Protocol;
-import org.apache.oodt.cas.protocol.auth.Authentication;
-import org.apache.oodt.cas.protocol.config.MockSpringProtocolConfig;
-import org.apache.oodt.cas.protocol.system.ProtocolManager;
-import org.apache.oodt.cas.protocol.verify.ProtocolVerifier;
-
-/**
- * Test class for {@link BasicVerifyCliAction}
- *
- * @author bfoster (Brian Foster)
- */
-public class TestBasicVerifyCliAction extends TestCase {
-
- public void testVerification() throws Exception {
- BasicVerifyCliAction bva = new BasicVerifyCliAction();
- bva.setSite("http://localhost");
- bva.setVerifier(new ProtocolVerifier() {
- public boolean verify(Protocol protocol, URI site,
- Authentication auth) {
- return auth != null && site.toString().equals("http://localhost");
- }
- });
- bva.setProtocolManager(new ProtocolManager(new MockSpringProtocolConfig()));
- bva.execute(new ActionMessagePrinter());
- assertTrue(bva.getLastVerificationResults());
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/api/src/test/java/org/apache/oodt/cas/protocol/cli/action/TestDownloadCliAction.java
----------------------------------------------------------------------
diff --git a/protocol/api/src/test/java/org/apache/oodt/cas/protocol/cli/action/TestDownloadCliAction.java b/protocol/api/src/test/java/org/apache/oodt/cas/protocol/cli/action/TestDownloadCliAction.java
deleted file mode 100644
index 21dae0e..0000000
--- a/protocol/api/src/test/java/org/apache/oodt/cas/protocol/cli/action/TestDownloadCliAction.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.cli.action;
-
-//JDK imports
-import java.net.URISyntaxException;
-
-//OODT imports
-import org.apache.oodt.cas.cli.action.CmdLineAction.ActionMessagePrinter;
-import org.apache.oodt.cas.protocol.MockProtocol;
-import org.apache.oodt.cas.protocol.Protocol;
-import org.apache.oodt.cas.protocol.ProtocolFile;
-import org.apache.oodt.cas.protocol.config.MockSpringProtocolConfig;
-import org.apache.oodt.cas.protocol.system.ProtocolManager;
-
-//JUnit imports
-import junit.framework.TestCase;
-
-/**
- * Test class for {@link DownloadCliAction}.
- *
- * @author bfoster (Brian Foster)
- */
-public class TestDownloadCliAction extends TestCase {
-
- private ProtocolManager pm;
-
- @Override
- public void setUp() {
- pm = new ProtocolManager(new MockSpringProtocolConfig());
- }
-
- public void testCreateProtocol() throws URISyntaxException {
- DownloadCliAction da = new DownloadCliAction();
- da.setUrl("http://localhost/some/file");
- Protocol protocol = da.createProtocol(pm);
- assertNotNull(protocol);
- assertTrue(protocol instanceof MockProtocol);
- assertEquals("http1", ((MockProtocol) protocol).getFactoryId());
- }
-
- public void testCreateProtocolFile() throws URISyntaxException {
- DownloadCliAction da = new DownloadCliAction();
- da.setUrl("http://localhost/some/file");
- ProtocolFile file = da.createProtocolFile();
- assertNotNull(file);
- assertEquals("/some/file", file.getPath());
- assertFalse(file.isRelative());
- assertFalse(file.isDir());
- }
-
- public void testFileDownload() throws Exception {
- DownloadCliAction da = new DownloadCliAction();
- da.setUrl("http://localhost/some/file");
- da.setProtocolManager(pm);
- da.execute(new ActionMessagePrinter());
- assertNotNull(da.getUsedProtocol());
- assertTrue(da.getUsedProtocol() instanceof MockProtocol);
- assertEquals(1, ((MockProtocol) da.getUsedProtocol()).getGetFiles().size());
- assertEquals("/some/file", ((MockProtocol) da.getUsedProtocol()).getGetFiles().get(0).getPath());
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/api/src/test/java/org/apache/oodt/cas/protocol/cli/action/TestProtocolCliAction.java
----------------------------------------------------------------------
diff --git a/protocol/api/src/test/java/org/apache/oodt/cas/protocol/cli/action/TestProtocolCliAction.java b/protocol/api/src/test/java/org/apache/oodt/cas/protocol/cli/action/TestProtocolCliAction.java
deleted file mode 100644
index ab88c45..0000000
--- a/protocol/api/src/test/java/org/apache/oodt/cas/protocol/cli/action/TestProtocolCliAction.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.cli.action;
-
-//JDK imports
-import java.net.URISyntaxException;
-
-//JUnit imports
-import junit.framework.TestCase;
-
-/**
- * Test class for {@link ProtocolCliAction}.
- *
- * @author bfoster (Brian Foster)
- */
-public class TestProtocolCliAction extends TestCase {
-
- public void testInitialState() throws URISyntaxException {
- MockProtocolCliAction action = new MockProtocolCliAction();
- action.setUser("user");
- action.setPass("pass");
- action.setSite("http://some-site");
- assertEquals("user", action.getAuthentication().getUser());
- assertEquals("pass", action.getAuthentication().getPass());
- assertEquals("http://some-site", action.getSite().toString());
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/api/src/test/java/org/apache/oodt/cas/protocol/config/MockSpringProtocolConfig.java
----------------------------------------------------------------------
diff --git a/protocol/api/src/test/java/org/apache/oodt/cas/protocol/config/MockSpringProtocolConfig.java b/protocol/api/src/test/java/org/apache/oodt/cas/protocol/config/MockSpringProtocolConfig.java
deleted file mode 100644
index e4c7ceb..0000000
--- a/protocol/api/src/test/java/org/apache/oodt/cas/protocol/config/MockSpringProtocolConfig.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.config;
-
-import java.util.List;
-import java.util.Map;
-
-import org.apache.oodt.cas.protocol.ProtocolFactory;
-
-/**
- * Mock {@link SpringProtocolConfig}
- *
- * @author bfoster
- */
-public class MockSpringProtocolConfig extends SpringProtocolConfig {
-
- private static final String CONFIG_FILE = "src/test/resources/test-protocol-config.xml";
-
- public MockSpringProtocolConfig() {
- super(CONFIG_FILE);
- }
-
- public String getConfigFile() {
- return CONFIG_FILE;
- }
-
- public Map<String, List<ProtocolFactory>> getFactoryMap() {
- return factoryMap;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/api/src/test/java/org/apache/oodt/cas/protocol/system/TestProtocolManager.java
----------------------------------------------------------------------
diff --git a/protocol/api/src/test/java/org/apache/oodt/cas/protocol/system/TestProtocolManager.java b/protocol/api/src/test/java/org/apache/oodt/cas/protocol/system/TestProtocolManager.java
deleted file mode 100644
index b6184ad..0000000
--- a/protocol/api/src/test/java/org/apache/oodt/cas/protocol/system/TestProtocolManager.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.system;
-
-//JDK imports
-import java.net.URI;
-import java.net.URISyntaxException;
-
-//OODT imports
-import org.apache.oodt.cas.protocol.MockProtocol;
-import org.apache.oodt.cas.protocol.Protocol;
-import org.apache.oodt.cas.protocol.auth.Authentication;
-import org.apache.oodt.cas.protocol.auth.NoAuthentication;
-import org.apache.oodt.cas.protocol.config.MockSpringProtocolConfig;
-import org.apache.oodt.cas.protocol.verify.ProtocolVerifier;
-
-//JUnit imports
-import junit.framework.TestCase;
-
-/**
- * Test class for {@link ProtocolManager}.
- *
- * @author bfoster
- */
-public class TestProtocolManager extends TestCase {
-
- private ProtocolManager protocolManager;
-
- @Override
- public void setUp() {
- protocolManager = new ProtocolManager(new MockSpringProtocolConfig());
- }
-
- public void testInitialState() {
- assertNotNull(protocolManager.getConfig());
- }
-
- public void testProtocolFactoryMapping() throws URISyntaxException {
- Protocol protocol = protocolManager.getProtocolBySite(new URI("ftp://localhost"), new NoAuthentication(), null);
- assertNotNull(protocol);
- assertTrue(protocol instanceof MockProtocol);
- MockProtocol mockProtocol = (MockProtocol) protocol;
- assertEquals("ftp1", mockProtocol.getFactoryId());
-
- //test that ftp1 was memorized and is returned again even though a Verifier was supplied this time that would return ftp3
- protocol = protocolManager.getProtocolBySite(new URI("ftp://localhost"), new NoAuthentication(), new ProtocolVerifier() {
- public boolean verify(Protocol protocol, URI site,
- Authentication auth) {
- if (protocol instanceof MockProtocol) {
- MockProtocol mockProtocol = (MockProtocol) protocol;
- return mockProtocol.getFactoryId().equals("ftp3");
- } else {
- return false;
- }
- }
- });
- assertNotNull(protocol);
- assertTrue(protocol instanceof MockProtocol);
- mockProtocol = (MockProtocol) protocol;
- assertEquals("ftp1", mockProtocol.getFactoryId());
-
- }
-
- public void testVerifier() throws URISyntaxException {
- Protocol protocol = protocolManager.getProtocolBySite(new URI("ftp://localhost"), new NoAuthentication(), new ProtocolVerifier() {
- public boolean verify(Protocol protocol, URI site,
- Authentication auth) {
- if (protocol instanceof MockProtocol) {
- MockProtocol mockProtocol = (MockProtocol) protocol;
- return mockProtocol.getFactoryId().equals("ftp3");
- } else {
- return false;
- }
- }
- });
- assertTrue(protocol instanceof MockProtocol);
- MockProtocol mockProtocol = (MockProtocol) protocol;
- assertEquals("ftp3", mockProtocol.getFactoryId());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/api/src/test/resources/test-protocol-config.xml
----------------------------------------------------------------------
diff --git a/protocol/api/src/test/resources/test-protocol-config.xml b/protocol/api/src/test/resources/test-protocol-config.xml
deleted file mode 100644
index ef84b73..0000000
--- a/protocol/api/src/test/resources/test-protocol-config.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!--
-
- Author: bfoster
- Description: ProtocolManager Configuration
-
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:p="http://www.springframework.org/schema/p"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
- <bean class="org.apache.oodt.commons.spring.postprocessor.SetIdBeanPostProcessor"/>
-
- <!-- list ProtocolFactories here -->
- <bean id="ftp1" class="org.apache.oodt.cas.protocol.MockProtocolFactory">
- <property name="schema" value="ftp"/>
- </bean>
- <bean id="ftp2" class="org.apache.oodt.cas.protocol.MockProtocolFactory">
- <property name="schema" value="ftp"/>
- </bean>
- <bean id="ftp3" class="org.apache.oodt.cas.protocol.MockProtocolFactory">
- <property name="schema" value="ftp"/>
- </bean>
-
- <bean id="sftp1" class="org.apache.oodt.cas.protocol.MockProtocolFactory">
- <property name="schema" value="sftp"/>
- </bean>
- <bean id="sftp2" class="org.apache.oodt.cas.protocol.MockProtocolFactory">
- <property name="schema" value="sftp"/>
- </bean>
-
- <bean id="http1" class="org.apache.oodt.cas.protocol.MockProtocolFactory">
- <property name="schema" value="http"/>
- </bean>
-
-</beans>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/ftp/.gitignore
----------------------------------------------------------------------
diff --git a/protocol/ftp/.gitignore b/protocol/ftp/.gitignore
deleted file mode 100644
index b54523f..0000000
--- a/protocol/ftp/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/maven-eclipse.xml
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/ftp/pom.xml
----------------------------------------------------------------------
diff --git a/protocol/ftp/pom.xml b/protocol/ftp/pom.xml
deleted file mode 100644
index 7c500d5..0000000
--- a/protocol/ftp/pom.xml
+++ /dev/null
@@ -1,122 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
- license agreements. See the NOTICE file distributed with this work for additional
- information regarding copyright ownership. The ASF licenses this file to
- You under the Apache License, Version 2.0 (the "License"); you may not use
- this file except in compliance with the License. You may obtain a copy of
- the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
- by applicable law or agreed to in writing, software distributed under the
- License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, either express or implied. See the License for the specific
- language governing permissions and limitations under the License. -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.oodt</groupId>
- <artifactId>oodt-core</artifactId>
- <version>1.1-SNAPSHOT</version>
- <relativePath>../../core/pom.xml</relativePath>
- </parent>
- <artifactId>cas-protocol-ftp</artifactId>
- <name>CAS Protocol FTP Implementation</name>
- <!-- All dependencies should be listed in core/pom.xml and be ordered alphabetically by package and artifact.
- Once the dependency is in the core pom, it can then be used in other modules without the version tags.
- For example, within core/pom.xml:
-
- <dependency>
- <groupId>com.amazonaws</groupId>
- <artifactId>aws-java-sdk</artifactId>
- <version>1.7.4</version>
- </dependency>
-
- Elsewhere in the platform:
- <dependency>
- <groupId>com.amazonaws</groupId>
- <artifactId>aws-java-sdk</artifactId>
- </dependency>
-
- Where possible the same dependency version should be used across the whole platform but if required the version
- can be overridden in a specific pom and should have a comment explaing why the version has been overridden
- -->
- <dependencies>
- <dependency>
- <groupId>commons-net</groupId>
- <artifactId>commons-net</artifactId>
- <version>1.4.0</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.ftpserver</groupId>
- <artifactId>ftpserver-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.oodt</groupId>
- <artifactId>cas-protocol-api</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jglobus</groupId>
- <artifactId>gss</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jglobus</groupId>
- <artifactId>JGlobus-GridFTP</artifactId>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <build>
- <resources>
- <resource>
- <targetPath>org/apache/oodt/cas/protocol/ftp</targetPath>
- <directory>${basedir}/src/main/resources/policy</directory>
- <includes>
- <include>ftp-protocol-config.xml</include>
- </includes>
- </resource>
- </resources>
- </build>
- <profiles>
- <profile>
- <id>audit</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>rat-maven-plugin</artifactId>
- <configuration>
- <excludes>
- <exclude>**/resources/examples/**/*</exclude>
- </excludes>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>check</goal>
- </goals>
- <phase>verify</phase>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-</project>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/ftp/src/main/java/org/apache/oodt/cas/protocol/ftp/CogJGlobusFtpProtocol.java
----------------------------------------------------------------------
diff --git a/protocol/ftp/src/main/java/org/apache/oodt/cas/protocol/ftp/CogJGlobusFtpProtocol.java b/protocol/ftp/src/main/java/org/apache/oodt/cas/protocol/ftp/CogJGlobusFtpProtocol.java
deleted file mode 100644
index 3da3636..0000000
--- a/protocol/ftp/src/main/java/org/apache/oodt/cas/protocol/ftp/CogJGlobusFtpProtocol.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.ftp;
-
-//OODT imports
-import org.apache.oodt.cas.protocol.Protocol;
-import org.apache.oodt.cas.protocol.ProtocolFile;
-import org.apache.oodt.cas.protocol.auth.Authentication;
-import org.apache.oodt.cas.protocol.exceptions.ProtocolException;
-import org.apache.oodt.cas.protocol.util.ProtocolFileFilter;
-
-//Globus imports
-import org.globus.ftp.FTPClient;
-import org.globus.ftp.FileInfo;
-
-//JDK imports
-import java.io.File;
-import java.util.List;
-import java.util.Vector;
-
-/**
- * FTP implementation of a {@link Protocol}
- *
- * @author bfoster
- */
-public class CogJGlobusFtpProtocol implements Protocol {
-
- public static final int PORT = 21;
- private FTPClient ftp;
- private boolean isConnected;
- private int port;
- private String homeDir;
-
- public CogJGlobusFtpProtocol() {
- this(PORT);
- }
-
- public CogJGlobusFtpProtocol(int port) {
- this.port = port;
- }
-
- public void cd(ProtocolFile file) throws ProtocolException {
- try {
- ftp.changeDir(file.getPath());
- } catch (Exception e) {
- throw new ProtocolException("Failed to cd to " + file + " : "
- + e.getMessage());
- }
- }
-
- public void cdRoot() throws ProtocolException {
- cd(new ProtocolFile(ProtocolFile.SEPARATOR, true));
- }
-
- public void cdHome() throws ProtocolException {
- cd(new ProtocolFile(homeDir, true));
- }
-
- public void connect(String host, Authentication auth) throws ProtocolException {
- try {
- ftp = new FTPClient(host, port);
- } catch (Exception e) {
- throw new ProtocolException("Failed to connect to: " + host + " : "
- + e.getMessage(), e);
- }
- isConnected = true;
-
- try {
- ftp.authorize(auth.getUser(), auth.getPass());
- ftp.setActive(ftp.setLocalPassive());
- homeDir = ftp.getCurrentDir();
- } catch (Exception e) {
- throw new ProtocolException("Failed to login to: " + host + " : "
- + e.getMessage(), e);
- }
- }
-
- public void close() throws ProtocolException {
- try {
- ftp.close();
- isConnected = false;
- } catch (Exception e) {
- throw new ProtocolException("Error disconnecting from "
- + ftp.getHost() + " : " + e.getMessage());
- }
- }
-
- public void get(ProtocolFile fromFile, File toFile)
- throws ProtocolException {
- try {
- ftp.setActive(ftp.setLocalPassive());
- ftp.get(fromFile.getPath(), toFile);
- } catch (Exception e) {
- throw new ProtocolException("Failed to download: " + fromFile.getName()
- + " : " + e.getMessage());
- }
- }
-
- public void put(File fromFile, ProtocolFile toFile) throws ProtocolException {
- try {
- ftp.put(fromFile, toFile.getPath(), false);
- }catch (Exception e) {
- throw new ProtocolException("Failed to put file '" + fromFile + "' : " + e.getMessage(), e);
- }
- }
-
- /**
- * SetActive
- * Sets the FTP Active Protocol
- * Package protected so we can test the non FTP server parts of the codebase.
- * @throws ProtocolException
- */
- protected void setActive() throws ProtocolException {
- try {
- ftp.setActive(ftp.setLocalPassive());
- } catch (Exception e) {
- throw new ProtocolException("Failed to set ftp active : "
- + e.getMessage());
- }
- }
-
- /**
- * ftpList
- * Gets a file list from the FTP Server
- * Package protected so we can test the non server portion of the code.
- * @param filter
- * @param modifier
- * @return
- */
- protected Vector ftpList(String filter, String modifier) throws ProtocolException {
- try {
- return ftp.list(filter, modifier);
- } catch (Exception e) {
- throw new ProtocolException("Failed to get list of files : "
- + e.getMessage());
- }
-
- }
- public List<ProtocolFile> ls() throws ProtocolException {
- try {
- setActive();
- @SuppressWarnings("unchecked")
- Vector<FileInfo> fileList = (Vector<FileInfo>) ftpList("*", null);
- Vector<ProtocolFile> returnList = new Vector<ProtocolFile>();
- for (FileInfo file : fileList) {
- returnList.add(new ProtocolFile(this.pwd(), file.getName(), file.isDirectory()));
- }
- return returnList;
- } catch (Exception e) {
- throw new ProtocolException("Failed to get list of files : "
- + e.getMessage());
- }
- }
-
- public List<ProtocolFile> ls(ProtocolFileFilter filter) throws ProtocolException {
- try {
- ftp.setActive(ftp.setLocalPassive());
- @SuppressWarnings("unchecked")
- Vector<FileInfo> fileList = (Vector<FileInfo>) ftp.list("*", null);
- Vector<ProtocolFile> returnList = new Vector<ProtocolFile>();
- for (FileInfo file : fileList) {
- ProtocolFile pFile = new ProtocolFile(this.pwd(), file.getName(), file.isDirectory());
- if (filter.accept(pFile)) {
- returnList.add(pFile);
- }
- }
- return returnList;
- } catch (Exception e) {
- throw new ProtocolException("Failed to get list of files : "
- + e.getMessage());
- }
- }
-
- /**
- * Returns the current Directory.
- * Package protected so we can test the non ftp parts of the codebase.
- * @return
- * @throws ProtocolException
- */
- protected String getCurentDir() throws ProtocolException {
- try {
- return ftp.getCurrentDir();
- } catch (Exception e) {
- throw new ProtocolException("Failed to get current directory : "
- + e.getMessage());
- }
-
-
- }
-
- public ProtocolFile pwd() throws ProtocolException {
- try {
- return new ProtocolFile(getCurentDir(), true);
- } catch (Exception e) {
- throw new ProtocolException("Failed to pwd : " + e.getMessage());
- }
- }
-
- public boolean connected() {
- return isConnected;
- }
-
- public void delete(ProtocolFile file) throws ProtocolException {
- try {
- ftp.deleteFile(file.getPath());
- } catch (Exception e) {
- throw new ProtocolException("Failed to download file '"
- + file.getPath() + "' : " + e.getMessage(), e);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/ftp/src/main/java/org/apache/oodt/cas/protocol/ftp/CogJGlobusFtpProtocolFactory.java
----------------------------------------------------------------------
diff --git a/protocol/ftp/src/main/java/org/apache/oodt/cas/protocol/ftp/CogJGlobusFtpProtocolFactory.java b/protocol/ftp/src/main/java/org/apache/oodt/cas/protocol/ftp/CogJGlobusFtpProtocolFactory.java
deleted file mode 100644
index 9b96981..0000000
--- a/protocol/ftp/src/main/java/org/apache/oodt/cas/protocol/ftp/CogJGlobusFtpProtocolFactory.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.ftp;
-
-//OODT imports
-import org.apache.oodt.cas.protocol.ProtocolFactory;
-
-/**
- * Factory for creating {@link CogJGlobusFtpProtocol}s
- *
- * @author bfoster
- * @version $Revision$
- *
- */
-public class CogJGlobusFtpProtocolFactory implements ProtocolFactory {
-
- public CogJGlobusFtpProtocol newInstance() {
- return new CogJGlobusFtpProtocol();
- }
-
- public String getSchema() {
- return "ftp";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/ftp/src/main/java/org/apache/oodt/cas/protocol/ftp/CommonsNetFtpProtocol.java
----------------------------------------------------------------------
diff --git a/protocol/ftp/src/main/java/org/apache/oodt/cas/protocol/ftp/CommonsNetFtpProtocol.java b/protocol/ftp/src/main/java/org/apache/oodt/cas/protocol/ftp/CommonsNetFtpProtocol.java
deleted file mode 100644
index 06663e1..0000000
--- a/protocol/ftp/src/main/java/org/apache/oodt/cas/protocol/ftp/CommonsNetFtpProtocol.java
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.ftp;
-
-//JDK imports
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.OutputStream;
-import java.util.LinkedList;
-import java.util.List;
-
-//APACHE imports
-import org.apache.commons.net.ftp.FTPClient;
-import org.apache.commons.net.ftp.FTPFile;
-import org.apache.oodt.cas.protocol.Protocol;
-import org.apache.oodt.cas.protocol.ProtocolFile;
-import org.apache.oodt.cas.protocol.auth.Authentication;
-import org.apache.oodt.cas.protocol.exceptions.ProtocolException;
-import org.apache.oodt.cas.protocol.util.ProtocolFileFilter;
-
-/**
- * This class is responsible for FTP transfers. It is built as a wrapper around
- * Apache's FTPClient class in order to connect it into the Crawler's Protocol
- * infrastructure.
- *
- * @author bfoster
- *
- */
-public class CommonsNetFtpProtocol implements Protocol {
-
- private final FTPClient ftp;
- private String homeDir;
-
- /**
- * Creates a new FtpClient
- */
- public CommonsNetFtpProtocol() {
- ftp = new FTPClient();
- }
-
- /**
- * {@inheritDoc}
- */
- public void connect(String host, Authentication auth)
- throws ProtocolException {
- // server cannot be null
- if (host == null) {
- throw new ProtocolException("Tried to connect to server == NULL");
- }
-
- try {
- ftp.connect(host);
- ftp.enterLocalPassiveMode();
- } catch (Exception e) {
- throw new ProtocolException("Failed to connect to server : "
- + e.getMessage());
- }
-
- try {
- // try logging in
- if (!ftp.login(auth.getUser(), auth.getPass())) {
- throw new ProtocolException("Failed logging into host " + host
- + " as user " + auth.getUser());
- }
-
- // set file type to binary
- ftp.setFileType(FTPClient.BINARY_FILE_TYPE);
-
- homeDir = ftp.printWorkingDirectory();
- } catch (Exception e) {
- // login failed
- throw new ProtocolException("Exception thrown while logging into host "
- + host + " as user " + auth.getUser());
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public ProtocolFile pwd() throws ProtocolException {
- try {
- return new ProtocolFile(ftp.printWorkingDirectory(), true);
- } catch (Exception e) {
- throw new ProtocolException("Failed to pwd : " + e.getMessage());
- }
- }
-
- public List<ProtocolFile> ls() throws ProtocolException {
- try {
- String path = this.pwd().getPath();
- FTPFile[] files = ftp.listFiles();
- List<ProtocolFile> returnFiles = new LinkedList<ProtocolFile>();
- for (FTPFile file : files) {
- if (file == null) {
- continue;
- }
- returnFiles.add(new ProtocolFile(path + "/" + file.getName(), file
- .isDirectory()));
- }
- return returnFiles;
- } catch (Exception e) {
- throw new ProtocolException("Failed to get file list : " + e.getMessage());
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public List<ProtocolFile> ls(ProtocolFileFilter filter)
- throws ProtocolException {
- try {
- FTPFile[] files = ftp.listFiles();
- List<ProtocolFile> returnFiles = new LinkedList<ProtocolFile>();
- for (FTPFile file : files) {
- if (file == null) {
- continue;
- }
- String path = this.pwd().getPath();
- ProtocolFile pFile = new ProtocolFile(path + "/" + file.getName(), file
- .isDirectory());
- if (filter.accept(pFile)) {
- returnFiles.add(pFile);
- }
- }
- return returnFiles;
- } catch (Exception e) {
- throw new ProtocolException("Failed to get file list : " + e.getMessage());
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void get(ProtocolFile fromFile, File toFile) throws ProtocolException {
- // file or toLocalFile cannot be null
- if (fromFile == null || toFile == null) {
- throw new ProtocolException(
- "Can't download file -> ProtocolFile == null || toLocalFile == null");
- }
-
- // download file
- OutputStream os = null;
- try {
- os = new FileOutputStream(toFile);
- if (!ftp.retrieveFile(fromFile.getName(), os)) {
- throw new ProtocolException("Failed to download file "
- + fromFile.getName());
- }
- } catch (Exception e) {
- // download failed
- toFile.delete();
- throw new ProtocolException("FAILED to download: " + fromFile.getName()
- + " : " + e.getMessage(), e);
- } finally {
- // close output stream
- if (os != null) {
- try {
- os.close();
- } catch (Exception e) {
- toFile.delete();
- throw new ProtocolException("Failed to close outputstream : "
- + e.getMessage(), e);
- }
- }
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void put(File fromFile, ProtocolFile toFile) throws ProtocolException {
- try {
- ftp.storeFile(toFile.getPath(), new FileInputStream(fromFile));
- } catch (Exception e) {
- throw new ProtocolException("Failed to put file '" + fromFile + "' : "
- + e.getMessage(), e);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void cd(ProtocolFile file) throws ProtocolException {
- try {
- if (!ftp.changeWorkingDirectory(file.getPath())) {
- throw new Exception("Directory change method returned false");
- }
- } catch (Exception e) {
- throw new ProtocolException("Failed to cd to " + file.getPath() + " : "
- + e.getMessage());
- }
- }
-
- public void cdRoot() throws ProtocolException {
- cd(new ProtocolFile(ProtocolFile.SEPARATOR, true));
- }
-
- public void cdHome() throws ProtocolException {
- cd(new ProtocolFile(homeDir, true));
- }
-
- /**
- * {@inheritDoc}
- */
- public void close() throws ProtocolException {
- try {
- ftp.disconnect();
- } catch (Exception e) {
- throw new ProtocolException("Failed to disconnect from server");
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean connected() {
- return ftp.isConnected();
- }
-
- /**
- * {@inheritDoc}
- */
- public void delete(ProtocolFile file) throws ProtocolException {
- try {
- ftp.deleteFile(file.getPath());
- } catch (Exception e) {
- throw new ProtocolException("Failed to delete file '" + file.getPath()
- + "' : " + e.getMessage(), e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/ftp/src/main/java/org/apache/oodt/cas/protocol/ftp/CommonsNetFtpProtocolFactory.java
----------------------------------------------------------------------
diff --git a/protocol/ftp/src/main/java/org/apache/oodt/cas/protocol/ftp/CommonsNetFtpProtocolFactory.java b/protocol/ftp/src/main/java/org/apache/oodt/cas/protocol/ftp/CommonsNetFtpProtocolFactory.java
deleted file mode 100644
index 90cbd42..0000000
--- a/protocol/ftp/src/main/java/org/apache/oodt/cas/protocol/ftp/CommonsNetFtpProtocolFactory.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.ftp;
-
-//OODT imports
-import org.apache.oodt.cas.protocol.ProtocolFactory;
-
-/**
- * Constructs new {@link CommonsNetFtpProtocol}s.
- *
- * @author bfoster
- * @version $Revision$
- */
-public class CommonsNetFtpProtocolFactory implements ProtocolFactory {
-
- public CommonsNetFtpProtocol newInstance() {
- return new CommonsNetFtpProtocol();
- }
-
- public String getSchema() {
- return "ftp";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/ftp/src/main/resources/policy/ftp-protocol-config.xml
----------------------------------------------------------------------
diff --git a/protocol/ftp/src/main/resources/policy/ftp-protocol-config.xml b/protocol/ftp/src/main/resources/policy/ftp-protocol-config.xml
deleted file mode 100644
index 65b4ec4..0000000
--- a/protocol/ftp/src/main/resources/policy/ftp-protocol-config.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!--
-
- Author: bfoster
- Description: ProtocolManager Configuration
-
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:p="http://www.springframework.org/schema/p"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
- <bean class="org.apache.oodt.cas.protocol.ftp.CogJGlobusFtpProtocolFactory"/>
- <bean class="org.apache.oodt.cas.protocol.ftp.CommonsNetFtpProtocolFactory"/>
-
-</beans>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/ftp/src/test/java/org/apache/oodt/cas/protocol/ftp/TestCogJGlobusFtpProtocol.java
----------------------------------------------------------------------
diff --git a/protocol/ftp/src/test/java/org/apache/oodt/cas/protocol/ftp/TestCogJGlobusFtpProtocol.java b/protocol/ftp/src/test/java/org/apache/oodt/cas/protocol/ftp/TestCogJGlobusFtpProtocol.java
deleted file mode 100644
index 379276f..0000000
--- a/protocol/ftp/src/test/java/org/apache/oodt/cas/protocol/ftp/TestCogJGlobusFtpProtocol.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.protocol.ftp;
-
-//JUnit imports
-import java.io.File;
-import java.util.List;
-import java.util.Vector;
-
-//APACHE imports
-import org.apache.ftpserver.ConnectionConfigFactory;
-import org.apache.ftpserver.DataConnectionConfigurationFactory;
-import org.apache.ftpserver.FtpServer;
-import org.apache.ftpserver.FtpServerFactory;
-import org.apache.ftpserver.listener.ListenerFactory;
-import org.apache.ftpserver.usermanager.ClearTextPasswordEncryptor;
-import org.apache.ftpserver.usermanager.PropertiesUserManagerFactory;
-
-//OODT imports
-import org.apache.oodt.cas.protocol.ProtocolFile;
-import org.apache.oodt.cas.protocol.auth.BasicAuthentication;
-import org.apache.oodt.cas.protocol.exceptions.ProtocolException;
-
-//JUnit imports
-import junit.framework.TestCase;
-import org.globus.ftp.FileInfo;
-import org.mockito.Mockito;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
-
-import static org.mockito.Mockito.spy;
-
-/**
- * Test class for {@link CogJGlobusFtpProtocol}.
- *
- * @author bfoster
- */
-public class TestCogJGlobusFtpProtocol extends TestCase {
-
- private static final int PORT = 9000;
- private FtpServer server;
- private static final File USERS_FILE = new File("src/test/resources/users.properties");
-
- @Override
- public void setUp() throws Exception {
- assertTrue(USERS_FILE.getAbsolutePath() + " must exist",
- USERS_FILE.exists());
-
- FtpServerFactory serverFactory = new FtpServerFactory();
-
- serverFactory.setConnectionConfig(new ConnectionConfigFactory()
- .createConnectionConfig());
-
- ListenerFactory listenerFactory = new ListenerFactory();
-
- listenerFactory.setPort(PORT);
-
- listenerFactory
- .setDataConnectionConfiguration(new DataConnectionConfigurationFactory()
- .createDataConnectionConfiguration());
-
- serverFactory.addListener("default", listenerFactory.createListener());
-
- PropertiesUserManagerFactory umFactory = new PropertiesUserManagerFactory();
- umFactory.setPasswordEncryptor(new ClearTextPasswordEncryptor());
- umFactory.setFile(USERS_FILE);
-
- serverFactory.setUserManager(umFactory.createUserManager());
-
- server = serverFactory.createServer();
- //server.start();
- }
-
- @Override
- public void tearDown() {
- server.stop();
- }
-
- public void testLSandCDandPWD() throws ProtocolException {
-
- CogJGlobusFtpProtocol ftpProtocol = spy(new CogJGlobusFtpProtocol(PORT));
- BasicAuthentication auth = new BasicAuthentication("anonymous", "password");
-
- /** Mocking server responses to prevent server failure **/
-
- Mockito.doReturn("test/resources").when(ftpProtocol).getCurentDir();
-
- Vector<FileInfo> vector = new Vector<FileInfo>();
- FileInfo file = new FileInfo();
- file.setName("users.properties");
- byte b = 1;
- file.setFileType(b);
- vector.add(file);
-
- Mockito.doAnswer(new Answer() {
- public Object answer(InvocationOnMock invocation) {
- return null;
- }}).when(ftpProtocol).setActive();
-
- Mockito.doReturn(vector).when(ftpProtocol).ftpList("*", null);
-
- Mockito.doAnswer(new Answer() {
- public Object answer(InvocationOnMock invocation) {
- return null;
- }}).when(ftpProtocol).connect("localhost", auth);
-
- Mockito.doAnswer(new Answer() {
- public Object answer(InvocationOnMock invocation) {
- return null;
- }}).when(ftpProtocol).cd(new ProtocolFile("test/resources", true));
-
-
-
- ftpProtocol.connect("localhost", auth);
-
-
- ftpProtocol.cd(new ProtocolFile("test/resources", true));
-
- List<ProtocolFile> lsResults = ftpProtocol.ls();
- assertTrue(lsResults.contains(new ProtocolFile(ftpProtocol.pwd(), "users.properties", false)));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/ftp/src/test/resources/users.properties
----------------------------------------------------------------------
diff --git a/protocol/ftp/src/test/resources/users.properties b/protocol/ftp/src/test/resources/users.properties
deleted file mode 100644
index c4ace0b..0000000
--- a/protocol/ftp/src/test/resources/users.properties
+++ /dev/null
@@ -1,26 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-ftpserver.user.anonymous.userpassword=
-ftpserver.user.anonymous.maxloginperip=2
-ftpserver.user.anonymous.uploadrate=4800
-ftpserver.user.anonymous.writepermission=false
-ftpserver.user.anonymous.maxloginnumber=20
-ftpserver.user.anonymous.enableflag=true
-ftpserver.user.anonymous.homedirectory=src
-ftpserver.user.anonymous.idletime=300
-ftpserver.user.anonymous.downloadrate=4800
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/protocol/http/.gitignore
----------------------------------------------------------------------
diff --git a/protocol/http/.gitignore b/protocol/http/.gitignore
deleted file mode 100644
index b54523f..0000000
--- a/protocol/http/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/maven-eclipse.xml
[43/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/scripts/widgets/FilterWidget.php
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/scripts/widgets/FilterWidget.php b/balance/modules/cas-browser/scripts/widgets/FilterWidget.php
deleted file mode 100644
index 1b0dd3e..0000000
--- a/balance/modules/cas-browser/scripts/widgets/FilterWidget.php
+++ /dev/null
@@ -1,136 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-class FilterWidget
- implements Org_Apache_Oodt_Balance_Interfaces_IApplicationWidget {
-
- // The ProductType that the widget is filtering. This must be set before calling
- // render() or renderScript().
- public $productType;
-
- // The ID of the HTMLElement that will be modified by filter results. This must be set before
- // calling renderScript().
- public $htmlID;
-
- // The ID of the HTMLElement that contains the loading icon that will be
- // displayed while getting results
- public $loadingID;
-
- // The url of the site base
- public $siteUrl;
-
- // Whether filtered results will be displayed all at once or in a paged format
- public $pagedResults;
-
- // Will results be returned in html or json
- public $resultFormat;
-
- public function __construct($options = array()){
- if(isset($options['productType'])){
- $this->productType = $options['productType'];
- }
- if(isset($options['htmlID'])){
- $this->htmlID = $options['htmlID'];
- }
- if(isset($options['loadingID'])){
- $this->loadingID = $options['loadingID'];
- }
- if(isset($options['siteUrl'])){
- $this->siteUrl = $options['siteUrl'];
- }
- if(isset($options['pagedResults'])){
- $this->pagedResults = $options['pagedResults'];
- }
- if(isset($options['resultFormat'])){
- $this->resultFormat = $options['resultFormat'];
- }
-
- }
-
- public function setProductType($productType){
- $this->productType = $productType;
- }
-
- public function setHtmlId($htmlID){
- $this->htmlID = $htmlID;
- }
-
- public function setSiteUrl($siteUrl){
- $this->siteUrl = $siteUrl;
- }
-
- public function setPagedResults($pagedResults){
- $this->pagedResults = $pagedResults;
- }
-
- public function setResultFormat($resultFormat){
- $this->resultFormat = resultFormat;
- }
-
- public function render($bEcho = true){
- $str = '';
- $str .= '<select id="filterKey">';
- $filterKeys = Utils::getMetadataElements(array($this->productType));
- natcasesort($filterKeys);
- foreach($filterKeys as $label){
- $str .= '<option value="' . $label . '">' . $label . '</option>';
- }
- $str .= '</select> = ';
- $str .= '<input type="text" id="filterValue" size="18" alt="filterValue"> ';
- $str .= '<input type="button" value="Add" onclick="addFilter()" />';
- $str .= '<table id="filters"></table>';
- $str .= '<div id="permalink"></div>';
-
- if ($bEcho) {
- echo $str;
- } else {
- return $str;
- }
- }
-
- public function renderScript($bEcho = true){
- $str = '<script type="text/javascript">';
- $str .= 'var htmlID = "' . $this->htmlID . '";';
- $str .= 'var loadingID = "' . $this->loadingID . '";';
- $str .= 'var ptName = "' . $this->productType->getName() . '";';
- $str .= 'var ptID = "' . $this->productType->getId() . '";';
- $str .= 'var siteUrl = "'. $this->siteUrl . '";';
- $str .= 'var resultFormat = "' . $this->resultFormat . '";';
- $str .= 'var displayedMetadata = new Array(';
- if(isset(App::Get()->settings['browser_products_met'])){
- $metList = '';
- foreach(App::Get()->settings['browser_products_met'] as $met){
- if(strlen($metList) > 0){
- $metList .= ',';
- }
- $metList .= '"' . $met . '"';
- }
- $str .= $metList;
- }
- $str .= ');</script>';
- $str .= '<script type="text/javascript" src="' . App::Get()->request->moduleStatic . '/js/querywidget.js"></script>';
- $str .= '<script type="text/javascript" src="' . App::Get()->request->moduleStatic . '/js/filterwidget.js"></script>';
-
- if ($bEcho) {
- echo $str;
- } else {
- return $str;
- }
- }
-}
-?>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/scripts/widgets/MetadataDisplayWidget.php
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/scripts/widgets/MetadataDisplayWidget.php b/balance/modules/cas-browser/scripts/widgets/MetadataDisplayWidget.php
deleted file mode 100644
index ade2ae5..0000000
--- a/balance/modules/cas-browser/scripts/widgets/MetadataDisplayWidget.php
+++ /dev/null
@@ -1,90 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-class MetadataDisplayWidget
- implements Org_Apache_Oodt_Balance_Interfaces_IApplicationWidget {
-
- public $metadata;
-
- public function __construct($options = array()) {
-
- }
-
- public function loadMetadata($metadata) {
- $this->metadata = $metadata;
- }
-
-
- public function render($bEcho = true) {
- $str = "<table class=\"metwidget\"><tbody>";
- $str .= $this->renderHelper($this->metadata);
- $str .= "</tbody></table>";
- if ($bEcho) {
- echo $str;
- } else {
- return $str;
- }
- }
-
- protected function renderHelper($metadata) {
- foreach ($metadata as $key => $values) {
- if ( !empty($values) ) {
- // Build nested metadata tables recursively
- $r .= "<tr><th>{$key}</th>";
- // Associative array means met contains subkeys
- if (is_array($values) && self::is_assoc($values)) {
- $r .= "<td>";
- $r .= "<table class=\"metwidget multivalue\"><tbody>";
- $r .= $this->renderHelper($values);
- $r .= "</tbody></table>";
- }
- // Numeric array means met has multiple values
- else if (is_array($values)) {
- $r .= "<td>";
- $r .= "<table class=\"metwidget\"><tbody>";
- foreach ($values as $val) {
- if (is_array($val) && self::is_assoc($val)) {
- $r .= "<tr class=\"multivalue\"><td>";
- $r .= "<table class=\"metwidget\">";
- $r .= $this->renderHelper($val);
- $r .= "</table>";
- } else {
- $r .= "<tr><td class=\"value\">";
- $r .= "<div>". wordwrap($val, 80, "<br />", true) . "</div>";
- }
- $r .= "</td></tr>";
- }
- $r .= "</tbody></table>";
- }
- // Scalar value means met has one value
- else {
- $r .= "<td class=\"value\">";
- $r .= "<div>{$values}</div>";
- }
- $r .= "</td></tr>";
- }
- }
- return $r;
- }
-
- protected static function is_assoc($array) {
- return (is_array($array) &&
- (count($array)==0 ||
- 0 !== count(array_diff_key($array, array_keys(array_keys($array))) )));
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/scripts/widgets/ProductDownloadWidget.php
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/scripts/widgets/ProductDownloadWidget.php b/balance/modules/cas-browser/scripts/widgets/ProductDownloadWidget.php
deleted file mode 100644
index e96e640..0000000
--- a/balance/modules/cas-browser/scripts/widgets/ProductDownloadWidget.php
+++ /dev/null
@@ -1,96 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-class ProductDownloadWidget
- implements Org_Apache_Oodt_Balance_Interfaces_IApplicationWidget {
-
- public $client;
- public $product;
- public $dataDeliveryUrl;
-
- public function __construct($options = array()) {
- $this->dataDeliveryUrl = $options['dataDeliveryUrl'];
-
- }
-
- public function setClient(&$XmlRpcClient) {
- $this->client = $XmlRpcClient;
- }
-
- public function load($Product) {
- $this->product = $Product;
- }
-
- public function render($bEcho = true) {
- $str = '';
- $references = $this->client->getProductReferences($this->product);
- if (isset($references['faultCode'])){
- $str .= "<div class=\"error\">";
- $str .= "Error encountered while attempting to retrieve product references.<br/>";
- $str .= "FAULT CODE: $references[faultCode]<br/>";
- $str .= "FAULT STRING: $references[faultString]<br/>";
- $str .= "</div>";
- if ($bEcho) {
- echo $str;
- } else {
- return $str;
- }
- }
-
- $referenceCounter = 0;
- $str .= "<table class=\"pdw_downloadTable\">";
- foreach ($references as $reference){
- $fileName = end(explode("/",$reference['dataStoreReference']));
- $fileSize = $reference['fileSize'];
- $fileSizeStr = "";
- ($fileSize > (1024*1024))
- ? $fileSizeStr = number_format(($fileSize/(1024*1024)),1) . " MB"
- : (($fileSize > (1024))
- ? $fileSizeStr = number_format(($fileSize / 1024),1) . " KB"
- : $fileSizeStr = $fileSize . " bytes");
- $str .= "<tr>";
- $str .= "<td>";
- if ($reference['mimeType'] == 'image/jpeg') {
- $str .= "<img class=\"tn\" src=\"".$this->dataDeliveryUrl."/data?refIndex=$referenceCounter&productID={$this->product->getID()}\">";
- } else {
- $str .= "<img class=\"tn\" src=\"".App::Get()->request->moduleStatic."/img/download-icon.gif\"/>";
- }
- $str .= "</td>";
- $str .= "<td style=\"vertical-align:top;\">".urldecode($fileName)." <br/><span id=\"product_download_span\">$fileSizeStr</span><br/>";
- $str .= "Mime Type: $reference[mimeType]<br/>";
- if($reference['mimeType'] == 'image/jpeg') {
- $str .= " <a href=\"".$this->dataDeliveryUrl."/data?refIndex=$referenceCounter&productID={$this->product->getID()}\" target=\"_new\">view</a> ";
- $str .= "<a href=\"getImage.php?productID={$this->product->getID()}&refNumber=$referenceCounter&fileName=$fileName\">save</a> ";
- }
- else{
- $str .= "<a href=\"".$this->dataDeliveryUrl."/data?refIndex=$referenceCounter&productID={$this->product->getID()}\">save</a> ";
- }
-
- $str .= "</td>";
- $str .= "</tr>";
- $referenceCounter++;
- }
- $str .= "</table>";
-
- if ($bEcho) {
- echo $str;
- } else {
- return $str;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/scripts/widgets/ProductPageWidget.php
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/scripts/widgets/ProductPageWidget.php b/balance/modules/cas-browser/scripts/widgets/ProductPageWidget.php
deleted file mode 100644
index 5c375e8..0000000
--- a/balance/modules/cas-browser/scripts/widgets/ProductPageWidget.php
+++ /dev/null
@@ -1,133 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Display a page of product results.
- * @author ahart
- *
- */
-class ProductPageWidget
- implements Org_Apache_Oodt_Balance_Interfaces_IApplicationWidget {
-
- public $page;
- public $pageMetadata;
- public $productTypeId;
- public $returnPage;
- public $urlBase;
-
- private $pageNum;
- private $pageProducts;
- private $pageSize;
- private $totalPages;
-
- public function __construct($options = array() ) {
- $this->page = false;
- $this->productTypeId = $options['productTypeId'];
- $this->returnPage = (isset($options['returnPage']))
- ? $options['returnPage']
- : 1;
- $this->urlBase = $options['urlBase'];
- }
-
- public function load($productPage, $productMetadata = NULL) {
- $this->page = $productPage;
- $this->pageMetadata = $productMetadata;
- $this->pageNum = $this->page->getPageNum();
- $this->pageProducts = $this->page->getPageProducts();
- $this->pageSize = $this->page->getPageSize();
- $this->totalPages = $this->page->getTotalPages();
- }
-
- public function render($bEcho = true) {
- $str = '';
- if ($this->page) {
- $str .= "<table><tr><th>Product Name</th>";
- $displayedElements = App::Get()->settings['browser_products_met'];
- foreach($displayedElements as $elementName){
- $str .= "<th>{$elementName}</th>";
- }
- $str .= "</tr>";
-
- if ( !App::Get()->settings['browser_private_products_visibility'] ) {
- // Get a CAS-Browser XML/RPC client
- $browser = new CasBrowser();
- $client = $browser->getClient();
- foreach ($this->pageMetadata as $key => $value) {
- if ( $browser->getProductVisibilityLevel($key) == "deny") {
- unset($this->pageMetadata[$key]);
- foreach ($this->pageProducts as $product) {
- if ($product->id == $key) {
- $productKey = array_search($product, $this->pageProducts);
- unset($this->pageProducts[$productKey]);
- }
- }
- }
- }
- }
- foreach($this->pageProducts as $product){
- $str .= "<tr><td><a href=\"".$this->urlBase."/product/{$product->getId()}/{$this->returnPage}\">"
- . urlDecode(basename($product->getName())) . "</a></td>";
- foreach($displayedElements as $elementName){
- $str .= "<td>" . $this->pageMetadata[$product->getId()]->getMetadata($elementName) . "</td>";
- }
- $str .= "</tr>";
- }
- $str .= "</table>";
- }
- if ($bEcho) {
- echo $str;
- } else {
- return $str;
- }
- }
-
- public function renderPageDetails($bEcho = true) {
- // Variables to determine product range displayed and total count
- $pageNum = ($this->pageNum == -1) ? 0 : $this->pageNum;
- $totalPages = ($this->totalPages == -1) ? 0 : $this->totalPages;
-
- $displayCountStart = ($totalPages == 0) ? 0 : $this->pageSize * ($pageNum - 1) + 1;
- $displayCountEnd = ($totalPages == 0) ? 0 : $displayCountStart + count($this->pageProducts) - 1;
- $displayCountStart = ($totalPages > 0 && $displayCountStart == 0) ? 1 : $displayCountStart;
-
-
- // 'Previous' and 'Next' page links
- $linkBase = App::Get()->loadModule()->moduleRoot . "/products/{$this->productTypeId}/page";
- $prevPageNum = $this->pageNum -1;
- $nextPageNum = $this->pageNum +1;
-
- $prevPageLink = ($prevPageNum >= 1)
- ? "<a href=\"{$linkBase}/{$prevPageNum}\"><< Previous Page</a>"
- : '';
- $nextPageLink = ($nextPageNum <= $this->totalPages)
- ? "<a href=\"{$linkBase}/{$nextPageNum}\">Next Page >></a>"
- : '';
-
- $rangeInfo = "<span class=\"pp_detail\">Page {$pageNum} of {$totalPages} "
- ."(products {$displayCountStart} - {$displayCountEnd})</span>";
-
-
- $str = "<div class=\"pp_pageLinks\">{$rangeInfo} {$prevPageLink} {$nextPageLink}</div>\r\n";
-
- if ($bEcho) {
- echo $str;
- } else {
- return $str;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/scripts/widgets/ProductTypeListWidget.php
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/scripts/widgets/ProductTypeListWidget.php b/balance/modules/cas-browser/scripts/widgets/ProductTypeListWidget.php
deleted file mode 100644
index ca9d5e1..0000000
--- a/balance/modules/cas-browser/scripts/widgets/ProductTypeListWidget.php
+++ /dev/null
@@ -1,92 +0,0 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-class ProductTypeListWidget
- implements Org_Apache_Oodt_Balance_Interfaces_IApplicationWidget {
-
- public $productTypes;
- public $urlBase;
-
- public function __construct($options = array()) {
- $this->productTypes = $options['productTypes'];
- $this->urlBase = isset($options['urlBase'])
- ? $options['urlBase']
- : '';
- }
-
- public function setUrlBase($base) {
- $this->urlBase = $base;
- }
-
- public function render($bEcho = true) {
- $str = '';
- $str.= "<table id=\"productTypeSearch\" class=\"dataTable\">
- <thead>
- <tr>";
- // Display the Column Headers
- foreach (App::Get()->settings['browser_pt_search_met'] as $metKey) {
- $str .= "<th>".ucwords($metKey)."</th>";
- }
- if (isset(App::Get()->settings['browser_pt_hidden_search_met'])) {
- foreach (App::Get()->settings['browser_pt_hidden_search_met'] as $metKey) {
- $str .= "<th class=\"hidden\">{$metKey}</th>";
- }
- }
- $str .= "</tr></thead><tbody>";
-
- // Display the Data
- foreach ($this->productTypes as $ptKey => $ptMetadata) {
- if (isset(App::Get()->settings['browser_product_type_ignores']) &&
- in_array($ptKey,App::Get()->settings['browser_product_type_ignores'])) { continue; }
- $str .= "<tr>";
- foreach (App::Get()->settings['browser_pt_search_met'] as $metKey) {
- if ($metKey == App::Get()->settings['browser_pt_search_linkkey']) {
- $str .= "<td><a href=\"{$this->urlBase}/products/{$ptKey}\">{$ptMetadata[$metKey][0]}</a>";
- if(count($ptMetadata[$metKey]) == 2){
- $str .= " ({$ptMetadata[$metKey][1]})";
- }
- $str .= "</td>";
- } else {
- if (count($ptMetadata[$metKey]) > 1) {
- $str .= "<td>" . implode(", ", $ptMetadata[$metKey]) . "</td>";
- } else {
- $str .= "<td>{$ptMetadata[$metKey][0]}</td>";
- }
- }
- }
- if (isset(App::Get()->settings['browser_pt_hidden_search_met'])) {
- foreach (App::Get()->settings['browser_pt_hidden_search_met'] as $metKey) {
- if (count($ptMetadata[$metKey]) > 1) {
- $str .= "<td class=\"hidden\">" . implode(", ", $ptMetadata[$metKey]) . "</td>";
- } else {
- $str .= "<td class=\"hidden\">{$ptMetadata[$metKey][0]}</td>";
- }
- }
- }
- $str .= "</tr>\r\n";
- }
- $str .= "</tbody></table>";
- $str .= "<br>";
-
- if ($bEcho) {
- echo $str;
- } else {
- return $str;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/static/css/cas-browser.css
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/static/css/cas-browser.css b/balance/modules/cas-browser/static/css/cas-browser.css
deleted file mode 100644
index f2dd4a7..0000000
--- a/balance/modules/cas-browser/static/css/cas-browser.css
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-@CHARSET "UTF-8";
-
-a {
- color:#236;
-}
-
-br.fiftyPx{
- margin-bottom:50px;
-}
-
-table#productTypeSearch {
-
-}
-table#productTypeSearch th.hidden,
- table#productTypeSearch td.hidden {
- display:none;
-}
-
-div#productTypeSearch_length {
- float:right;
- text-align:right;
- margin-bottom:20px;
- margin-top:25px;
-}
-div#productTypeSearch_filter {
- float:none;
- margin-top:-20px;
- right:0;
- text-align:left;
- width:450px;
-}
-
-table.dataTable tr {
-
-}
-table.dataTable tr td {
- padding:6px;
- vertical-align:top
-}
-
-table.dataTable {
- margin-top:15px;
-}
-.dataTables_filter input[type=text] {
- padding:5px;
- margin-left:0;
- width:97%;
-}
-table.dataTable thead tr th {
- border-bottom:solid 1px #888;
-}
-
-table.dataTable tbody tr.odd {
- background-color:#eee;
-}
-table.dataTable tbody tr.even {
- background-color:#fff;
-}
-table.dataTable tbody tr.odd td {
- background-color:transparent;
-}
-table.dataTable tbody tr.even td {
- background-color:transparent;
-}
-table.dataTable tbody tr td.sorting_1,
- table.dataTable thead tr th.sorting_asc,
- table.dataTable thead tr th.sorting_desc {
- background-color:#f3fff3;
-}
-table.dataTable tbody tr.odd td.sorting_1 {
- background-color:#e3f3e3;
-}
-table.dataTable tbody tr td a {
- color:#222;
-}
-
-/**
- * DATASET
- */
-ul.tabs {
- border-bottom:solid 1px #ccc;
- margin:0;
- padding:0;
- padding-bottom:6px;
-}
-ul.tabs li {
- display:inline;
- margin:0;
- padding:0;
-}
-ul.tabs li a {
- border:solid 1px #ccc;
- padding:8px 12px;
- margin-right:5px;
- margin-bottom:0;
- background-color:#ccc;
-}
-ul.tabs li a.selected {
- background-color:#fff;
- border-bottom:solid 1px #fff;
-}
-
-/**
- * MET VIEWER
- */
-h4.toggler {
- padding:5px 0;
- text-decoration:underline;
- cursor:pointer;
- _cursor:hand;
- margin-bottom:0;
-}
-table.metwidget {
-
-}
-
-
-table.metwidget tr {
-
-}
-
-table.metwidget th {
- background-color:#e3f3e3;
- border-bottom:solid 1px #b3c3b3;
- vertical-align:top;
- padding-top:15px;
- width:110px;
-}
-table.metwidget td {
- vertical-align:top;
- border-bottom:solid 1px #b3c3b3;
-}
-table.metwidget table td {
- border-bottom:none;
-}
-
-table.metwidget td.value div {
- background-color:transparent;
- border:solid 4px #fff;
- padding:5px;
-}
-table.metwidget.multivalue td {
- border:none;
-}
-table.metwidget table {
- margin:0;
- padding:0;
-}
-
-div#section_products {
- position:relative;
-}
-div#cas_browser_dataset_download {
-
-}
-
-ul.pp_productList {
- margin-top:10px;
- list-style:none;
- padding-left:0;
-}
-ul.pp_productList li {
- line-height:28px;
- padding-left:0;
- margin-left:0;
-}
-ul.pp_productList li a {
- text-decoration:none;
- display:block;
- background-color:#fff;
- padding:0 8px;
- width:100%;
-}
-ul.pp_productList li a:hover {
- text-decoration:underline;
- background-color:#e3f3e3;
-}
-
-input[type=text] {
- padding:5px;
-}
-select {
- padding:3px;
-}
-
-div.breadcrumbs {
- border-bottom:dotted 1px #ccc;
- padding-bottom:4px;
- margin-top:-5px;
-}
-
-
-
-table.metwidget {
- border-top:dotted 1px #bbb;
-}
-table.metwidget table {
- border-top:none;
-}
-
-table.metwidget tr th {
- vertical-align:top;
- padding-top:8px;
- background-color:#eee;
- border-bottom:solid 2px #fff;
-}
-table.metwidget tr td {
- background-color:#f8f8f8;
-}
-
-ul.tabmenu {
- margin:0;
- padding:0;
- margin-bottom:15px;
- padding-bottom:7px;
- border-bottom:solid 1px #ccc;
-}
-ul.tabmenu li {
- display:inline;
- border:solid 1px #ccc;
- background-color:#eee;
- padding:10px 15px;
- font-size:1.6em;
- margin-right:5px;
- cursor:pointer;
- _cursor:hand;
-}
-ul.tabmenu li.selected {
- border-bottom:solid 1px #fff;
- background-color:#fff;
-}
-
-div#filter_widget {
- display:none;
- border:solid 1px #ccc;
- background-color:#f8f8f8;
- padding:5px;
-}
-
-div#section_filter_tools_container {
- position:relative;
-}
-div#section_filter_tools_buttons {
- text-align:right;
- position:absolute;
- top:0;
- right:0;
-}
-div#section_filter_tools {
- margin-bottom:15px;
-}
-div#filter_widget_exclusive_container {
- position:absolute;
- top:25px;
- right:0;
-}
-
-
-
-span#product_download_span {
- color:#555;
- font-size:0.9em;
-}
-
-div#loading_icon_container {
- margin-bottom:50px;
-}
-
-img#zip_icon{
- float:left;
- margin-right:15px;
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/static/css/dataTables.css
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/static/css/dataTables.css b/balance/modules/cas-browser/static/css/dataTables.css
deleted file mode 100644
index 8abc9df..0000000
--- a/balance/modules/cas-browser/static/css/dataTables.css
+++ /dev/null
@@ -1,469 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- * General page setup
- */
-#dt_example {
- font: 80%/1.45em "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
- margin: 0;
- padding: 0;
- color: #333;
- background-color: #fff;
-}
-
-
-#dt_example #container {
- width: 800px;
- margin: 30px auto;
- padding: 0;
-}
-
-
-#dt_example #footer {
- margin: 50px auto 0 auto;
- padding: 0;
-}
-
-#dt_example #demo {
- margin: 30px auto 0 auto;
-}
-
-#dt_example .big {
- font-size: 1.3em;
- font-weight: bold;
- line-height: 1.6em;
- color: #4E6CA3;
-}
-
-#dt_example .spacer {
- height: 20px;
- clear: both;
-}
-
-#dt_example .clear {
- clear: both;
-}
-
-#dt_example pre {
- padding: 15px;
- background-color: #F5F5F5;
- border: 1px solid #CCCCCC;
-}
-
-#dt_example h1 {
- margin-top: 2em;
- font-size: 1.3em;
- font-weight: normal;
- line-height: 1.6em;
- color: #4E6CA3;
- border-bottom: 1px solid #B0BED9;
- clear: both;
-}
-
-#dt_example h2 {
- font-size: 1.2em;
- font-weight: normal;
- line-height: 1.6em;
- color: #4E6CA3;
- clear: both;
-}
-
-#dt_example a {
- color: #0063DC;
- text-decoration: none;
-}
-
-#dt_example a:hover {
- text-decoration: underline;
-}
-
-#dt_example ul {
- color: #B0BED9;
-}
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * DataTables features
- */
-
-.dataTables_wrapper {
- position: relative;
- min-height: 302px;
- _height: 302px;
- clear: both;
-}
-
-.dataTables_processing {
- position: absolute;
- top: 0;
- left: 50%;
- width: 250px;
- margin-left: -125px;
- border: 1px solid #ddd;
- text-align: center;
- color: #999;
- font-size: 11px;
- padding: 2px 0;
-}
-
-.dataTables_length {
- width: 40%;
- float: left;
-}
-
-.dataTables_filter {
- width: 50%;
- float: right;
- text-align: right;
-}
-
-.dataTables_info {
- width: 60%;
- float: left;
-}
-
-.dataTables_paginate {
- width: 44px;
- * width: 50px;
- float: right;
- text-align: right;
-}
-
-/* Pagination nested */
-.paginate_disabled_previous, .paginate_enabled_previous, .paginate_disabled_next, .paginate_enabled_next {
- height: 19px;
- width: 19px;
- margin-left: 3px;
- float: left;
-}
-
-.paginate_disabled_previous {
- background-image: url('../img/dataTables/back_disabled.png');
-}
-
-.paginate_enabled_previous {
- background-image: url('../img/dataTables/back_enabled.png');
-}
-
-.paginate_disabled_next {
- background-image: url('../img/dataTables/forward_disabled.png');
-}
-
-.paginate_enabled_next {
- background-image: url('../img/dataTables/forward_enabled.png');
-}
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * DataTables display
- */
-table.display {
- margin: 0 auto;
- width: 100%;
- clear: both;
-}
-
-table.display thead th {
- padding: 3px 10px;
- border-bottom: 1px solid black;
- font-weight: bold;
- cursor: pointer;
- * cursor: hand;
-}
-
-table.display tfoot th {
- padding: 3px 10px;
- border-top: 1px solid black;
- font-weight: bold;
-}
-
-table.display tr.heading2 td {
- border-bottom: 1px solid #aaa;
-}
-
-table.display td {
- padding: 3px 10px;
-}
-
-table.display td.center {
- text-align: center;
-}
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * DataTables sorting
- */
-
-.sorting_asc {
- background: url('../img/dataTables/sort_asc.png') no-repeat center right;
-}
-
-.sorting_desc {
- background: url('../img/dataTables/sort_desc.png') no-repeat center right;
-}
-
-.sorting {
- background: url('../img/dataTables/sort_both.png') no-repeat center right;
-}
-
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * DataTables row classes
- */
-table.display tr.odd.gradeA {
- background-color: #ddffdd;
-}
-
-table.display tr.even.gradeA {
- background-color: #eeffee;
-}
-
-
-
-
-table.display tr.odd.gradeA {
- background-color: #ddffdd;
-}
-
-table.display tr.even.gradeA {
- background-color: #eeffee;
-}
-
-table.display tr.odd.gradeC {
- background-color: #ddddff;
-}
-
-table.display tr.even.gradeC {
- background-color: #eeeeff;
-}
-
-table.display tr.odd.gradeX {
- background-color: #ffdddd;
-}
-
-table.display tr.even.gradeX {
- background-color: #ffeeee;
-}
-
-table.display tr.odd.gradeU {
- background-color: #ddd;
-}
-
-table.display tr.even.gradeU {
- background-color: #eee;
-}
-
-
-tr.odd {
- background-color: #E2E4FF;
-}
-
-tr.even {
- background-color: white;
-}
-
-
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Misc
- */
-.top, .bottom {
- padding: 15px;
- background-color: #F5F5F5;
- border: 1px solid #CCCCCC;
-}
-
-.top .dataTables_info {
- float: none;
-}
-
-.clear {
- clear: both;
-}
-
-tfoot input {
- margin: 0.5em 0;
- width: 100%;
- color: #444;
-}
-
-tfoot input.search_init {
- color: #999;
-}
-
-
-.example_alt_pagination div.dataTables_info {
- width: 40%;
-}
-
-.example_alt_pagination .dataTables_paginate {
- width: 400px;
-}
-
-.example_alt_pagination div.dataTables_paginate span.paginate_button,
- .example_alt_pagination div.dataTables_paginate span.paginate_active {
- border: 1px solid #aaa;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- padding: 2px 5px;
- margin: 0 3px;
- cursor: pointer;
- *cursor: hand;
-}
-
-.example_alt_pagination div.dataTables_paginate span.paginate_button {
- background-color: #ddd;
-}
-
-.example_alt_pagination div.dataTables_paginate span.paginate_button:hover {
- background-color: #ccc;
-}
-
-.example_alt_pagination div.dataTables_paginate span.paginate_active {
- background-color: #99B3FF;
-}
-
-
-table.display tr.row_selected.odd td {
- background-color: #B0BED9;
-}
-
-table.display tr.row_selected.even td {
- background-color: #9FAFD1;
-}
-
-
-/*
- * Sorting classes for columns
- */
-/* For the standard odd/even */
-tr.odd td.sorting_1 {
- background-color: #D3D6FF;
-}
-
-tr.odd td.sorting_2 {
- background-color: #DADCFF;
-}
-
-tr.odd td.sorting_3 {
- background-color: #E0E2FF;
-}
-
-tr.even td.sorting_1 {
- background-color: #EAEBFF;
-}
-
-tr.even td.sorting_2 {
- background-color: #F2F3FF;
-}
-
-tr.even td.sorting_3 {
- background-color: #F9F9FF;
-}
-
-
-/* For the Conditional-CSS grading rows */
-/*
- Colour calculations (based off the main row colours)
- Level 1:
- dd > c4
- ee > d5
- Level 2:
- dd > d1
- ee > e2
- */
-tr.odd.gradeA td.sorting_1 {
- background-color: #c4ffc4;
-}
-
-tr.odd.gradeA td.sorting_2 {
- background-color: #d1ffd1;
-}
-
-tr.even.gradeA td.sorting_1 {
- background-color: #d5ffd5;
-}
-
-tr.even.gradeA td.sorting_2 {
- background-color: #e2ffe2;
-}
-
-tr.odd.gradeC td.sorting_1 {
- background-color: #c4c4ff;
-}
-
-tr.odd.gradeC td.sorting_2 {
- background-color: #d1d1ff;
-}
-
-tr.even.gradeC td.sorting_1 {
- background-color: #d5d5ff;
-}
-
-tr.even.gradeC td.sorting_2 {
- background-color: #e2e2ff;
-}
-
-tr.odd.gradeX td.sorting_1 {
- background-color: #ffc4c4;
-}
-
-tr.odd.gradeX td.sorting_2 {
- background-color: #ffd1d1;
-}
-
-tr.even.gradeX td.sorting_1 {
- background-color: #ffd5d5;
-}
-
-tr.even.gradeX td.sorting_2 {
- background-color: #ffe2e2;
-}
-
-tr.odd.gradeU td.sorting_1 {
- background-color: #c4c4c4;
-}
-
-tr.odd.gradeU td.sorting_2 {
- background-color: #d1d1d1;
-}
-
-tr.even.gradeU td.sorting_1 {
- background-color: #d5d5d5;
-}
-
-tr.even.gradeU td.sorting_2 {
- background-color: #e2e2e2;
-}
-
-
-/*
- * Row highlighting example
- */
-.ex_highlight #example tbody tr.even:hover, #example tbody tr.even td.highlighted {
- background-color: #ECFFB3;
-}
-
-.ex_highlight #example tbody tr.odd:hover, #example tbody tr.odd td.highlighted {
- background-color: #E6FF99;
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/static/img/dataTables/Sorting icons.psd
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/static/img/dataTables/Sorting icons.psd b/balance/modules/cas-browser/static/img/dataTables/Sorting icons.psd
deleted file mode 100644
index 53b2e06..0000000
Binary files a/balance/modules/cas-browser/static/img/dataTables/Sorting icons.psd and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/static/img/dataTables/back_disabled.png
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/static/img/dataTables/back_disabled.png b/balance/modules/cas-browser/static/img/dataTables/back_disabled.png
deleted file mode 100644
index 881de79..0000000
Binary files a/balance/modules/cas-browser/static/img/dataTables/back_disabled.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/static/img/dataTables/back_enabled.png
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/static/img/dataTables/back_enabled.png b/balance/modules/cas-browser/static/img/dataTables/back_enabled.png
deleted file mode 100644
index c608682..0000000
Binary files a/balance/modules/cas-browser/static/img/dataTables/back_enabled.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/static/img/dataTables/back_enabled_hover.png
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/static/img/dataTables/back_enabled_hover.png b/balance/modules/cas-browser/static/img/dataTables/back_enabled_hover.png
deleted file mode 100644
index d300f10..0000000
Binary files a/balance/modules/cas-browser/static/img/dataTables/back_enabled_hover.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/static/img/dataTables/favicon.ico
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/static/img/dataTables/favicon.ico b/balance/modules/cas-browser/static/img/dataTables/favicon.ico
deleted file mode 100644
index 6eeaa2a..0000000
Binary files a/balance/modules/cas-browser/static/img/dataTables/favicon.ico and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/static/img/dataTables/forward_disabled.png
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/static/img/dataTables/forward_disabled.png b/balance/modules/cas-browser/static/img/dataTables/forward_disabled.png
deleted file mode 100644
index 6a6ded7..0000000
Binary files a/balance/modules/cas-browser/static/img/dataTables/forward_disabled.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/static/img/dataTables/forward_enabled.png
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/static/img/dataTables/forward_enabled.png b/balance/modules/cas-browser/static/img/dataTables/forward_enabled.png
deleted file mode 100644
index a4e6b53..0000000
Binary files a/balance/modules/cas-browser/static/img/dataTables/forward_enabled.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/static/img/dataTables/forward_enabled_hover.png
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/static/img/dataTables/forward_enabled_hover.png b/balance/modules/cas-browser/static/img/dataTables/forward_enabled_hover.png
deleted file mode 100644
index fc46c5e..0000000
Binary files a/balance/modules/cas-browser/static/img/dataTables/forward_enabled_hover.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/static/img/dataTables/sort_asc.png
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/static/img/dataTables/sort_asc.png b/balance/modules/cas-browser/static/img/dataTables/sort_asc.png
deleted file mode 100644
index a88d797..0000000
Binary files a/balance/modules/cas-browser/static/img/dataTables/sort_asc.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/static/img/dataTables/sort_asc_disabled.png
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/static/img/dataTables/sort_asc_disabled.png b/balance/modules/cas-browser/static/img/dataTables/sort_asc_disabled.png
deleted file mode 100644
index 4e144cf..0000000
Binary files a/balance/modules/cas-browser/static/img/dataTables/sort_asc_disabled.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/static/img/dataTables/sort_both.png
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/static/img/dataTables/sort_both.png b/balance/modules/cas-browser/static/img/dataTables/sort_both.png
deleted file mode 100644
index 1867040..0000000
Binary files a/balance/modules/cas-browser/static/img/dataTables/sort_both.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/static/img/dataTables/sort_desc.png
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/static/img/dataTables/sort_desc.png b/balance/modules/cas-browser/static/img/dataTables/sort_desc.png
deleted file mode 100644
index def071e..0000000
Binary files a/balance/modules/cas-browser/static/img/dataTables/sort_desc.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/static/img/dataTables/sort_desc_disabled.png
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/static/img/dataTables/sort_desc_disabled.png b/balance/modules/cas-browser/static/img/dataTables/sort_desc_disabled.png
deleted file mode 100644
index 7824973..0000000
Binary files a/balance/modules/cas-browser/static/img/dataTables/sort_desc_disabled.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/static/img/download-icon.gif
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/static/img/download-icon.gif b/balance/modules/cas-browser/static/img/download-icon.gif
deleted file mode 100644
index 1de3a38..0000000
Binary files a/balance/modules/cas-browser/static/img/download-icon.gif and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/static/img/loading.gif
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/static/img/loading.gif b/balance/modules/cas-browser/static/img/loading.gif
deleted file mode 100644
index 3596a61..0000000
Binary files a/balance/modules/cas-browser/static/img/loading.gif and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/static/img/zip-icon-smaller.gif
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/static/img/zip-icon-smaller.gif b/balance/modules/cas-browser/static/img/zip-icon-smaller.gif
deleted file mode 100644
index 3722545..0000000
Binary files a/balance/modules/cas-browser/static/img/zip-icon-smaller.gif and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/static/img/zip-icon.gif
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/static/img/zip-icon.gif b/balance/modules/cas-browser/static/img/zip-icon.gif
deleted file mode 100644
index 9df05e0..0000000
Binary files a/balance/modules/cas-browser/static/img/zip-icon.gif and /dev/null differ
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/static/js/crosstypesearchwidget.js
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/static/js/crosstypesearchwidget.js b/balance/modules/cas-browser/static/js/crosstypesearchwidget.js
deleted file mode 100644
index 67cd212..0000000
--- a/balance/modules/cas-browser/static/js/crosstypesearchwidget.js
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-function renderJsonOutput(data){
- output = '<table id="crossPTSearchTable" class="dataTable"><thead><tr><th>Product Name</th><th>ProductType</th>';
- for(i = 0; i < displayedMetadata.length; i++){
- output += '<th>' + displayedMetadata[i] + '</th>';
- }
- output += '</tr></thead><tbody>';
- for(i = 0; i < data['results'].length; i++){
- output += '<tr><td><a href="' + siteUrl + '/product/' + data['results'][i]['id'] + '">';
- output += data['results'][i]['name'] + '</a></td>';
- output += '<td>' + data['results'][i]['type'] + '</td>';
- for(k = 0; k < displayedMetadata.length; k++){
- output += '<td>' + data['results'][i]['metadata'][displayedMetadata[k]] + '</td>';
- }
- output += '</tr>';
- }
- output += '</tbody></table><br />';
- $("#" + htmlID).html(output);
-}
-
-function displayPermalink(){
- output = 'To see these filters again, go to:<br />' + siteUrl + '/typesearch/';
- if($("#exclusive").attr("checked")){
- output += '0/';
- }else{
- output += '1/';
- }
- for(i = 0; i < allCriteria[criteriaRoot].criteria.length; i++){
- termIndex = allCriteria[criteriaRoot].criteria[i];
- termKey = allCriteria[termIndex].element;
- termValue = allCriteria[termIndex].value;
- output += termKey + '/' + termValue + '/';
- }
- $("#permalink").html(output);
-}
-
-function clearResults(){
- $("#" + htmlID).html("");
-}
-
-function createFilter(key, value){
- index = addTermCriteria(key, value, criteriaRoot);
- var filterText = '<tr id="filter' + index + '">';
- filterText += '<td>' + key + '</td><td>=</td><td>' + value + '</td>';
- filterText += '<td align="right">';
- filterText += '<input type="button" value="Remove" onclick="removeFilter(\'' + index + '\')" />';
- filterText += '</td></tr>';
- $("#filters").append(filterText);
-}
-
-function addFilter(){
- pCurrPage = 1;
- key = $("#filterKey").val();
- value = $("#filterValue").val();
- if(value!=""){
- $("#permalink").html("");
- createFilter(key, value);
- formatCrossTypeQueryRequest();
- $("#filterValue").val("");
- }
-}
-
-function removeFilter(filterIndex){
- pCurrPage = 1;
- $("#filter" + filterIndex).remove();
- $("#permalink").html("");
- removeCriteria(filterIndex);
- sendCrossTypeRequest();
-}
-
-function getNextPage(){
- pCurrPage = pCurrPage + 1;
- sendCrossTypeRequest();
-}
-
-function getPrevPage(){
- pCurrPage = pCurrPage - 1;
- sendCrossTypeRequest();
-}
-
-function changeExclusive(){
- if($("#exclusive").attr("checked")){
- setExclusiveQuery(true);
- }else{
- setExclusiveQuery(false);
- }
- if(determineRequest(criteriaRoot)){
- formatCrossTypeQueryRequest();
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/static/js/customsearchwidget.js
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/static/js/customsearchwidget.js b/balance/modules/cas-browser/static/js/customsearchwidget.js
deleted file mode 100644
index c887431..0000000
--- a/balance/modules/cas-browser/static/js/customsearchwidget.js
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// When the document is ready, we need to create a representation of the criteria
-// tree in javascript. This is done by looking for hidden input tags with ids that
-// start with either 'term' or 'range'. These precede the text input fields to
-// specify criteria of the corresponding type. We store the ids of the input fields
-// so we can use thier values when the search button is clicked. Create criteria
-// that have blank values since they haven't been filled in yet; these values will
-// be updated when the user clicks the search button.
-$(document).ready(function(){
- var parentIndex = addBooleanCriteria('and', null);
- $('input[id^="term"]').each(function(){
- var newTermIndex = addTermCriteria($(this).val(), '', parentIndex);
- allCriteria[newTermIndex].termInputId = $(this).next().attr("id");
- })
- $('input[id^="range"]').each(function(){
- var newRangeIndex = addRangeCriteria($(this).val(), '', '', parentIndex);
- allCriteria[newRangeIndex].minInputId = $(this).next().attr("id");
- allCriteria[newRangeIndex].maxInputId = $(this).next().next().attr("id");
- })
-});
-
-// Since the criteria in our query tree are originally created with empty values, we
-// must grab the values from the input fields at the stored ids.
-function customUpdateCriteria(index){
- if(allCriteria[index].type == 'term'){
- allCriteria[index].value = $('#' + allCriteria[index].termInputId).val();
- $('#' + allCriteria[index].termInputId).val('');
- }else if(allCriteria[index].type == 'range'){
- allCriteria[index].min = $('#' + allCriteria[index].minInputId).val();
- $('#' + allCriteria[index].minInputId).val('');
- allCriteria[index].max = $('#' + allCriteria[index].maxInputId).val();
- $('#' + allCriteria[index].maxInputId).val('');
- }else if(allCriteria[index].type == 'boolean'){
- for(i = 0; i < allCriteria[index].criteria.length; i++){
- customUpdateCriteria(allCriteria[index].criteria[i]);
- }
- }
- return;
-}
-
-// This function is called when the search button is clicked.
-function customQuery(){
- $("#page_num").val(1); // Set the value of the desired page to 1 (first in
- // the set). The user can fetch later pages by
- // clicking the links for next and previous pages.
- customUpdateCriteria(criteriaRoot); // Update the criteria in the query tree
- // with the values from the input fields.
- formatQueryRequest("html"); // Perform the query
-}
-
-function renderJsonOutput(data){
- output = '<ul class="pp_productList" id="product_list">';
- for(i = 0; i < data['productList'].length; i++){
- output += '<li><a href="' + siteUrl + '/product/' + data['productList'][i]['id'] + '">';
- output += data['productList'][i]['name'] + '</li>';
- }
- output += '</ul>';
- output += '<input type="hidden" id="total_pages" value="' + data['totalPages'] + '">';
- output += '<input type="hidden" id="page_size" value="' + data['pageSize'] + '">';
- output += '<input type="hidden" id="total_type_products" value="' + data['totalTypeProducts'] + '">';
- $("#" + htmlID).html(output);
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/static/js/filterwidget.js
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/static/js/filterwidget.js b/balance/modules/cas-browser/static/js/filterwidget.js
deleted file mode 100644
index 9c6b56b..0000000
--- a/balance/modules/cas-browser/static/js/filterwidget.js
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-function createFilter(key, value){
- if(!allCriteria[criteriaRoot]){
- criteriaRoot = addBooleanCriteria('and', null);
- }
- index = addTermCriteria(key, value, criteriaRoot);
- var filterText = '<tr id="filter' + index + '">';
- filterText += '<td>' + key + '</td><td>=</td><td>' + value + '</td>';
- filterText += '<td align="right">';
- filterText += '<input type="button" value="Remove" onclick="removeFilter(\'' + index + '\')" />';
- filterText += '</td></tr>';
- $("#filters").append(filterText);
-}
-
-function addFilter(){
- key = $("#filterKey").val();
- value = $("#filterValue").val();
- pCurrPage = 1;
- if(value!=""){
- $("#permalink").html("");
- createFilter(key, value);
- formatQueryRequest(resultFormat);
- $("#filterValue").val("");
- }
-}
-
-function removeFilter(filterIndex){
- pCurrPage = 1;
- $("#filter" + filterIndex).remove();
- $("#permalink").html("");
- removeCriteria(filterIndex);
- sendRequest(resultFormat);
-}
-
-function renderJsonOutput(data){
- output = '';
- if(displayedMetadata.length > 0){
- output = '<table><thead><tr><th>Product Name</th>';
- for(i = 0; i < displayedMetadata.length; i++){
- output += '<th>' + displayedMetadata[i] + '</th>';
- }
- output += '</tr></thead><tbody>';
- for(i = 0; i < data['results'].length; i++){
- output += '<tr><td><a href="' + siteUrl + '/product/' + data['results'][i]['id'] + '">';
- output += data['results'][i]['name'] + '</a></td>';
- for(j = 0; j < displayedMetadata.length; j++){
- output += '<td>' + data['results'][i]['metadata'][displayedMetadata[j]] + '</td>';
- }
- output += '</tr>';
- }
- output += '</tbody></table>';
- }else{
- output = '<ul class="pp_productList" id="product_list">';
- for(i = 0; i < data['results'].length; i++){
- output += '<li><a href="' + siteUrl + '/product/' + data['results'][i]['id'] + '">';
- output += data['results'][i]['name'] + '</a></li>';
- }
- output += '</ul>';
- }
- $("#" + htmlID).html(output);
-}
-
-function displayPermalink(){
- output = 'To see these filters again, go to:<br />' + siteUrl + '/products/' + ptID + '/';
- for(i = 0; i < allCriteria[criteriaRoot].criteria.length; i++){
- termIndex = allCriteria[criteriaRoot].criteria[i];
- termKey = allCriteria[termIndex].element;
- termValue = allCriteria[termIndex].value;
- output += termKey + '/' + termValue + '/';
- }
- $("#permalink").html(output);
-}
-
-function getNextPage(){
- pCurrPage = pCurrPage + 1;
- sendRequest("json");
-}
-
-function getPrevPage(){
- pCurrPage = pCurrPage - 1;
- sendRequest("json");
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/balance/modules/cas-browser/static/js/jcorner.jquery.js
----------------------------------------------------------------------
diff --git a/balance/modules/cas-browser/static/js/jcorner.jquery.js b/balance/modules/cas-browser/static/js/jcorner.jquery.js
deleted file mode 100644
index f96a17b..0000000
--- a/balance/modules/cas-browser/static/js/jcorner.jquery.js
+++ /dev/null
@@ -1,247 +0,0 @@
-/*!
- * jQuery corner plugin: simple corner rounding
- * Examples and documentation at: http://jquery.malsup.com/corner/
- * version 2.11 (15-JUN-2010)
- * Requires jQuery v1.3.2 or later
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
- * Authors: Dave Methvin and Mike Alsup
- */
-
-/**
- * corner() takes a single string argument: $('#myDiv').corner("effect corners width")
- *
- * effect: name of the effect to apply, such as round, bevel, notch, bite, etc (default is round).
- * corners: one or more of: top, bottom, tr, tl, br, or bl. (default is all corners)
- * width: width of the effect; in the case of rounded corners this is the radius.
- * specify this value using the px suffix such as 10px (yes, it must be pixels).
- */
-;(function($) {
-
-var style = document.createElement('div').style,
- moz = style['MozBorderRadius'] !== undefined,
- webkit = style['WebkitBorderRadius'] !== undefined,
- radius = style['borderRadius'] !== undefined || style['BorderRadius'] !== undefined,
- mode = document.documentMode || 0,
- noBottomFold = $.browser.msie && (($.browser.version < 8 && !mode) || mode < 8),
-
- expr = $.browser.msie && (function() {
- var div = document.createElement('div');
- try { div.style.setExpression('width','0+0'); div.style.removeExpression('width'); }
- catch(e) { return false; }
- return true;
- })();
-
-$.support = $.support || {};
-$.support.borderRadius = moz || webkit || radius; // so you can do: if (!$.support.borderRadius) $('#myDiv').corner();
-
-function sz(el, p) {
- return parseInt($.css(el,p))||0;
-};
-function hex2(s) {
- var s = parseInt(s).toString(16);
- return ( s.length < 2 ) ? '0'+s : s;
-};
-function gpc(node) {
- while(node) {
- var v = $.css(node,'backgroundColor'), rgb;
- if (v && v != 'transparent' && v != 'rgba(0, 0, 0, 0)') {
- if (v.indexOf('rgb') >= 0) {
- rgb = v.match(/\d+/g);
- return '#'+ hex2(rgb[0]) + hex2(rgb[1]) + hex2(rgb[2]);
- }
- return v;
- }
- if (node.nodeName.toLowerCase() == 'html')
- break;
- node = node.parentNode; // keep walking if transparent
- }
- return '#ffffff';
-};
-
-function getWidth(fx, i, width) {
- switch(fx) {
- case 'round': return Math.round(width*(1-Math.cos(Math.asin(i/width))));
- case 'cool': return Math.round(width*(1+Math.cos(Math.asin(i/width))));
- case 'sharp': return Math.round(width*(1-Math.cos(Math.acos(i/width))));
- case 'bite': return Math.round(width*(Math.cos(Math.asin((width-i-1)/width))));
- case 'slide': return Math.round(width*(Math.atan2(i,width/i)));
- case 'jut': return Math.round(width*(Math.atan2(width,(width-i-1))));
- case 'curl': return Math.round(width*(Math.atan(i)));
- case 'tear': return Math.round(width*(Math.cos(i)));
- case 'wicked': return Math.round(width*(Math.tan(i)));
- case 'long': return Math.round(width*(Math.sqrt(i)));
- case 'sculpt': return Math.round(width*(Math.log((width-i-1),width)));
- case 'dogfold':
- case 'dog': return (i&1) ? (i+1) : width;
- case 'dog2': return (i&2) ? (i+1) : width;
- case 'dog3': return (i&3) ? (i+1) : width;
- case 'fray': return (i%2)*width;
- case 'notch': return width;
- case 'bevelfold':
- case 'bevel': return i+1;
- }
-};
-
-$.fn.corner = function(options) {
- // in 1.3+ we can fix mistakes with the ready state
- if (this.length == 0) {
- if (!$.isReady && this.selector) {
- var s = this.selector, c = this.context;
- $(function() {
- $(s,c).corner(options);
- });
- }
- return this;
- }
-
- return this.each(function(index){
- var $this = $(this),
- // meta values override options
- o = [$this.attr($.fn.corner.defaults.metaAttr) || '', options || ''].join(' ').toLowerCase(),
- keep = /keep/.test(o), // keep borders?
- cc = ((o.match(/cc:(#[0-9a-f]+)/)||[])[1]), // corner color
- sc = ((o.match(/sc:(#[0-9a-f]+)/)||[])[1]), // strip color
- width = parseInt((o.match(/(\d+)px/)||[])[1]) || 10, // corner width
- re = /round|bevelfold|bevel|notch|bite|cool|sharp|slide|jut|curl|tear|fray|wicked|sculpt|long|dog3|dog2|dogfold|dog/,
- fx = ((o.match(re)||['round'])[0]),
- fold = /dogfold|bevelfold/.test(o),
- edges = { T:0, B:1 },
- opts = {
- TL: /top|tl|left/.test(o), TR: /top|tr|right/.test(o),
- BL: /bottom|bl|left/.test(o), BR: /bottom|br|right/.test(o)
- },
- // vars used in func later
- strip, pad, cssHeight, j, bot, d, ds, bw, i, w, e, c, common, $horz;
-
- if ( !opts.TL && !opts.TR && !opts.BL && !opts.BR )
- opts = { TL:1, TR:1, BL:1, BR:1 };
-
- // support native rounding
- if ($.fn.corner.defaults.useNative && fx == 'round' && (radius || moz || webkit) && !cc && !sc) {
- if (opts.TL)
- $this.css(radius ? 'border-top-left-radius' : moz ? '-moz-border-radius-topleft' : '-webkit-border-top-left-radius', width + 'px');
- if (opts.TR)
- $this.css(radius ? 'border-top-right-radius' : moz ? '-moz-border-radius-topright' : '-webkit-border-top-right-radius', width + 'px');
- if (opts.BL)
- $this.css(radius ? 'border-bottom-left-radius' : moz ? '-moz-border-radius-bottomleft' : '-webkit-border-bottom-left-radius', width + 'px');
- if (opts.BR)
- $this.css(radius ? 'border-bottom-right-radius' : moz ? '-moz-border-radius-bottomright' : '-webkit-border-bottom-right-radius', width + 'px');
- return;
- }
-
- strip = document.createElement('div');
- $(strip).css({
- overflow: 'hidden',
- height: '1px',
- minHeight: '1px',
- fontSize: '1px',
- backgroundColor: sc || 'transparent',
- borderStyle: 'solid'
- });
-
- pad = {
- T: parseInt($.css(this,'paddingTop'))||0, R: parseInt($.css(this,'paddingRight'))||0,
- B: parseInt($.css(this,'paddingBottom'))||0, L: parseInt($.css(this,'paddingLeft'))||0
- };
-
- if (typeof this.style.zoom != undefined) this.style.zoom = 1; // force 'hasLayout' in IE
- if (!keep) this.style.border = 'none';
- strip.style.borderColor = cc || gpc(this.parentNode);
- cssHeight = $(this).outerHeight();
-
- for (j in edges) {
- bot = edges[j];
- // only add stips if needed
- if ((bot && (opts.BL || opts.BR)) || (!bot && (opts.TL || opts.TR))) {
- strip.style.borderStyle = 'none '+(opts[j+'R']?'solid':'none')+' none '+(opts[j+'L']?'solid':'none');
- d = document.createElement('div');
- $(d).addClass('jquery-corner');
- ds = d.style;
-
- bot ? this.appendChild(d) : this.insertBefore(d, this.firstChild);
-
- if (bot && cssHeight != 'auto') {
- if ($.css(this,'position') == 'static')
- this.style.position = 'relative';
- ds.position = 'absolute';
- ds.bottom = ds.left = ds.padding = ds.margin = '0';
- if (expr)
- ds.setExpression('width', 'this.parentNode.offsetWidth');
- else
- ds.width = '100%';
- }
- else if (!bot && $.browser.msie) {
- if ($.css(this,'position') == 'static')
- this.style.position = 'relative';
- ds.position = 'absolute';
- ds.top = ds.left = ds.right = ds.padding = ds.margin = '0';
-
- // fix ie6 problem when blocked element has a border width
- if (expr) {
- bw = sz(this,'borderLeftWidth') + sz(this,'borderRightWidth');
- ds.setExpression('width', 'this.parentNode.offsetWidth - '+bw+'+ "px"');
- }
- else
- ds.width = '100%';
- }
- else {
- ds.position = 'relative';
- ds.margin = !bot ? '-'+pad.T+'px -'+pad.R+'px '+(pad.T-width)+'px -'+pad.L+'px' :
- (pad.B-width)+'px -'+pad.R+'px -'+pad.B+'px -'+pad.L+'px';
- }
-
- for (i=0; i < width; i++) {
- w = Math.max(0,getWidth(fx,i, width));
- e = strip.cloneNode(false);
- e.style.borderWidth = '0 '+(opts[j+'R']?w:0)+'px 0 '+(opts[j+'L']?w:0)+'px';
- bot ? d.appendChild(e) : d.insertBefore(e, d.firstChild);
- }
-
- if (fold && $.support.boxModel) {
- if (bot && noBottomFold) continue;
- for (c in opts) {
- if (!opts[c]) continue;
- if (bot && (c == 'TL' || c == 'TR')) continue;
- if (!bot && (c == 'BL' || c == 'BR')) continue;
-
- common = { position: 'absolute', border: 'none', margin: 0, padding: 0, overflow: 'hidden', backgroundColor: strip.style.borderColor };
- $horz = $('<div/>').css(common).css({ width: width + 'px', height: '1px' });
- switch(c) {
- case 'TL': $horz.css({ bottom: 0, left: 0 }); break;
- case 'TR': $horz.css({ bottom: 0, right: 0 }); break;
- case 'BL': $horz.css({ top: 0, left: 0 }); break;
- case 'BR': $horz.css({ top: 0, right: 0 }); break;
- }
- d.appendChild($horz[0]);
-
- var $vert = $('<div/>').css(common).css({ top: 0, bottom: 0, width: '1px', height: width + 'px' });
- switch(c) {
- case 'TL': $vert.css({ left: width }); break;
- case 'TR': $vert.css({ right: width }); break;
- case 'BL': $vert.css({ left: width }); break;
- case 'BR': $vert.css({ right: width }); break;
- }
- d.appendChild($vert[0]);
- }
- }
- }
- }
- });
-};
-
-$.fn.uncorner = function() {
- if (radius || moz || webkit)
- this.css(radius ? 'border-radius' : moz ? '-moz-border-radius' : '-webkit-border-radius', 0);
- $('div.jquery-corner', this).remove();
- return this;
-};
-
-// expose options
-$.fn.corner.defaults = {
- useNative: true, // true if plugin should attempt to use native browser support for border radius rounding
- metaAttr: 'data-corner' // name of meta attribute to use for options
-};
-
-})(jQuery);
[32/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/QueryFilter.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/QueryFilter.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/QueryFilter.java
deleted file mode 100644
index bbfdf14..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/QueryFilter.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.query.filter;
-
-//JDK imports
-import java.util.List;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.metadata.TransactionalMetadata;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A Filter interface for filtering queries
- * <p>
- */
-public abstract class QueryFilter<FilterType> {
-
- protected FilterAlgorithm<FilterType> filterAlgorithm;
-
- public QueryFilter() {}
-
- public QueryFilter(FilterAlgorithm<FilterType> filterAlgorithm) {
- super();
- this.filterAlgorithm = filterAlgorithm;
- }
-
- public void setFilterAlgorithm(FilterAlgorithm<FilterType> filterAlgorithm) {
- this.filterAlgorithm = filterAlgorithm;
- }
-
- public FilterAlgorithm<FilterType> getFilterAlgorithm() {
- return this.filterAlgorithm;
- }
-
- public List<TransactionalMetadata> filterMetadataList(List<TransactionalMetadata> metadataToFilter) {
- return this.filterTypeToMetadata(this.filterAlgorithm.filter(this.metadataToFilterType(metadataToFilter)));
- }
-
- protected abstract List<FilterType> metadataToFilterType(List<TransactionalMetadata> metadataList);
-
- protected abstract List<TransactionalMetadata> filterTypeToMetadata(List<FilterType> filterObjects);
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/time/MetadataTimeEvent.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/time/MetadataTimeEvent.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/time/MetadataTimeEvent.java
deleted file mode 100644
index aa8eaaf..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/time/MetadataTimeEvent.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.query.filter.time;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.metadata.TransactionalMetadata;
-import org.apache.oodt.commons.filter.ObjectTimeEvent;
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A ObjectTimeEvent that holds TermBuckets
- * <p>
- */
-public class MetadataTimeEvent extends ObjectTimeEvent<TransactionalMetadata> {
-
- public MetadataTimeEvent(long startTime, long endTime, TransactionalMetadata timeObj) {
- super(startTime, endTime, timeObj);
- }
-
- public MetadataTimeEvent(long startTime, long endTime, double priority, TransactionalMetadata timeObj) {
- super(startTime, endTime, priority, timeObj);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/time/MetadataTimeEventFilterAlgorithm.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/time/MetadataTimeEventFilterAlgorithm.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/time/MetadataTimeEventFilterAlgorithm.java
deleted file mode 100644
index 114a4d5..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/time/MetadataTimeEventFilterAlgorithm.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.query.filter.time;
-
-//JDK imports
-import java.util.Collections;
-import java.util.List;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.query.filter.FilterAlgorithm;
-import org.apache.oodt.commons.filter.TimeEventWeightedHash;
-
-/**
- * @author bfoster
- * @version $Revision$
- */
-public class MetadataTimeEventFilterAlgorithm extends FilterAlgorithm<MetadataTimeEvent> {
-
- protected long epsilon;
-
- public MetadataTimeEventFilterAlgorithm() {
- this.epsilon = 0;
- }
-
- public MetadataTimeEventFilterAlgorithm(long epsilon) {
- this.epsilon = epsilon;
- }
-
- public void setEpsilon(long epsilon) {
- this.epsilon = epsilon;
- }
-
- public long getEpsilon() {
- return this.epsilon;
- }
-
- @Override
- public List<MetadataTimeEvent> filter(List<MetadataTimeEvent> events) {
- TimeEventWeightedHash timeEventHash = TimeEventWeightedHash.buildHash(events, this.epsilon);
- return Collections.unmodifiableList((List<MetadataTimeEvent>) timeEventHash.getGreatestWeightedPathAsOrderedList());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/time/MetadataTimeEventQueryFilter.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/time/MetadataTimeEventQueryFilter.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/time/MetadataTimeEventQueryFilter.java
deleted file mode 100644
index 0802a9f..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/time/MetadataTimeEventQueryFilter.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.query.filter.time;
-
-//JDK imports
-import java.util.Collections;
-import java.util.List;
-import java.util.Vector;
-
-//OODT imports
-import org.apache.oodt.cas.catalog.metadata.TransactionalMetadata;
-import org.apache.oodt.cas.catalog.query.filter.QueryFilter;
-import org.apache.oodt.cas.catalog.query.filter.time.conv.AsciiSortableVersionConverter;
-import org.apache.oodt.cas.catalog.query.filter.time.conv.VersionConverter;
-
-//OODT imports
-
-/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A query filter that allows user to filter results in a complex query
- * <p>
- */
-public class MetadataTimeEventQueryFilter extends QueryFilter<MetadataTimeEvent> {
-
- private String startDateTimeMetKey, endDateTimeMetKey, priorityMetKey;
- private VersionConverter converter;
-
- public MetadataTimeEventQueryFilter() {
- super();
- this.converter = new AsciiSortableVersionConverter();
- }
-
- public String getStartDateTimeMetKey() {
- return startDateTimeMetKey;
- }
-
- public void setStartDateTimeMetKey(String startDateTimeMetKey) {
- this.startDateTimeMetKey = startDateTimeMetKey;
- }
-
- public String getEndDateTimeMetKey() {
- return endDateTimeMetKey;
- }
-
- public void setEndDateTimeMetKey(String endDateTimeMetKey) {
- this.endDateTimeMetKey = endDateTimeMetKey;
- }
-
- public String getPriorityMetKey() {
- return priorityMetKey;
- }
-
- public void setPriorityMetKey(String priorityMetKey) {
- this.priorityMetKey = priorityMetKey;
- }
-
- public VersionConverter getConverter() {
- return converter;
- }
-
- public void setConverter(VersionConverter converter) {
- if (converter != null) {
- this.converter = converter;
- }
- }
-
- @Override
- protected List<MetadataTimeEvent> metadataToFilterType(List<TransactionalMetadata> metadataList) {
- List<MetadataTimeEvent> timeEvents = new Vector<MetadataTimeEvent>();
- for (TransactionalMetadata transactionalMetadata : metadataList) {
- double priority = 0;
- if (this.getPriorityMetKey() != null) {
- priority = Double.parseDouble(transactionalMetadata.getMetadata().getMetadata(this.priorityMetKey));
- }
- long startTime = Long.parseLong(transactionalMetadata.getMetadata().getMetadata(this.startDateTimeMetKey));
- String endTimeString = transactionalMetadata.getMetadata().getMetadata(this.endDateTimeMetKey);
- long endTime = startTime;
- if (endTimeString != null) {
- endTime = Long.parseLong(endTimeString);
- }
- timeEvents.add(new MetadataTimeEvent(startTime, endTime, priority, transactionalMetadata));
- }
- return Collections.unmodifiableList(timeEvents);
- }
-
- @Override
- protected List<TransactionalMetadata> filterTypeToMetadata(List<MetadataTimeEvent> filterObjects) {
- List<TransactionalMetadata> metadataList = new Vector<TransactionalMetadata>();
- for (MetadataTimeEvent timeEvent : filterObjects) {
- metadataList.add(timeEvent.getTimeObject());
- }
- return Collections.unmodifiableList(metadataList);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/time/conv/AsciiSortableVersionConverter.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/time/conv/AsciiSortableVersionConverter.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/time/conv/AsciiSortableVersionConverter.java
deleted file mode 100644
index 855454b..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/time/conv/AsciiSortableVersionConverter.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.query.filter.time.conv;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Converts a ascii sortable String version into a priority number
- * <p>
- */
-public class AsciiSortableVersionConverter implements VersionConverter {
-
- public double convertToPriority(String version) {
- double priority = 0;
- char[] versionCharArray = version.toCharArray();
- for (int i = 0, j = versionCharArray.length - 1; i < versionCharArray.length; i++, j--) {
- priority += (((int) versionCharArray[i]) * Math.pow(10, j));
- }
- return priority;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/time/conv/VersionConverter.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/time/conv/VersionConverter.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/time/conv/VersionConverter.java
deleted file mode 100644
index 69ac864..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/time/conv/VersionConverter.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oodt.cas.catalog.query.filter.time.conv;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * An interface for converting a String version into a priority number
- * <p>
- */
-public interface VersionConverter {
-
- double convertToPriority(String version);
-
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/JJTQueryParserState.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/JJTQueryParserState.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/JJTQueryParserState.java
deleted file mode 100644
index 7e9b0a0..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/JJTQueryParserState.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/* Generated By:JavaCC: Do not edit this line. JJTQueryParserState.java Version 5.0 */
-package org.apache.oodt.cas.catalog.query.parser;
-
-public class JJTQueryParserState {
- private java.util.List<Node> nodes;
- private java.util.List<Integer> marks;
-
- private int sp; // number of nodes on stack
- private int mk; // current mark
- private boolean node_created;
-
- public JJTQueryParserState() {
- nodes = new java.util.ArrayList<Node>();
- marks = new java.util.ArrayList<Integer>();
- sp = 0;
- mk = 0;
- }
-
- /* Determines whether the current node was actually closed and
- pushed. This should only be called in the final user action of a
- node scope. */
- public boolean nodeCreated() {
- return node_created;
- }
-
- /* Call this to reinitialize the node stack. It is called
- automatically by the parser's ReInit() method. */
- public void reset() {
- nodes.clear();
- marks.clear();
- sp = 0;
- mk = 0;
- }
-
- /* Returns the root node of the AST. It only makes sense to call
- this after a successful parse. */
- public Node rootNode() {
- return nodes.get(0);
- }
-
- /* Pushes a node on to the stack. */
- public void pushNode(Node n) {
- nodes.add(n);
- ++sp;
- }
-
- /* Returns the node on the top of the stack, and remove it from the
- stack. */
- public Node popNode() {
- if (--sp < mk) {
- mk = marks.remove(marks.size()-1);
- }
- return nodes.remove(nodes.size()-1);
- }
-
- /* Returns the node currently on the top of the stack. */
- public Node peekNode() {
- return nodes.get(nodes.size()-1);
- }
-
- /* Returns the number of children on the stack in the current node
- scope. */
- public int nodeArity() {
- return sp - mk;
- }
-
-
- public void clearNodeScope(Node n) {
- while (sp > mk) {
- popNode();
- }
- mk = marks.remove(marks.size()-1);
- }
-
-
- public void openNodeScope(Node n) {
- marks.add(mk);
- mk = sp;
- n.jjtOpen();
- }
-
-
- /* A definite node is constructed from a specified number of
- children. That number of nodes are popped from the stack and
- made the children of the definite node. Then the definite node
- is pushed on to the stack. */
- public void closeNodeScope(Node n, int num) {
- mk = marks.remove(marks.size()-1);
- while (num-- > 0) {
- Node c = popNode();
- c.jjtSetParent(n);
- n.jjtAddChild(c, num);
- }
- n.jjtClose();
- pushNode(n);
- node_created = true;
- }
-
-
- /* A conditional node is constructed if its condition is true. All
- the nodes that have been pushed since the node was opened are
- made children of the conditional node, which is then pushed
- on to the stack. If the condition is false the node is not
- constructed and they are left on the stack. */
- public void closeNodeScope(Node n, boolean condition) {
- if (condition) {
- int a = nodeArity();
- mk = marks.remove(marks.size()-1);
- while (a-- > 0) {
- Node c = popNode();
- c.jjtSetParent(n);
- n.jjtAddChild(c, a);
- }
- n.jjtClose();
- pushNode(n);
- node_created = true;
- } else {
- mk = marks.remove(marks.size()-1);
- node_created = false;
- }
- }
-}
-/* JavaCC - OriginalChecksum=a225ad3a5c4857e9f64392e47d6acfb8 (do not edit this line) */
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/Node.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/Node.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/Node.java
deleted file mode 100644
index a2e88e7..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/Node.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Generated By:JJTree: Do not edit this line. Node.java Version 4.3 */
-/* JavaCCOptions:MULTI=false,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
-package org.apache.oodt.cas.catalog.query.parser;
-
-/* All AST nodes must implement this interface. It provides basic
- machinery for constructing the parent and child relationships
- between nodes. */
-
-public
-interface Node {
-
- /** This method is called after the node has been made the current
- node. It indicates that child nodes can now be added to it. */
- void jjtOpen();
-
- /** This method is called after all the child nodes have been
- added. */
- void jjtClose();
-
- /** This pair of methods are used to inform the node of its
- parent. */
- void jjtSetParent(Node n);
- Node jjtGetParent();
-
- /** This method tells the node to add its argument to the node's
- list of children. */
- void jjtAddChild(Node n, int i);
-
- /** This method returns a child node. The children are numbered
- from zero, left to right. */
- Node jjtGetChild(int i);
-
- /** Return the number of children the node has. */
- int jjtGetNumChildren();
-}
-/* JavaCC - OriginalChecksum=d803b99b9dbe9f48568711ddba598d1d (do not edit this line) */
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/ParseException.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/ParseException.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/ParseException.java
deleted file mode 100644
index c892ccf..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/ParseException.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 5.0 */
-/* JavaCCOptions:KEEP_LINE_COL=null */
-package org.apache.oodt.cas.catalog.query.parser;
-
-/**
- * This exception is thrown when parse errors are encountered.
- * You can explicitly create objects of this exception type by
- * calling the method generateParseException in the generated
- * parser.
- *
- * You can modify this class to customize your error reporting
- * mechanisms so long as you retain the public fields.
- */
-public class ParseException extends Exception {
-
- /**
- * The version identifier for this Serializable class.
- * Increment only if the <i>serialized</i> form of the
- * class changes.
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * This constructor is used by the method "generateParseException"
- * in the generated parser. Calling this constructor generates
- * a new object of this type with the fields "currentToken",
- * "expectedTokenSequences", and "tokenImage" set.
- */
- public ParseException(Token currentTokenVal,
- int[][] expectedTokenSequencesVal,
- String[] tokenImageVal
- )
- {
- super(initialise(currentTokenVal, expectedTokenSequencesVal, tokenImageVal));
- currentToken = currentTokenVal;
- expectedTokenSequences = expectedTokenSequencesVal;
- tokenImage = tokenImageVal;
- }
-
- /**
- * The following constructors are for use by you for whatever
- * purpose you can think of. Constructing the exception in this
- * manner makes the exception behave in the normal way - i.e., as
- * documented in the class "Throwable". The fields "errorToken",
- * "expectedTokenSequences", and "tokenImage" do not contain
- * relevant information. The JavaCC generated code does not use
- * these constructors.
- */
-
- public ParseException() {
- super();
- }
-
- /** Constructor with message. */
- public ParseException(String message) {
- super(message);
- }
-
-
- /**
- * This is the last token that has been consumed successfully. If
- * this object has been created due to a parse error, the token
- * followng this token will (therefore) be the first error token.
- */
- public Token currentToken;
-
- /**
- * Each entry in this array is an array of integers. Each array
- * of integers represents a sequence of tokens (by their ordinal
- * values) that is expected at this point of the parse.
- */
- public int[][] expectedTokenSequences;
-
- /**
- * This is a reference to the "tokenImage" array of the generated
- * parser within which the parse error occurred. This array is
- * defined in the generated ...Constants interface.
- */
- public String[] tokenImage;
-
- /**
- * It uses "currentToken" and "expectedTokenSequences" to generate a parse
- * error message and returns it. If this object has been created
- * due to a parse error, and you do not catch it (it gets thrown
- * from the parser) the correct error message
- * gets displayed.
- */
- private static String initialise(Token currentToken,
- int[][] expectedTokenSequences,
- String[] tokenImage) {
- String eol = System.getProperty("line.separator", "\n");
- StringBuilder expected = new StringBuilder();
- int maxSize = 0;
- for (int[] expectedTokenSequence : expectedTokenSequences) {
- if (maxSize < expectedTokenSequence.length) {
- maxSize = expectedTokenSequence.length;
- }
- for (int anExpectedTokenSequence : expectedTokenSequence) {
- expected.append(tokenImage[anExpectedTokenSequence]).append(' ');
- }
- if (expectedTokenSequence[expectedTokenSequence.length - 1] != 0) {
- expected.append("...");
- }
- expected.append(eol).append(" ");
- }
- StringBuilder retval = new StringBuilder();
- retval.append("Encountered \"");
- Token tok = currentToken.next;
- for (int i = 0; i < maxSize; i++) {
- if (i != 0) {
- retval.append(" ");
- }
- if (tok.kind == 0) {
- retval.append(tokenImage[0]);
- break;
- }
- retval.append(" ").append(tokenImage[tok.kind]);
- retval.append(" \"");
- retval.append(add_escapes(tok.image));
- retval.append(" \"");
- tok = tok.next;
- }
- retval.append("\" at line ").append(currentToken.next.beginLine).append(", column ")
- .append(currentToken.next.beginColumn);
- retval.append(".").append(eol);
- if (expectedTokenSequences.length == 1) {
- retval.append("Was expecting:").append(eol).append(" ");
- } else {
- retval.append("Was expecting one of:").append(eol).append(" ");
- }
- retval.append(expected.toString());
- return retval.toString();
- }
-
- /**
- * The end of line string for this machine.
- */
- protected String eol = System.getProperty("line.separator", "\n");
-
- /**
- * Used to convert raw characters to their escaped version
- * when these raw version cannot be used as part of an ASCII
- * string literal.
- */
- static String add_escapes(String str) {
- StringBuilder retval = new StringBuilder();
- char ch;
- for (int i = 0; i < str.length(); i++) {
- switch (str.charAt(i))
- {
- case 0 :
- continue;
- case '\b':
- retval.append("\\b");
- continue;
- case '\t':
- retval.append("\\t");
- continue;
- case '\n':
- retval.append("\\n");
- continue;
- case '\f':
- retval.append("\\f");
- continue;
- case '\r':
- retval.append("\\r");
- continue;
- case '\"':
- retval.append("\\\"");
- continue;
- case '\'':
- retval.append("\\\'");
- continue;
- case '\\':
- retval.append("\\\\");
- continue;
- default:
- if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
- String s = "0000" + Integer.toString(ch, 16);
- retval.append("\\u").append(s.substring(s.length() - 4, s.length()));
- } else {
- retval.append(ch);
- }
- }
- }
- return retval.toString();
- }
-
-}
-/* JavaCC - OriginalChecksum=2dc94ec6e6c4be52e333891b220b8ef1 (do not edit this line) */
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParser.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParser.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParser.java
deleted file mode 100644
index 1c6311e..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParser.java
+++ /dev/null
@@ -1,1000 +0,0 @@
-/* Generated By:JJTree&JavaCC: Do not edit this line. QueryParser.java */
- package org.apache.oodt.cas.catalog.query.parser;
-
- import org.apache.oodt.cas.catalog.query.*;
-import org.apache.oodt.cas.catalog.term.Term;
-
-import java.io.ByteArrayInputStream;
-import java.util.HashSet;
-import java.util.Properties;
-import java.util.Vector;
-@SuppressWarnings("all")
- public class QueryParser/*@bgen(jjtree)*/implements QueryParserTreeConstants, QueryParserConstants {/*@bgen(jjtree)*/
- protected JJTQueryParserState jjtree = new JJTQueryParserState();
- public static QueryExpression parseQueryExpression(String queryExpressionString) throws ParseException, TokenMgrError {
- return new QueryParser(new ByteArrayInputStream(queryExpressionString.getBytes())).parseInput();
- }
-
- public static void main( String[] args ) throws ParseException, TokenMgrError {
- System.out.println(new QueryParser( System.in ).parseInput());
- }
-
- final public QueryExpression parseInput() throws ParseException {
- /*@bgen(jjtree) parseInput */
- SimpleNode jjtn000 = new SimpleNode(JJTPARSEINPUT);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);QueryExpression qe;
- try {
- qe = Query(null);
- jj_consume_token(0);
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- {if (true) return qe;}
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- {if (true) throw (RuntimeException)jjte000;}
- }
- if (jjte000 instanceof ParseException) {
- {if (true) throw (ParseException)jjte000;}
- }
- {if (true) throw (Error)jjte000;}
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
- throw new Error("Missing return statement in function");
- }
-
- final public QueryExpression Query(Vector<String> bucketNames) throws ParseException {
- /*@bgen(jjtree) Query */
- SimpleNode jjtn000 = new SimpleNode(JJTQUERY);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);QueryExpression qe1;
- QueryExpression qe2 = null;
- Token operator = null;
- try {
- qe1 = QueryExpression(bucketNames);
- label_1:
- while (true) {
- if (jj_2_1(2147483647)) {
- } else {
- break label_1;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case AND:
- operator = jj_consume_token(AND);
- break;
- case OR:
- operator = jj_consume_token(OR);
- break;
- default:
- jj_la1[0] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- qe2 = Query(bucketNames);
- }
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- if (qe2 == null) {
- {if (true) return qe1;}
- }else {
- QueryLogicalGroup queryLogicalGroup = new QueryLogicalGroup();
- if (bucketNames != null)
- queryLogicalGroup.setBucketNames(new HashSet<String>(bucketNames));
- queryLogicalGroup.setOperator(QueryLogicalGroup.Operator.valueOf(operator.image.trim().toUpperCase()));
- queryLogicalGroup.addExpression(qe1);
- queryLogicalGroup.addExpression(qe2);
- {if (true) return queryLogicalGroup;}
- }
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- {if (true) throw (RuntimeException)jjte000;}
- }
- if (jjte000 instanceof ParseException) {
- {if (true) throw (ParseException)jjte000;}
- }
- {if (true) throw (Error)jjte000;}
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
- throw new Error("Missing return statement in function");
- }
-
- final public QueryExpression QueryExpression(Vector<String> bucketNames) throws ParseException {
- /*@bgen(jjtree) QueryExpression */
- SimpleNode jjtn000 = new SimpleNode(JJTQUERYEXPRESSION);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);QueryExpression qe;
- try {
- if (jj_2_2(2147483647)) {
- qe = PriorityQueryExpression(bucketNames);
- } else if (jj_2_3(2147483647)) {
- qe = StdQueryExpression();
- } else if (jj_2_4(2147483647)) {
- qe = CustomQueryExpression(bucketNames);
- } else if (jj_2_5(2147483647)) {
- qe = ComparisonQueryExpression(bucketNames);
- } else {
- jj_consume_token(-1);
- throw new ParseException();
- }
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- {if (true) return qe;}
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- {if (true) throw (RuntimeException)jjte000;}
- }
- if (jjte000 instanceof ParseException) {
- {if (true) throw (ParseException)jjte000;}
- }
- {if (true) throw (Error)jjte000;}
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
- throw new Error("Missing return statement in function");
- }
-
- final public QueryExpression StdQueryExpression() throws ParseException {
- /*@bgen(jjtree) StdQueryExpression */
- SimpleNode jjtn000 = new SimpleNode(JJTSTDQUERYEXPRESSION);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);QueryExpression qe = null;
- Vector<String> bucketNames = new Vector<String>();
- try {
- jj_consume_token(OPEN_BRACES);
- label_2:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case SPACE:
- break;
- default:
- jj_la1[1] = jj_gen;
- break label_2;
- }
- jj_consume_token(SPACE);
- }
- jj_consume_token(BUCKET_NAME_KEY);
- label_3:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case SPACE:
- break;
- default:
- jj_la1[2] = jj_gen;
- break label_3;
- }
- jj_consume_token(SPACE);
- }
- jj_consume_token(EQUALS);
- label_4:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case SPACE:
- break;
- default:
- jj_la1[3] = jj_gen;
- break label_4;
- }
- jj_consume_token(SPACE);
- }
- getValues(bucketNames);
- label_5:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case SPACE:
- break;
- default:
- jj_la1[4] = jj_gen;
- break label_5;
- }
- jj_consume_token(SPACE);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case SEMI_COLON:
- jj_consume_token(SEMI_COLON);
- label_6:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case SPACE:
- break;
- default:
- jj_la1[5] = jj_gen;
- break label_6;
- }
- jj_consume_token(SPACE);
- }
- qe = Query(bucketNames);
- break;
- default:
- jj_la1[6] = jj_gen;
- }
- label_7:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case SPACE:
- break;
- default:
- jj_la1[7] = jj_gen;
- break label_7;
- }
- jj_consume_token(SPACE);
- }
- jj_consume_token(CLOSE_BRACES);
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- if (qe == null) {
- {if (true) return new StdQueryExpression(new HashSet<String>(bucketNames));}
- }else {
- {if (true) return qe;}
- }
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- {if (true) throw (RuntimeException)jjte000;}
- }
- if (jjte000 instanceof ParseException) {
- {if (true) throw (ParseException)jjte000;}
- }
- {if (true) throw (Error)jjte000;}
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
- throw new Error("Missing return statement in function");
- }
-
- final public QueryExpression ComparisonQueryExpression(Vector<String> bucketNames) throws ParseException {
- /*@bgen(jjtree) ComparisonQueryExpression */
- SimpleNode jjtn000 = new SimpleNode(JJTCOMPARISONQUERYEXPRESSION);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);Token termName;
- Token operator;
- Vector<String> values = new Vector<String>();
- try {
- termName = jj_consume_token(TERM);
- label_8:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case SPACE:
- break;
- default:
- jj_la1[8] = jj_gen;
- break label_8;
- }
- jj_consume_token(SPACE);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case EQ:
- operator = jj_consume_token(EQ);
- break;
- case GT:
- operator = jj_consume_token(GT);
- break;
- case GE:
- operator = jj_consume_token(GE);
- break;
- case LT:
- operator = jj_consume_token(LT);
- break;
- case LE:
- operator = jj_consume_token(LE);
- break;
- default:
- jj_la1[9] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- label_9:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case SPACE:
- break;
- default:
- jj_la1[10] = jj_gen;
- break label_9;
- }
- jj_consume_token(SPACE);
- }
- getValues(values);
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- Term term = new Term(termName.image);
- term.setValues(values); //Arrays.asList(termValues.image.split(",")));
- ComparisonQueryExpression comparisonQueryExpression = new ComparisonQueryExpression();
- if (bucketNames != null)
- comparisonQueryExpression.setBucketNames(new HashSet<String>(bucketNames));
- comparisonQueryExpression.setTerm(term);
- comparisonQueryExpression.setOperator(ComparisonQueryExpression.Operator.getOperatorBySign(operator.image));
- {if (true) return comparisonQueryExpression;}
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- {if (true) throw (RuntimeException)jjte000;}
- }
- if (jjte000 instanceof ParseException) {
- {if (true) throw (ParseException)jjte000;}
- }
- {if (true) throw (Error)jjte000;}
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
- throw new Error("Missing return statement in function");
- }
-
- final public QueryExpression PriorityQueryExpression(Vector<String> bucketNames) throws ParseException {
- /*@bgen(jjtree) PriorityQueryExpression */
- SimpleNode jjtn000 = new SimpleNode(JJTPRIORITYQUERYEXPRESSION);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);QueryExpression qe;
- try {
- jj_consume_token(OPEN_PARENS);
- qe = Query(bucketNames);
- jj_consume_token(CLOSE_PARENS);
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- {if (true) return qe;}
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- {if (true) throw (RuntimeException)jjte000;}
- }
- if (jjte000 instanceof ParseException) {
- {if (true) throw (ParseException)jjte000;}
- }
- {if (true) throw (Error)jjte000;}
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
- throw new Error("Missing return statement in function");
- }
-
- final public QueryExpression CustomQueryExpression(Vector<String> bucketNames) throws ParseException {
- /*@bgen(jjtree) CustomQueryExpression */
- SimpleNode jjtn000 = new SimpleNode(JJTCUSTOMQUERYEXPRESSION);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);Token customNameToken;
- Properties p = new Properties();
- try {
- jj_consume_token(OPEN_BRACES);
- label_10:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case SPACE:
- break;
- default:
- jj_la1[11] = jj_gen;
- break label_10;
- }
- jj_consume_token(SPACE);
- }
- jj_consume_token(CUSTOM_NAME_KEY);
- label_11:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case SPACE:
- break;
- default:
- jj_la1[12] = jj_gen;
- break label_11;
- }
- jj_consume_token(SPACE);
- }
- jj_consume_token(EQUALS);
- label_12:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case SPACE:
- break;
- default:
- jj_la1[13] = jj_gen;
- break label_12;
- }
- jj_consume_token(SPACE);
- }
- jj_consume_token(QUOTE);
- customNameToken = jj_consume_token(TERM);
- jj_consume_token(QUOTE);
- if (jj_2_6(2147483647)) {
- label_13:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case SPACE:
- break;
- default:
- jj_la1[14] = jj_gen;
- break label_13;
- }
- jj_consume_token(SPACE);
- }
- jj_consume_token(SEMI_COLON);
- getProperties(p);
- } else {
- }
- label_14:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case SPACE:
- break;
- default:
- jj_la1[15] = jj_gen;
- break label_14;
- }
- jj_consume_token(SPACE);
- }
- jj_consume_token(CLOSE_BRACES);
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- CustomQueryExpression cqe = new CustomQueryExpression(customNameToken.image, p);
- if (bucketNames != null)
- cqe.setBucketNames(new HashSet<String>(bucketNames));
- {if (true) return cqe;}
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- {if (true) throw (RuntimeException)jjte000;}
- }
- if (jjte000 instanceof ParseException) {
- {if (true) throw (ParseException)jjte000;}
- }
- {if (true) throw (Error)jjte000;}
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
- throw new Error("Missing return statement in function");
- }
-
- final public void getValues(Vector<String> values) throws ParseException {
- /*@bgen(jjtree) getValues */
- SimpleNode jjtn000 = new SimpleNode(JJTGETVALUES);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);Token value;
- try {
- value = jj_consume_token(VALUE);
- label_15:
- while (true) {
- if (jj_2_7(2147483647)) {
- } else {
- break label_15;
- }
- jj_consume_token(COMMA);
- getValues(values);
- }
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- values.add(0, value.image.replaceAll("'", ""));
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- {if (true) throw (RuntimeException)jjte000;}
- }
- if (jjte000 instanceof ParseException) {
- {if (true) throw (ParseException)jjte000;}
- }
- {if (true) throw (Error)jjte000;}
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
- }
-
- final public void getProperties(Properties p) throws ParseException {
- /*@bgen(jjtree) getProperties */
- SimpleNode jjtn000 = new SimpleNode(JJTGETPROPERTIES);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);Token propertyKey;
- Token propertyVal;
- try {
- propertyKey = jj_consume_token(P_KEY);
- label_16:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case SPACE:
- break;
- default:
- jj_la1[16] = jj_gen;
- break label_16;
- }
- jj_consume_token(SPACE);
- }
- jj_consume_token(EQUALS);
- label_17:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case SPACE:
- break;
- default:
- jj_la1[17] = jj_gen;
- break label_17;
- }
- jj_consume_token(SPACE);
- }
- propertyVal = jj_consume_token(VALUE);
- label_18:
- while (true) {
- if (jj_2_8(2147483647)) {
- } else {
- break label_18;
- }
- jj_consume_token(COMMA);
- getProperties(p);
- }
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- p.put(propertyKey.image.substring(2), propertyVal.image.replaceAll("'", ""));
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- {if (true) throw (RuntimeException)jjte000;}
- }
- if (jjte000 instanceof ParseException) {
- {if (true) throw (ParseException)jjte000;}
- }
- {if (true) throw (Error)jjte000;}
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
- }
-
- private boolean jj_2_1(int xla) {
- jj_la = xla; jj_lastpos = jj_scanpos = token;
- try { return !jj_3_1(); }
- catch(LookaheadSuccess ls) { return true; }
- finally { jj_save(0, xla); }
- }
-
- private boolean jj_2_2(int xla) {
- jj_la = xla; jj_lastpos = jj_scanpos = token;
- try { return !jj_3_2(); }
- catch(LookaheadSuccess ls) { return true; }
- finally { jj_save(1, xla); }
- }
-
- private boolean jj_2_3(int xla) {
- jj_la = xla; jj_lastpos = jj_scanpos = token;
- try { return !jj_3_3(); }
- catch(LookaheadSuccess ls) { return true; }
- finally { jj_save(2, xla); }
- }
-
- private boolean jj_2_4(int xla) {
- jj_la = xla; jj_lastpos = jj_scanpos = token;
- try { return !jj_3_4(); }
- catch(LookaheadSuccess ls) { return true; }
- finally { jj_save(3, xla); }
- }
-
- private boolean jj_2_5(int xla) {
- jj_la = xla; jj_lastpos = jj_scanpos = token;
- try { return !jj_3_5(); }
- catch(LookaheadSuccess ls) { return true; }
- finally { jj_save(4, xla); }
- }
-
- private boolean jj_2_6(int xla) {
- jj_la = xla; jj_lastpos = jj_scanpos = token;
- try { return !jj_3_6(); }
- catch(LookaheadSuccess ls) { return true; }
- finally { jj_save(5, xla); }
- }
-
- private boolean jj_2_7(int xla) {
- jj_la = xla; jj_lastpos = jj_scanpos = token;
- try { return !jj_3_7(); }
- catch(LookaheadSuccess ls) { return true; }
- finally { jj_save(6, xla); }
- }
-
- private boolean jj_2_8(int xla) {
- jj_la = xla; jj_lastpos = jj_scanpos = token;
- try { return !jj_3_8(); }
- catch(LookaheadSuccess ls) { return true; }
- finally { jj_save(7, xla); }
- }
-
- private boolean jj_3_8() {
- if (jj_scan_token(COMMA)) return true;
- return false;
- }
-
- private boolean jj_3_3() {
- if (jj_scan_token(OPEN_BRACES)) return true;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_scan_token(4)) { jj_scanpos = xsp; break; }
- }
- if (jj_scan_token(BUCKET_NAME_KEY)) return true;
- return false;
- }
-
- private boolean jj_3_2() {
- if (jj_scan_token(OPEN_PARENS)) return true;
- return false;
- }
-
- private boolean jj_3_7() {
- if (jj_scan_token(COMMA)) return true;
- return false;
- }
-
- private boolean jj_3_1() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_scan_token(5)) {
- jj_scanpos = xsp;
- if (jj_scan_token(6)) return true;
- }
- return false;
- }
-
- private boolean jj_3_5() {
- if (jj_scan_token(TERM)) return true;
- return false;
- }
-
- private boolean jj_3_6() {
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_scan_token(4)) { jj_scanpos = xsp; break; }
- }
- if (jj_scan_token(SEMI_COLON)) return true;
- return false;
- }
-
- private boolean jj_3_4() {
- if (jj_scan_token(OPEN_BRACES)) return true;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_scan_token(4)) { jj_scanpos = xsp; break; }
- }
- if (jj_scan_token(CUSTOM_NAME_KEY)) return true;
- return false;
- }
-
- public QueryParserTokenManager token_source;
- SimpleCharStream jj_input_stream;
- public Token token, jj_nt;
- private int jj_ntk;
- private Token jj_scanpos, jj_lastpos;
- private int jj_la;
- public boolean lookingAhead = false;
- private boolean jj_semLA;
- private int jj_gen;
- final private int[] jj_la1 = new int[18];
- static private int[] jj_la1_0;
- static {
- jj_la1_0();
- }
- private static void jj_la1_0() {
- jj_la1_0 = new int[] {0x60,0x10,0x10,0x10,0x10,0x10,0x200,0x10,0x10,0x7c0000,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,};
- }
- final private JJCalls[] jj_2_rtns = new JJCalls[8];
- private boolean jj_rescan = false;
- private int jj_gc = 0;
-
- public QueryParser(java.io.InputStream stream) {
- this(stream, null);
- }
- public QueryParser(java.io.InputStream stream, String encoding) {
- try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
- token_source = new QueryParserTokenManager(jj_input_stream);
- token = new Token();
- jj_ntk = -1;
- jj_gen = 0;
- for (int i = 0; i < 18; i++) jj_la1[i] = -1;
- for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
- }
-
- public void ReInit(java.io.InputStream stream) {
- ReInit(stream, null);
- }
- public void ReInit(java.io.InputStream stream, String encoding) {
- try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
- token_source.ReInit(jj_input_stream);
- token = new Token();
- jj_ntk = -1;
- jjtree.reset();
- jj_gen = 0;
- for (int i = 0; i < 18; i++) jj_la1[i] = -1;
- for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
- }
-
- public QueryParser(java.io.Reader stream) {
- jj_input_stream = new SimpleCharStream(stream, 1, 1);
- token_source = new QueryParserTokenManager(jj_input_stream);
- token = new Token();
- jj_ntk = -1;
- jj_gen = 0;
- for (int i = 0; i < 18; i++) jj_la1[i] = -1;
- for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
- }
-
- public void ReInit(java.io.Reader stream) {
- jj_input_stream.ReInit(stream, 1, 1);
- token_source.ReInit(jj_input_stream);
- token = new Token();
- jj_ntk = -1;
- jjtree.reset();
- jj_gen = 0;
- for (int i = 0; i < 18; i++) jj_la1[i] = -1;
- for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
- }
-
- public QueryParser(QueryParserTokenManager tm) {
- token_source = tm;
- token = new Token();
- jj_ntk = -1;
- jj_gen = 0;
- for (int i = 0; i < 18; i++) jj_la1[i] = -1;
- for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
- }
-
- public void ReInit(QueryParserTokenManager tm) {
- token_source = tm;
- token = new Token();
- jj_ntk = -1;
- jjtree.reset();
- jj_gen = 0;
- for (int i = 0; i < 18; i++) jj_la1[i] = -1;
- for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
- }
-
- private Token jj_consume_token(int kind) throws ParseException {
- Token oldToken;
- if ((oldToken = token).next != null) token = token.next;
- else token = token.next = token_source.getNextToken();
- jj_ntk = -1;
- if (token.kind == kind) {
- jj_gen++;
- if (++jj_gc > 100) {
- jj_gc = 0;
- for (JJCalls jj_2_rtn : jj_2_rtns) {
- JJCalls c = jj_2_rtn;
- while (c != null) {
- if (c.gen < jj_gen) {
- c.first = null;
- }
- c = c.next;
- }
- }
- }
- return token;
- }
- token = oldToken;
- jj_kind = kind;
- throw generateParseException();
- }
-
- static private final class LookaheadSuccess extends java.lang.Error { }
- final private LookaheadSuccess jj_ls = new LookaheadSuccess();
- private boolean jj_scan_token(int kind) {
- if (jj_scanpos == jj_lastpos) {
- jj_la--;
- if (jj_scanpos.next == null) {
- jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
- } else {
- jj_lastpos = jj_scanpos = jj_scanpos.next;
- }
- } else {
- jj_scanpos = jj_scanpos.next;
- }
- if (jj_rescan) {
- int i = 0; Token tok = token;
- while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; }
- if (tok != null) jj_add_error_token(kind, i);
- }
- if (jj_scanpos.kind != kind) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls;
- return false;
- }
-
- final public Token getNextToken() {
- if (token.next != null) token = token.next;
- else token = token.next = token_source.getNextToken();
- jj_ntk = -1;
- jj_gen++;
- return token;
- }
-
- final public Token getToken(int index) {
- Token t = lookingAhead ? jj_scanpos : token;
- for (int i = 0; i < index; i++) {
- if (t.next != null) t = t.next;
- else t = t.next = token_source.getNextToken();
- }
- return t;
- }
-
- private int jj_ntk() {
- if ((jj_nt=token.next) == null)
- return (jj_ntk = (token.next=token_source.getNextToken()).kind);
- else
- return (jj_ntk = jj_nt.kind);
- }
-
- private java.util.Vector<int[]> jj_expentries = new java.util.Vector<int[]>();
- private int[] jj_expentry;
- private int jj_kind = -1;
- private int[] jj_lasttokens = new int[100];
- private int jj_endpos;
-
- private void jj_add_error_token(int kind, int pos) {
- if (pos >= 100) return;
- if (pos == jj_endpos + 1) {
- jj_lasttokens[jj_endpos++] = kind;
- } else if (jj_endpos != 0) {
- jj_expentry = new int[jj_endpos];
- for (int i = 0; i < jj_endpos; i++) {
- jj_expentry[i] = jj_lasttokens[i];
- }
- boolean exists = false;
- for (java.util.Enumeration e = jj_expentries.elements(); e.hasMoreElements();) {
- int[] oldentry = (int[])(e.nextElement());
- if (oldentry.length == jj_expentry.length) {
- exists = true;
- for (int i = 0; i < jj_expentry.length; i++) {
- if (oldentry[i] != jj_expentry[i]) {
- exists = false;
- break;
- }
- }
- if (exists) break;
- }
- }
- if (!exists) jj_expentries.addElement(jj_expentry);
- if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
- }
- }
-
- public ParseException generateParseException() {
- jj_expentries.removeAllElements();
- boolean[] la1tokens = new boolean[28];
- for (int i = 0; i < 28; i++) {
- la1tokens[i] = false;
- }
- if (jj_kind >= 0) {
- la1tokens[jj_kind] = true;
- jj_kind = -1;
- }
- for (int i = 0; i < 18; i++) {
- if (jj_la1[i] == jj_gen) {
- for (int j = 0; j < 32; j++) {
- if ((jj_la1_0[i] & (1<<j)) != 0) {
- la1tokens[j] = true;
- }
- }
- }
- }
- for (int i = 0; i < 28; i++) {
- if (la1tokens[i]) {
- jj_expentry = new int[1];
- jj_expentry[0] = i;
- jj_expentries.addElement(jj_expentry);
- }
- }
- jj_endpos = 0;
- jj_rescan_token();
- jj_add_error_token(0, 0);
- int[][] exptokseq = new int[jj_expentries.size()][];
- for (int i = 0; i < jj_expentries.size(); i++) {
- exptokseq[i] = jj_expentries.elementAt(i);
- }
- return new ParseException(token, exptokseq, tokenImage);
- }
-
- final public void enable_tracing() {
- }
-
- final public void disable_tracing() {
- }
-
- private void jj_rescan_token() {
- jj_rescan = true;
- for (int i = 0; i < 8; i++) {
- try {
- JJCalls p = jj_2_rtns[i];
- do {
- if (p.gen > jj_gen) {
- jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
- switch (i) {
- case 0: jj_3_1(); break;
- case 1: jj_3_2(); break;
- case 2: jj_3_3(); break;
- case 3: jj_3_4(); break;
- case 4: jj_3_5(); break;
- case 5: jj_3_6(); break;
- case 6: jj_3_7(); break;
- case 7: jj_3_8(); break;
- }
- }
- p = p.next;
- } while (p != null);
- } catch(LookaheadSuccess ls) { }
- }
- jj_rescan = false;
- }
-
- private void jj_save(int index, int xla) {
- JJCalls p = jj_2_rtns[index];
- while (p.gen > jj_gen) {
- if (p.next == null) { p = p.next = new JJCalls(); break; }
- p = p.next;
- }
- p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla;
- }
-
- static final class JJCalls {
- int gen;
- Token first;
- int arg;
- JJCalls next;
- }
-
- }
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParser.jj
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParser.jj b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParser.jj
deleted file mode 100644
index 2537616..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParser.jj
+++ /dev/null
@@ -1,497 +0,0 @@
-/*@bgen(jjtree) Generated By:JJTree: Do not edit this line. ./QueryParser.jj */
-/*@egen*//*
- * 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.
- */
-
-options {
- JDK_VERSION = "1.5";
- STATIC = false;
-}
-
-PARSER_BEGIN(QueryParser)
- package org.apache.oodt.cas.catalog.query.parser;
-
- import java.io.ByteArrayInputStream;
- import java.util.Arrays;
- import java.util.HashSet;
- import java.util.Vector;
- import java.util.Properties;
- import org.apache.oodt.cas.catalog.query.QueryExpression;
- import org.apache.oodt.cas.catalog.query.QueryLogicalGroup;
- import org.apache.oodt.cas.catalog.query.StdQueryExpression;
- import org.apache.oodt.cas.catalog.query.ComparisonQueryExpression;
- import org.apache.oodt.cas.catalog.query.CustomQueryExpression;
- import org.apache.oodt.cas.catalog.term.Term;
-
- public class QueryParser/*@bgen(jjtree)*/implements QueryParserTreeConstants/*@egen*/ {/*@bgen(jjtree)*/
- protected JJTQueryParserState jjtree = new JJTQueryParserState();
-
-/*@egen*/
-
- public static QueryExpression parseQueryExpression(String queryExpressionString) throws ParseException, TokenMgrError {
- return new QueryParser(new ByteArrayInputStream(queryExpressionString.getBytes())).parseInput();
- }
-
- public static void main( String[] args ) throws ParseException, TokenMgrError {
- System.out.println(new QueryParser( System.in ).parseInput());
- }
-
- }
-PARSER_END(QueryParser)
-
-SKIP : { "\r" | "\n" | "\r\n" }
-TOKEN: { < SPACE : " " > }
-TOKEN: { < AND : " AND " > }
-TOKEN: { < OR : " OR " > }
-TOKEN: { < QUOTE : "'" > }
-TOKEN: { < EQUALS : "=" > }
-TOKEN: { < SEMI_COLON : ";" > }
-TOKEN: { < COMMA : "," > }
-TOKEN: { < OPEN_BRACES : "{" > }
-TOKEN: { < CLOSE_BRACES : "}" > }
-TOKEN: { < OPEN_PARENS : "(" > }
-TOKEN: { < CLOSE_PARENS : ")" > }
-TOKEN: { < BUCKET_NAME_KEY : "bucketNames" > }
-TOKEN: { < CUSTOM_NAME_KEY : "name" > }
-TOKEN: { < P_KEY : "p:" <TERM> > }
-TOKEN: {
- < EQ : "==" >
- | < GE : ">=" >
- | < GT : ">" >
- | < LE : "<=" >
- | < LT : "<" >
-}
-TOKEN: { < TERM: (["a"-"z","A"-"Z"])+ (<STRING_LITERAL>)* > }
-TOKEN: { < VALUE : "'" ( <TERM> | <NON_TERM> ) "'" > }
-TOKEN: { < #NON_TERM: (<STRING_LITERAL> | <SPECIAL_CHARS>)+ (<STRING_LITERAL> | " "<STRING_LITERAL> | " "<SPECIAL_CHARS> | <SPECIAL_CHARS>)* > }
-TOKEN: { < #STRING_LITERAL: (["0"-"9","a"-"z","A"-"Z","-","_",".",":","/"]) > }
-TOKEN: { < #SPECIAL_CHARS: (["/","\\","?","<",">","~","`","*","#","&","!","@","$","%","^","(",")","{","}","[","]"]) > }
-
-QueryExpression parseInput() :
-{/*@bgen(jjtree) parseInput */
- SimpleNode jjtn000 = new SimpleNode(JJTPARSEINPUT);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
-/*@egen*/
- QueryExpression qe = null;
-}
-{/*@bgen(jjtree) parseInput */
- try {
-/*@egen*/
- qe = Query(null) <EOF>/*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- }
-/*@egen*/
- { return qe; }/*@bgen(jjtree)*/
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
-/*@egen*/
-}
-
-QueryExpression Query(Vector<String> bucketNames) :
-{/*@bgen(jjtree) Query */
- SimpleNode jjtn000 = new SimpleNode(JJTQUERY);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
-/*@egen*/
- QueryExpression qe1 = null;
- QueryExpression qe2 = null;
- Token operator = null;
-}
-{/*@bgen(jjtree) Query */
- try {
-/*@egen*/
- qe1 = QueryExpression(bucketNames) ( LOOKAHEAD( <AND> | <OR> ) ( operator = <AND> | operator = <OR> ) qe2 = Query(bucketNames) )*/*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- }
-/*@egen*/
- {
- if (qe2 == null) {
- return qe1;
- }else {
- QueryLogicalGroup queryLogicalGroup = new QueryLogicalGroup();
- if (bucketNames != null)
- queryLogicalGroup.setBucketNames(new HashSet<String>(bucketNames));
- queryLogicalGroup.setOperator(QueryLogicalGroup.Operator.valueOf(operator.image.trim().toUpperCase()));
- queryLogicalGroup.addExpression(qe1);
- queryLogicalGroup.addExpression(qe2);
- return queryLogicalGroup;
- }
- }/*@bgen(jjtree)*/
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
-/*@egen*/
-}
-
-QueryExpression QueryExpression(Vector<String> bucketNames) :
-{/*@bgen(jjtree) QueryExpression */
- SimpleNode jjtn000 = new SimpleNode(JJTQUERYEXPRESSION);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
-/*@egen*/
- QueryExpression qe = null;
-}
-{/*@bgen(jjtree) QueryExpression */
- try {
-/*@egen*/
- (
- LOOKAHEAD ( <OPEN_PARENS> )
- qe = PriorityQueryExpression(bucketNames)
- |
- LOOKAHEAD ( <OPEN_BRACES> (<SPACE>)* <BUCKET_NAME_KEY> )
- qe = StdQueryExpression()
- |
- LOOKAHEAD ( <OPEN_BRACES> (<SPACE>)* <CUSTOM_NAME_KEY> )
- qe = CustomQueryExpression(bucketNames)
- |
- LOOKAHEAD ( <TERM> )
- qe = ComparisonQueryExpression(bucketNames)
- )/*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- }
-/*@egen*/
-
- { return qe; }/*@bgen(jjtree)*/
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
-/*@egen*/
-}
-
-QueryExpression StdQueryExpression() :
-{/*@bgen(jjtree) StdQueryExpression */
- SimpleNode jjtn000 = new SimpleNode(JJTSTDQUERYEXPRESSION);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
-/*@egen*/
- QueryExpression qe = null;
- Vector<String> bucketNames = new Vector<String>();
-}
-{/*@bgen(jjtree) StdQueryExpression */
- try {
-/*@egen*/
- <OPEN_BRACES> (<SPACE>)* <BUCKET_NAME_KEY> (<SPACE>)* <EQUALS> (<SPACE>)* getValues(bucketNames) (<SPACE>)* [<SEMI_COLON> (<SPACE>)* qe = Query(bucketNames)] (<SPACE>)* <CLOSE_BRACES>/*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- }
-/*@egen*/
- {
- if (qe == null) {
- return new StdQueryExpression(new HashSet<String>(bucketNames));
- }else {
- return qe;
- }
- }/*@bgen(jjtree)*/
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
-/*@egen*/
-}
-
-QueryExpression ComparisonQueryExpression(Vector<String> bucketNames) :
-{/*@bgen(jjtree) ComparisonQueryExpression */
- SimpleNode jjtn000 = new SimpleNode(JJTCOMPARISONQUERYEXPRESSION);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
-/*@egen*/
- Token termName = null;
- Token operator = null;
- Vector<String> values = new Vector<String>();
-}
-{/*@bgen(jjtree) ComparisonQueryExpression */
- try {
-/*@egen*/
- termName = <TERM> (<SPACE>)* ( operator = <EQ> | operator = <GT> | operator = <GE> | operator = <LT> | operator = <LE> ) (<SPACE>)* getValues(values)/*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- }
-/*@egen*/
- {
- Term term = new Term(termName.image);
- term.setValues(values); //Arrays.asList(termValues.image.split(",")));
- ComparisonQueryExpression comparisonQueryExpression = new ComparisonQueryExpression();
- if (bucketNames != null)
- comparisonQueryExpression.setBucketNames(new HashSet<String>(bucketNames));
- comparisonQueryExpression.setTerm(term);
- comparisonQueryExpression.setOperator(ComparisonQueryExpression.Operator.getOperatorBySign(operator.image));
- return comparisonQueryExpression;
- }/*@bgen(jjtree)*/
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
-/*@egen*/
-}
-
-QueryExpression PriorityQueryExpression(Vector<String> bucketNames) :
-{/*@bgen(jjtree) PriorityQueryExpression */
- SimpleNode jjtn000 = new SimpleNode(JJTPRIORITYQUERYEXPRESSION);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
-/*@egen*/
- QueryExpression qe = null;
-}
-{/*@bgen(jjtree) PriorityQueryExpression */
- try {
-/*@egen*/
- <OPEN_PARENS> qe = Query(bucketNames) <CLOSE_PARENS>/*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- }
-/*@egen*/
- { return qe; }/*@bgen(jjtree)*/
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
-/*@egen*/
-}
-
-QueryExpression CustomQueryExpression(Vector<String> bucketNames) :
-{/*@bgen(jjtree) CustomQueryExpression */
- SimpleNode jjtn000 = new SimpleNode(JJTCUSTOMQUERYEXPRESSION);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
-/*@egen*/
- Token customNameToken = null;
- Properties p = new Properties();
-}
-{/*@bgen(jjtree) CustomQueryExpression */
- try {
-/*@egen*/
- <OPEN_BRACES> (<SPACE>)* <CUSTOM_NAME_KEY> (<SPACE>)* <EQUALS> (<SPACE>)* <QUOTE> customNameToken = <TERM> <QUOTE> [ LOOKAHEAD ((<SPACE>)* <SEMI_COLON>) (<SPACE>)* <SEMI_COLON> getProperties(p) ] (<SPACE>)* <CLOSE_BRACES>/*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- }
-/*@egen*/
- {
- CustomQueryExpression cqe = new CustomQueryExpression(customNameToken.image, p);
- if (bucketNames != null)
- cqe.setBucketNames(new HashSet<String>(bucketNames));
- return cqe;
- }/*@bgen(jjtree)*/
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
-/*@egen*/
-}
-
-void getValues(Vector<String> values) :
-{/*@bgen(jjtree) getValues */
- SimpleNode jjtn000 = new SimpleNode(JJTGETVALUES);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
-/*@egen*/
- Token value = null;
-}
-{/*@bgen(jjtree) getValues */
- try {
-/*@egen*/
- value = <VALUE> ( LOOKAHEAD (<COMMA>) <COMMA> getValues(values) ) */*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- }
-/*@egen*/
- {
- values.add(0, value.image.replaceAll("'", ""));
- }/*@bgen(jjtree)*/
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
-/*@egen*/
-}
-
-void getProperties(Properties p) :
-{/*@bgen(jjtree) getProperties */
- SimpleNode jjtn000 = new SimpleNode(JJTGETPROPERTIES);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
-/*@egen*/
- Token propertyKey = null;
- Token propertyVal = null;
-}
-{/*@bgen(jjtree) getProperties */
- try {
-/*@egen*/
- propertyKey = <P_KEY> (<SPACE>)* <EQUALS> (<SPACE>)* propertyVal = <VALUE> ( LOOKAHEAD (<COMMA>) <COMMA> getProperties(p) ) */*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- }
-/*@egen*/
- {
- p.put(propertyKey.image.substring(2), propertyVal.image.replaceAll("'", ""));
- }/*@bgen(jjtree)*/
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
-/*@egen*/
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParser.jjt
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParser.jjt b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParser.jjt
deleted file mode 100644
index 60697fb..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParser.jjt
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-options {
- JDK_VERSION = "1.5";
- STATIC = false;
-}
-
-PARSER_BEGIN(QueryParser)
- package org.apache.oodt.cas.catalog.query.parser;
-
- import java.io.ByteArrayInputStream;
- import java.util.Arrays;
- import java.util.HashSet;
- import java.util.Vector;
- import java.util.Properties;
- import org.apache.oodt.cas.catalog.query.QueryExpression;
- import org.apache.oodt.cas.catalog.query.QueryLogicalGroup;
- import org.apache.oodt.cas.catalog.query.StdQueryExpression;
- import org.apache.oodt.cas.catalog.query.ComparisonQueryExpression;
- import org.apache.oodt.cas.catalog.query.CustomQueryExpression;
- import org.apache.oodt.cas.catalog.term.Term;
-
- public class QueryParser {
-
- public static QueryExpression parseQueryExpression(String queryExpressionString) throws ParseException, TokenMgrError {
- return new QueryParser(new ByteArrayInputStream(queryExpressionString.getBytes())).parseInput();
- }
-
- public static void main( String[] args ) throws ParseException, TokenMgrError {
- System.out.println(new QueryParser( System.in ).parseInput());
- }
-
- }
-PARSER_END(QueryParser)
-
-SKIP : { "\r" | "\n" | "\r\n" }
-TOKEN: { < SPACE : " " > }
-TOKEN: { < AND : " AND " > }
-TOKEN: { < OR : " OR " > }
-TOKEN: { < QUOTE : "'" > }
-TOKEN: { < EQUALS : "=" > }
-TOKEN: { < SEMI_COLON : ";" > }
-TOKEN: { < COMMA : "," > }
-TOKEN: { < OPEN_BRACES : "{" > }
-TOKEN: { < CLOSE_BRACES : "}" > }
-TOKEN: { < OPEN_PARENS : "(" > }
-TOKEN: { < CLOSE_PARENS : ")" > }
-TOKEN: { < BUCKET_NAME_KEY : "bucketNames" > }
-TOKEN: { < CUSTOM_NAME_KEY : "name" > }
-TOKEN: { < P_KEY : "p:" <TERM> > }
-TOKEN: {
- < EQ : "==" >
- | < GE : ">=" >
- | < GT : ">" >
- | < LE : "<=" >
- | < LT : "<" >
-}
-TOKEN: { < TERM: (["a"-"z","A"-"Z"])+ (<STRING_LITERAL>)* > }
-TOKEN: { < VALUE : "'" ( <TERM> | <NON_TERM> ) "'" > }
-TOKEN: { < #NON_TERM: (<STRING_LITERAL> | <SPECIAL_CHARS>)+ (<STRING_LITERAL> | " "<STRING_LITERAL> | " "<SPECIAL_CHARS> | <SPECIAL_CHARS>)* > }
-TOKEN: { < #STRING_LITERAL: (["0"-"9","a"-"z","A"-"Z","-","_",".",":","/"]) > }
-TOKEN: { < #SPECIAL_CHARS: (["/","\\","?","<",">","~","`","*","#","&","!","@","$","%","^","(",")","{","}","[","]"]) > }
-
-QueryExpression parseInput() :
-{
- QueryExpression qe = null;
-}
-{
- qe = Query(null) <EOF>
- { return qe; }
-}
-
-QueryExpression Query(Vector<String> bucketNames) :
-{
- QueryExpression qe1 = null;
- QueryExpression qe2 = null;
- Token operator = null;
-}
-{
- qe1 = QueryExpression(bucketNames) ( LOOKAHEAD( <AND> | <OR> ) ( operator = <AND> | operator = <OR> ) qe2 = Query(bucketNames) )*
- {
- if (qe2 == null) {
- return qe1;
- }else {
- QueryLogicalGroup queryLogicalGroup = new QueryLogicalGroup();
- if (bucketNames != null)
- queryLogicalGroup.setBucketNames(new HashSet<String>(bucketNames));
- queryLogicalGroup.setOperator(QueryLogicalGroup.Operator.valueOf(operator.image.trim().toUpperCase()));
- queryLogicalGroup.addExpression(qe1);
- queryLogicalGroup.addExpression(qe2);
- return queryLogicalGroup;
- }
- }
-}
-
-QueryExpression QueryExpression(Vector<String> bucketNames) :
-{
- QueryExpression qe = null;
-}
-{
- (
- LOOKAHEAD ( <OPEN_PARENS> )
- qe = PriorityQueryExpression(bucketNames)
- |
- LOOKAHEAD ( <OPEN_BRACES> (<SPACE>)* <BUCKET_NAME_KEY> )
- qe = StdQueryExpression()
- |
- LOOKAHEAD ( <OPEN_BRACES> (<SPACE>)* <CUSTOM_NAME_KEY> )
- qe = CustomQueryExpression(bucketNames)
- |
- LOOKAHEAD ( <TERM> )
- qe = ComparisonQueryExpression(bucketNames)
- )
-
- { return qe; }
-}
-
-QueryExpression StdQueryExpression() :
-{
- QueryExpression qe = null;
- Vector<String> bucketNames = new Vector<String>();
-}
-{
- <OPEN_BRACES> (<SPACE>)* <BUCKET_NAME_KEY> (<SPACE>)* <EQUALS> (<SPACE>)* getValues(bucketNames) (<SPACE>)* [<SEMI_COLON> (<SPACE>)* qe = Query(bucketNames)] (<SPACE>)* <CLOSE_BRACES>
- {
- if (qe == null) {
- return new StdQueryExpression(new HashSet<String>(bucketNames));
- }else {
- return qe;
- }
- }
-}
-
-QueryExpression ComparisonQueryExpression(Vector<String> bucketNames) :
-{
- Token termName = null;
- Token operator = null;
- Vector<String> values = new Vector<String>();
-}
-{
- termName = <TERM> (<SPACE>)* ( operator = <EQ> | operator = <GT> | operator = <GE> | operator = <LT> | operator = <LE> ) (<SPACE>)* getValues(values)
- {
- Term term = new Term(termName.image);
- term.setValues(values); //Arrays.asList(termValues.image.split(",")));
- ComparisonQueryExpression comparisonQueryExpression = new ComparisonQueryExpression();
- if (bucketNames != null)
- comparisonQueryExpression.setBucketNames(new HashSet<String>(bucketNames));
- comparisonQueryExpression.setTerm(term);
- comparisonQueryExpression.setOperator(ComparisonQueryExpression.Operator.getOperatorBySign(operator.image));
- return comparisonQueryExpression;
- }
-}
-
-QueryExpression PriorityQueryExpression(Vector<String> bucketNames) :
-{
- QueryExpression qe = null;
-}
-{
- <OPEN_PARENS> qe = Query(bucketNames) <CLOSE_PARENS>
- { return qe; }
-}
-
-QueryExpression CustomQueryExpression(Vector<String> bucketNames) :
-{
- Token customNameToken = null;
- Properties p = new Properties();
-}
-{
- <OPEN_BRACES> (<SPACE>)* <CUSTOM_NAME_KEY> (<SPACE>)* <EQUALS> (<SPACE>)* <QUOTE> customNameToken = <TERM> <QUOTE> [ LOOKAHEAD ((<SPACE>)* <SEMI_COLON>) (<SPACE>)* <SEMI_COLON> getProperties(p) ] (<SPACE>)* <CLOSE_BRACES>
- {
- CustomQueryExpression cqe = new CustomQueryExpression(customNameToken.image, p);
- if (bucketNames != null)
- cqe.setBucketNames(new HashSet<String>(bucketNames));
- return cqe;
- }
-}
-
-void getValues(Vector<String> values) :
-{
- Token value = null;
-}
-{
- value = <VALUE> ( LOOKAHEAD (<COMMA>) <COMMA> getValues(values) ) *
- {
- values.add(0, value.image.replaceAll("'", ""));
- }
-}
-
-void getProperties(Properties p) :
-{
- Token propertyKey = null;
- Token propertyVal = null;
-}
-{
- propertyKey = <P_KEY> (<SPACE>)* <EQUALS> (<SPACE>)* propertyVal = <VALUE> ( LOOKAHEAD (<COMMA>) <COMMA> getProperties(p) ) *
- {
- p.put(propertyKey.image.substring(2), propertyVal.image.replaceAll("'", ""));
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParserConstants.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParserConstants.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParserConstants.java
deleted file mode 100644
index ac3ded6..0000000
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParserConstants.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Generated By:JJTree&JavaCC: Do not edit this line. QueryParserConstants.java */
-package org.apache.oodt.cas.catalog.query.parser;
-
-public interface QueryParserConstants {
-
- int EOF = 0;
- int SPACE = 4;
- int AND = 5;
- int OR = 6;
- int QUOTE = 7;
- int EQUALS = 8;
- int SEMI_COLON = 9;
- int COMMA = 10;
- int OPEN_BRACES = 11;
- int CLOSE_BRACES = 12;
- int OPEN_PARENS = 13;
- int CLOSE_PARENS = 14;
- int BUCKET_NAME_KEY = 15;
- int CUSTOM_NAME_KEY = 16;
- int P_KEY = 17;
- int EQ = 18;
- int GE = 19;
- int GT = 20;
- int LE = 21;
- int LT = 22;
- int TERM = 23;
- int VALUE = 24;
- int NON_TERM = 25;
- int STRING_LITERAL = 26;
- int SPECIAL_CHARS = 27;
-
- int DEFAULT = 0;
-
- String[] tokenImage = {
- "<EOF>",
- "\"\\r\"",
- "\"\\n\"",
- "\"\\r\\n\"",
- "\" \"",
- "\" AND \"",
- "\" OR \"",
- "\"\\\'\"",
- "\"=\"",
- "\";\"",
- "\",\"",
- "\"{\"",
- "\"}\"",
- "\"(\"",
- "\")\"",
- "\"bucketNames\"",
- "\"name\"",
- "<P_KEY>",
- "\"==\"",
- "\">=\"",
- "\">\"",
- "\"<=\"",
- "\"<\"",
- "<TERM>",
- "<VALUE>",
- "<NON_TERM>",
- "<STRING_LITERAL>",
- "<SPECIAL_CHARS>",
- };
-
-}
[02/53] [partial] oodt git commit: Record change for OODT-836,
OODT-837.
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/test/resources/test-required-tables-ps.xml
----------------------------------------------------------------------
diff --git a/xmlps/src/test/resources/test-required-tables-ps.xml b/xmlps/src/test/resources/test-required-tables-ps.xml
deleted file mode 100644
index 53d706b..0000000
--- a/xmlps/src/test/resources/test-required-tables-ps.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-<!-- Example XML mapping configuration file -->
-<oodt:xmlps xmlns:oodt="http://incubator.apache.org/oodt/0.1-incubating"
- name="Example Query Handler" id="project:subproject:exampleps">
- <tables default="defaultTable">
- <table name="joinToDefault" join="id" tofld="id" />
- <table name="joinToExtraDefault" join="id" to="extraDefault" tofld="id" />
- <table name="joinToExtraJoin" join="id" to="joinToExtraDefault" tofld="id"/>
- <table name="joinToExtraOther" join="id" to="extraOther" tofld="id"/>
- <table name="extraDefault" join="id" tofld="id"/>
- <table name="extraOther" join="id" to="other" tofld="id"/>
- <table name="other" join="id" tofld="id" />
- <table name="another" join="id" tofld="id" />
- </tables>
- <!--
- field:
-
- type (required): dynamic or constant. If you choose dynamic, then the field
- value is read from the row in the ResultSet returned
- from the database. If constant, then each returned row
- from the ResultSet is annotated with the value specified
- in the 'value' attribute.
-
- name (required): the name of the attribute that you want returned
- in the product server.
-
- string (optional): whether or not the internal db representation at the local
- site for this field is a STRING, or something else (e.g., a number, etc.). Possible
- values for this attribute are "true", to indicate that the field is a string, or
- "false", to indicate that it is something else. If this attribute is omitted, a value
- of "false" is assumed, and the attribute will not be quoted in the where clause of
- the underlying SQL statement generated.
-
- dbname (optional): the name of the field within the underlying db. If not
- specified, then assumed to be name
-
- table (optional): if provided, then the attribute a is selected as
- 'table'.'a',and then returned. If omitted, the attribute
- is assumed to come from the default table returned from the
- PS query.
-
- value (optional): is necessary to provide if type='constant' is selected.
-
- scope (optional): limits the scope of a field's existence: acceptable values
- are "query", which signifies that the field is only applicable when
- translating queries: and "return", which signifies the field is only
- applicable as a return field when converting database results into CDEResults.
-
- -->
- <field type="dynamic" name="id" dbname="id" table="defaultTable"/>
- <field type="dynamic" name="id_1" dbname="id" table="joinToDefault"/>
- <field type="dynamic" name="id_2" dbname="id" table="joinToExtraDefault"/>
- <field type="dynamic" name="id_3" dbname="id" table="joinToExtraJoin"/>
- <field type="dynamic" name="id_4" dbname="id" table="joinToExtraOther"/>
-</oodt:xmlps>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlps/src/test/resources/test-same-col-name-ps.xml
----------------------------------------------------------------------
diff --git a/xmlps/src/test/resources/test-same-col-name-ps.xml b/xmlps/src/test/resources/test-same-col-name-ps.xml
deleted file mode 100644
index 87d2dcb..0000000
--- a/xmlps/src/test/resources/test-same-col-name-ps.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-<!-- Example XML mapping configuration file -->
-<oodt:xmlps xmlns:oodt="http://incubator.apache.org/oodt/0.1-incubating"
- name="Example Query Handler" id="project:subproject:exampleps">
- <tables default="defaultTable">
- <table name="joinTable" join="id" tofld="id" />
- </tables>
- <!--
- field:
-
- type (required): dynamic or constant. If you choose dynamic, then the field
- value is read from the row in the ResultSet returned
- from the database. If constant, then each returned row
- from the ResultSet is annotated with the value specified
- in the 'value' attribute.
-
- name (required): the name of the attribute that you want returned
- in the product server.
-
- string (optional): whether or not the internal db representation at the local
- site for this field is a STRING, or something else (e.g., a number, etc.). Possible
- values for this attribute are "true", to indicate that the field is a string, or
- "false", to indicate that it is something else. If this attribute is omitted, a value
- of "false" is assumed, and the attribute will not be quoted in the where clause of
- the underlying SQL statement generated.
-
- dbname (optional): the name of the field within the underlying db. If not
- specified, then assumed to be name
-
- table (optional): if provided, then the attribute a is selected as
- 'table'.'a',and then returned. If omitted, the attribute
- is assumed to come from the default table returned from the
- PS query.
-
- value (optional): is necessary to provide if type='constant' is selected.
-
- scope (optional): limits the scope of a field's existence: acceptable values
- are "query", which signifies that the field is only applicable when
- translating queries: and "return", which signifies the field is only
- applicable as a return field when converting database results into CDEResults.
-
- -->
- <field type="dynamic" name="id_xmlps" dbname="id" table="defaultTable"/>
- <field type="dynamic" name="field_only"/>
- <field type="dynamic" name="field_with_table" dbname="field_db" table="anotherTable"/>
- <field type="dynamic" name="field_use_default" dbname="field_db"/>
-</oodt:xmlps>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlquery/.gitignore
----------------------------------------------------------------------
diff --git a/xmlquery/.gitignore b/xmlquery/.gitignore
deleted file mode 100644
index b54523f..0000000
--- a/xmlquery/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/maven-eclipse.xml
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlquery/pom.xml
----------------------------------------------------------------------
diff --git a/xmlquery/pom.xml b/xmlquery/pom.xml
deleted file mode 100644
index f227b81..0000000
--- a/xmlquery/pom.xml
+++ /dev/null
@@ -1,128 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.oodt</groupId>
- <artifactId>oodt-core</artifactId>
- <version>1.1-SNAPSHOT</version>
- <relativePath>../core/pom.xml</relativePath>
- </parent>
- <artifactId>oodt-xmlquery</artifactId>
- <packaging>jar</packaging>
- <name>Query Expression</name>
- <description>This component provides a way to express queries in a generic
- manner. Its centerpiece is a class called XMLQuery that uses
- boolean postfix expressions to capture the domain, range, and
- constraint of a query, regardless of the source of the query (SQL,
- keyword query, etc.). It can also encapsulate the results of a
- query. It's used by many other components as the standard way to
- pass a query and its results between servers, clients, nodes, and
- other components.</description>
- <!-- All dependencies should be listed in core/pom.xml and be ordered alphabetically by package and artifact.
- Once the dependency is in the core pom, it can then be used in other modules without the version tags.
- For example, within core/pom.xml:
-
- <dependency>
- <groupId>com.amazonaws</groupId>
- <artifactId>aws-java-sdk</artifactId>
- <version>1.7.4</version>
- </dependency>
-
- Elsewhere in the platform:
- <dependency>
- <groupId>com.amazonaws</groupId>
- <artifactId>aws-java-sdk</artifactId>
- </dependency>
-
- Where possible the same dependency version should be used across the whole platform but if required the version
- can be overridden in a specific pom and should have a comment explaing why the version has been overridden
- -->
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.2</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.oodt</groupId>
- <artifactId>oodt-commons</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- </dependencies>
- <build>
- <resources>
- <resource>
- <targetPath>org/apache/oodt/xmlquery</targetPath>
- <directory>${basedir}/src/main/conf</directory>
- <includes>
- <include>mime.properties</include>
- </includes>
- </resource>
- <resource>
- <directory>${basedir}/src/main/dtd</directory>
- </resource>
- </resources>
- <plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <excludes>
- <exclude>org/apache/oodt/xmlquery/CodecTest.java</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <scm>
- <!--<connection>scm:svn:https://svn.apache.org/repos/asf/oodt/trunk/xmlquery</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/oodt/trunk/xmlquery</developerConnection>
- <url>http://svn.apache.org/viewvc/oodt/trunk/xmlquery</url>-->
- <tag>0.13-SNAPSHOT</tag>
- </scm>
- <profiles>
- <profile>
- <id>audit</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>rat-maven-plugin</artifactId>
- <configuration>
- <excludes>
- <exclude>**/oodt/xmlquery/package.html</exclude>
- </excludes>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>check</goal>
- </goals>
- <phase>verify</phase>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-</project>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlquery/src/main/conf/mime.properties
----------------------------------------------------------------------
diff --git a/xmlquery/src/main/conf/mime.properties b/xmlquery/src/main/conf/mime.properties
deleted file mode 100755
index af95ada..0000000
--- a/xmlquery/src/main/conf/mime.properties
+++ /dev/null
@@ -1,407 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-# Internet media types supported by OODT
-#
-# $Id: mime.properties,v 1.1.1.1 2004-03-02 19:37:13 kelly Exp $
-
-# These types aren't in the official list at IANA, but are listed
-# here for internal OODT use:
-
-application/vnd.jpl.large-product: org.apache.oodt.xmlquery.StringCodec
-
-# These types aren't in the official list at IANA, but are supported
-# in various environments:
-
-application/x-java-serialized-object org.apache.oodt.xmlquery.ObjectCodec
-application/java-vm org.apache.oodt.xmlquery.ObjectCodec
-
-# This types are translated from the Internet media type registry at
-# ftp://ftp.iana.org/in-notes/iana/assignments/media-types/media-types
-
-text/plain: org.apache.oodt.xmlquery.StringCodec
-text/richtext: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-text/enriched: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-text/tab-separated-values: org.apache.oodt.xmlquery.StringCodec
-text/html: org.apache.oodt.xmlquery.CompressedStringCodec
-text/sgml: org.apache.oodt.xmlquery.CompressedStringCodec
-text/vnd.latex-z: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-text/vnd.fmi.flexstor: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-text/uri-list: org.apache.oodt.xmlquery.StringCodec
-text/vnd.abc: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-text/rfc822-headers: org.apache.oodt.xmlquery.StringCodec
-text/vnd.in3d.3dml: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-text/prs.lines.tag: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-text/vnd.in3d.spot: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-text/css: org.apache.oodt.xmlquery.CompressedStringCodec
-text/xml: org.apache.oodt.xmlquery.StringCodec
-text/rtf: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-text/directory: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-text/calendar: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-text/vnd.wap.wml: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-text/vnd.wap.wmlscript: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-text/vnd.motorola.reflex: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-text/vnd.fly: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-text/vnd.wap.sl: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-text/vnd.wap.si: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-text/t140: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-text/vnd.ms-mediapackage: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-text/vnd.IPTC.NewsML: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-text/vnd.IPTC.NITF: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-text/vnd.curl: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-text/vnd.DMClientScript: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-text/parityfec: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-multipart/mixed: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-multipart/alternative: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-multipart/digest: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-multipart/parallel: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-multipart/appledouble: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-multipart/header-set: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-multipart/form-data: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-multipart/related: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-multipart/report: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-multipart/voice-message: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-multipart/signed: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-multipart/encrypted: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-multipart/byteranges: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-message/rfc822: org.apache.oodt.xmlquery.CompressedStringCodec
-message/partial: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-message/external-body: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-message/news: org.apache.oodt.xmlquery.CompressedStringCodec
-message/http: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-message/delivery-status: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-message/disposition-notification: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-message/s-http: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/octet-stream: org.apache.oodt.xmlquery.ByteArrayCodec
-application/postscript: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/oda: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/atomicmail: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/andrew-inset: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/slate: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/wita: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/dec-dx: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/dca-rft: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/activemessage: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/rtf: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/applefile: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/mac-binhex40: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/news-message-id: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/news-transmission: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/wordperfect5.1: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/pdf: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/zip: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/macwriteii: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/msword: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/remote-printing: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/mathematica: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/cybercash: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/commonground: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/iges: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/riscos: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/eshop: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/x400-bp: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/sgml: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/cals-1840: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/pgp-encrypted: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/pgp-signature: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/pgp-keys: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.framemaker: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.mif: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.ms-excel: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.ms-powerpoint: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.ms-project: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.ms-works: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.ms-tnef: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.svd: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.music-niff: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.ms-artgalry: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.truedoc: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.koan: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.street-stream: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.fdf: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/set-payment-initiation: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/set-payment: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/set-registration-initiation: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/set-registration: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.seemail: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.businessobjects: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.meridian-slingshot: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.xara: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/sgml-open-catalog: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.rapid: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.enliven: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.japannet-registration-wakeup: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.japannet-verification-wakeup: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.japannet-payment-wakeup: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.japannet-directory-service: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.intertrust.digibox: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.intertrust.nncp: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/prs.alvestrand.titrax-sheet: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.noblenet-web: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.noblenet-sealer: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.noblenet-directory: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/prs.nprend: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.webturbo: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/hyperstudio: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.shana.informed.formtemplate: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.shana.informed.formdata: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.shana.informed.package: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.shana.informed.interchange: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.$commerce_battelle: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.osa.netdeploy: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.ibm.MiniPay: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.japannet-jpnstore-wakeup: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.japannet-setstore-wakeup: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.japannet-verification: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.japannet-registration: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.hp-HPGL: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.hp-PCL: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.hp-PCLXL: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.musician: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.FloGraphIt: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.intercon.formnet: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vemmi: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.ms-asf: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.ecdis-update: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.powerbuilder6: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.powerbuilder6-s: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.lotus-wordpro: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.lotus-approach: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.lotus-1-2-3: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.lotus-organizer: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.lotus-screencam: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.lotus-freelance: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.fujitsu.oasys: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.fujitsu.oasys2: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.swiftview-ics: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.dna: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/prs.cww: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.wt.stf: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.dxr: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.mitsubishi.misty-guard.trustweb: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.ibm.modcap: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.acucobol: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.fujitsu.oasys3: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/marc: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.fujitsu.oasysprs: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.fujitsu.oasysgp: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.visio: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.netfpx: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.audiograph: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.epson.salt: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.3M.Post-it-Notes: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.novadigm.EDX: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.novadigm.EXT: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.novadigm.EDM: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.claymore: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.comsocaller: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/pkcs7-mime: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/pkcs7-signature: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/pkcs10: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.yellowriver-custom-menu: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.ecowin.chart: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.ecowin.series: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.ecowin.filerequest: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.ecowin.fileupdate: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.ecowin.seriesrequest: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.ecowin.seriesupdate: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/EDIFACT: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/EDI-X12: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/EDI-Consent: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.wrq-hp3000-labelled: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.minisoft-hp3000-save: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.ffsns: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.hp-hps: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.fujixerox.docuworks: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/xml: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.anser-web-funds-transfer-initiation: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.anser-web-certificate-issue-initiation: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.is-xpr: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.intu.qbo: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.publishare-delta-tree: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.cybank: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/batch-SMTP: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.uplanet.alert: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.uplanet.cacheop: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.uplanet.list: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.uplanet.listcmd: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.uplanet.channel: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.uplanet.bearer-choice: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.uplanet.signal: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.uplanet.alert-wbxml: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.uplanet.cacheop-wbmxl: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.uplanet.list-wbxml: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.uplanet.listcmd-wbxml: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.uplanet.channel-wbxml: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.uplanet.bearer-choice-wbxml: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.epson.quickanime: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.commonspace: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.fut-misnet: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.xfdl: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.intu.qfx: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.epson.ssf: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.epson.msf: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.powerbuilder7: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.powerbuilder7-s: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.lotus-notes: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/pkixcmp: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.wap.wmlc: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.wap.wmlscriptc: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.motorola.flexsuite: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.wap.wbxml: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.motorola.flexsuite.wem: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.motorola.flexsuite.kmr: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.motorola.flexsuite.adsi: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.motorola.flexsuite.fis: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.motorola.flexsuite.gotap: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.motorola.flexsuite.ttc: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.ufdl: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.accpac.simply.imp: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.accpac.simply.aso: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.vcx: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/ipp: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/ocsp-request: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/ocsp-response: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.previewsystems.box: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.mediastation.cdkey: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.pg.format: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.pg.osasli: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.hp-hpid: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/pkix-cert: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/pkix-crl: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.Mobius.TXF: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.Mobius.PLC: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.Mobius.DIS: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.Mobius.DAF: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.Mobius.MSL: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.cups-raster: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.cups-postscript: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.cups-raw: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/index: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/index.cmd: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/index.response: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/index.obj: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/index.vnd: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.triscape.mxs: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.powerbuilder75: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.powerbuilder75-s: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.dpgraph: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/http: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/sdp: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.eudora.data: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.fujixerox.docuworks.binder: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.vectorworks: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.grafeq: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.bmi: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.ericsson.quickcall: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.hzn-3d-crossword: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.wap.slc: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.wap.sic: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.groove-injector: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.fujixerox.ddd: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.groove-account: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.groove-identity-message: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.groove-tool-message: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.groove-tool-template: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.groove-vcard: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.ctc-posml: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.canon-lips: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.canon-cpdl: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.trueapp: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.s3sms: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/iotp: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.mcd: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.httphone: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.informix-visionary: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.msign: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.ms-lrm: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.contact.cmsg: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.epson.esf: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/whoispp-query: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/whoispp-response: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.mozilla.xul+xml: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/parityfec: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.palm: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.fsc.weblaunch: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/vnd.tve-trigger: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/dvcs: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-application/sieve: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-image/jpeg: org.apache.oodt.xmlquery.ByteArrayCodec
-image/gif: org.apache.oodt.xmlquery.ByteArrayCodec
-image/ief: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-image/g3fax: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-image/tiff: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-image/cgm: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-image/naplps: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-image/vnd.dwg: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-image/vnd.svf: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-image/vnd.dxf: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-image/png: org.apache.oodt.xmlquery.ByteArrayCodec
-image/vnd.fpx: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-image/vnd.net-fpx: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-image/vnd.xiff: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-image/prs.btif: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-image/vnd.fastbidsheet: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-image/vnd.wap.wbmp: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-image/prs.pti: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-image/vnd.cns.inf2: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-image/vnd.mix: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-image/vnd.fujixerox.edmics-rlc: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-image/vnd.fujixerox.edmics-mmr: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-image/vnd.fst: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-audio/basic: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-audio/32kadpcm: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-audio/vnd.qcelp: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-audio/vnd.digital-winds: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-audio/vnd.lucent.voice: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-audio/vnd.octel.sbc: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-audio/vnd.rhetorex.32kadpcm: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-audio/vnd.vmx.cvsd: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-audio/vnd.nortel.vbk: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-audio/vnd.cns.anp1: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-audio/vnd.cns.inf1: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-audio/L16: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-audio/vnd.everad.plj: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-audio/telephone-event: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-audio/tone: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-audio/prs.sid: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-audio/vnd.nuera.ecelp4800: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-audio/vnd.nuera.ecelp7470: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-audio/mpeg: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-audio/parityfec: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-audio/MP4A-LATM: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-video/mpeg: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-video/quicktime: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-video/vnd.vivo: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-video/vnd.motorola.video: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-video/vnd.motorola.videop: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-video/vnd.fvt: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-video/pointer: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-video/parityfec: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-video/vnd.mpegurl: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-video/MP4V-ES: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-model/iges: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-model/vrml: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-model/mesh: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-model/vnd.dwf: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-model/vnd.gtw: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-model/vnd.flatland.3dml: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-model/vnd.vtu: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-model/vnd.mts: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-model/vnd.gdl: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-model/vnd.gs-gdl: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-model/vnd.parasolid.transmit.text: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
-model/vnd.parasolid.transmit.binary: org.apache.oodt.xmlquery.UnsupportedMimeTypeCodec
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlquery/src/main/dtd/query.dtd
----------------------------------------------------------------------
diff --git a/xmlquery/src/main/dtd/query.dtd b/xmlquery/src/main/dtd/query.dtd
deleted file mode 100755
index 0cf3401..0000000
--- a/xmlquery/src/main/dtd/query.dtd
+++ /dev/null
@@ -1,100 +0,0 @@
-<?xml encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
- <!ELEMENT query
- (queryAttributes,
- queryResultModeId,
- queryPropogationType,
- queryPropogationLevels,
- queryMimeAccept*,
- queryMaxResults,
- queryResults,
- queryKWQString,
- queryStatistics?,
- querySelectSet,
- queryFromSet,
- queryWhereSet,
- queryResultSet)>
-
- <!ELEMENT queryAttributes
- (queryId, queryTitle*, queryDesc*, queryType*,
- queryStatusId*, querySecurityType*,
- queryParentId*, queryChildId*,
- queryRevisionNote*,
- queryDataDictId*)>
-
- <!ELEMENT queryStatistics (statistic*)>
-
- <!ELEMENT querySelectSet
- (queryElement*)>
-
- <!ELEMENT queryFromSet
- (queryElement*)>
-
- <!ELEMENT queryWhereSet
- (queryElement*)>
-
- <!ELEMENT queryElement
- (tokenRole*, tokenValue*)>
-
- <!ELEMENT statistic (url, time)>
-
- <!ELEMENT queryResultSet
- (resultElement*)>
-
- <!ELEMENT resultElement
- (resultId*, resultMimeType*,
- profId*, identifier*, resultHeader,
- resultValue*)>
- <!ATTLIST resultElement classified (true|false) 'false'>
- <!ATTLIST resultElement validity CDATA #IMPLIED>
-
- <!ELEMENT resultHeader (headerElement*)>
- <!ELEMENT headerElement (elemName, elemType?, elemUnit?)>
-
- <!ELEMENT queryId (#PCDATA)>
- <!ELEMENT queryTitle (#PCDATA)>
- <!ELEMENT queryType (#PCDATA)>
- <!ELEMENT queryDesc (#PCDATA)>
- <!ELEMENT queryParentId (#PCDATA)>
- <!ELEMENT queryChildId (#PCDATA)>
- <!ELEMENT queryStatusId (#PCDATA)>
- <!ELEMENT querySecurityType (#PCDATA)>
- <!ELEMENT queryRevisionNote (#PCDATA)>
- <!ELEMENT queryDataDictId (#PCDATA)>
- <!ELEMENT queryResultModeId (#PCDATA)>
- <!ELEMENT queryPropogationType (#PCDATA)>
- <!ELEMENT queryPropogationLevels (#PCDATA)>
- <!ELEMENT queryMimeAccept (#PCDATA)>
- <!ELEMENT queryMaxResults (#PCDATA)>
- <!ELEMENT queryResults (#PCDATA)>
- <!ELEMENT queryKWQString (#PCDATA)>
- <!ELEMENT url (#PCDATA)>
- <!ELEMENT time (#PCDATA)>
- <!ELEMENT elemName (#PCDATA)>
- <!ELEMENT elemType (#PCDATA)>
- <!ELEMENT elemUnit (#PCDATA)>
- <!ELEMENT elemValue (#PCDATA)>
- <!ELEMENT resultId (#PCDATA)>
- <!ELEMENT resultMimeType (#PCDATA)>
- <!ELEMENT resultValue (#PCDATA)>
- <!ATTLIST resultValue xml:space (default|preserve) 'default'>
- <!ELEMENT profId (#PCDATA)>
- <!ELEMENT identifier (#PCDATA)>
- <!ELEMENT tokenRole (#PCDATA)>
- <!ELEMENT tokenValue (#PCDATA)>
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlquery/src/main/java/org/apache/oodt/product/HttpRedirectException.java
----------------------------------------------------------------------
diff --git a/xmlquery/src/main/java/org/apache/oodt/product/HttpRedirectException.java b/xmlquery/src/main/java/org/apache/oodt/product/HttpRedirectException.java
deleted file mode 100644
index ce9711a..0000000
--- a/xmlquery/src/main/java/org/apache/oodt/product/HttpRedirectException.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.oodt.product;
-
-import org.apache.oodt.product.ProductException;
-
-/**
- * A class
- *
- * @author mcayanan
- *
- */
-public class HttpRedirectException extends ProductException {
- private static final long serialVersionUID = 4680689951141346403L;
- private String location;
-
- public HttpRedirectException(String location) {
- super();
- this.location = location;
- }
-
- public String getLocation() {
- return location;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlquery/src/main/java/org/apache/oodt/product/ProductException.java
----------------------------------------------------------------------
diff --git a/xmlquery/src/main/java/org/apache/oodt/product/ProductException.java b/xmlquery/src/main/java/org/apache/oodt/product/ProductException.java
deleted file mode 100755
index 83686a3..0000000
--- a/xmlquery/src/main/java/org/apache/oodt/product/ProductException.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.product;
-
-/**
- * Checked exception to indicate a product fault.
- *
- * @author Kelly
- */
-public class ProductException extends Exception {
- /**
- * Construct a product exception with no detail message.
- */
- public ProductException() {}
-
- /**
- * Construct a product exception with the given detail message.
- *
- * @param msg Detail message.
- */
- public ProductException(String msg) {
- super(msg);
- }
-
- /**
- * Creates a new <code>ProductException</code> instance.
- *
- * @param cause a <code>Throwable</code> value.
- */
- public ProductException(Throwable cause) {
- super(cause);
- }
-
- /**
- * Creates a new <code>ProductException</code> instance.
- *
- * @param msg a <code>String</code> value.
- * @param cause a <code>Throwable</code> value.
- */
- public ProductException(String msg, Throwable cause) {
- super(msg, cause);
- }
-
- /** Serial version unique ID. */
- static final long serialVersionUID = 8240102969482071451L;
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlquery/src/main/java/org/apache/oodt/product/Retriever.java
----------------------------------------------------------------------
diff --git a/xmlquery/src/main/java/org/apache/oodt/product/Retriever.java b/xmlquery/src/main/java/org/apache/oodt/product/Retriever.java
deleted file mode 100755
index a7b4ea2..0000000
--- a/xmlquery/src/main/java/org/apache/oodt/product/Retriever.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.product;
-
-/**
- * Retrievers retrieve products.
- *
- * @author Kelly
- * @version $Revision: 1.1.1.1 $
- */
-public interface Retriever {
- /**
- * Retrieve a chunk from a large product.
- *
- * @param productID Product ID.
- * @param offset Where in the product to retrieve the data.
- * @param length How much data to get.
- * @return The data.
- * @throws ProductException if an error occurs.
- */
- byte[] retrieveChunk(String productID, long offset, int length) throws ProductException;
-
- /**
- * Close off a large product.
- *
- * @param productID Product ID.
- * @throws ProductException if an error occurs.
- */
- void close(String productID);
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlquery/src/main/java/org/apache/oodt/xmlquery/ByteArrayCodec.java
----------------------------------------------------------------------
diff --git a/xmlquery/src/main/java/org/apache/oodt/xmlquery/ByteArrayCodec.java b/xmlquery/src/main/java/org/apache/oodt/xmlquery/ByteArrayCodec.java
deleted file mode 100755
index 356b468..0000000
--- a/xmlquery/src/main/java/org/apache/oodt/xmlquery/ByteArrayCodec.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.xmlquery;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import org.apache.oodt.commons.util.Base64;
-import org.apache.oodt.commons.util.XML;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-/** A result encoder/decoder for byte arrays.
- *
- * This codec uses base-64 encoding for byte arrays.
- *
- * @author Kelly
- */
-class ByteArrayCodec implements Codec {
- public Node encode(Object object, Document doc) throws DOMException {
- Element value = doc.createElement("resultValue");
- value.appendChild(doc.createCDATASection(new String(Base64.encode((byte[]) object))));
- return value;
- }
-
- public Object decode(Node node) {
- String encodedValue;
- if (node.getFirstChild() != null && node.getFirstChild().getNodeType() == Node.CDATA_SECTION_NODE) {
- encodedValue = node.getFirstChild().getNodeValue();
- } else {
- encodedValue = XML.text(node);
- }
- if (encodedValue.length() <= 0) {
- return new byte[0];
- }
- return Base64.decode(encodedValue.getBytes());
- }
-
- public InputStream getInputStream(Object value) {
- return new ByteArrayInputStream((byte[]) value);
- }
-
- public long sizeOf(Object object) {
- return ((byte[]) object).length;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlquery/src/main/java/org/apache/oodt/xmlquery/Codec.java
----------------------------------------------------------------------
diff --git a/xmlquery/src/main/java/org/apache/oodt/xmlquery/Codec.java b/xmlquery/src/main/java/org/apache/oodt/xmlquery/Codec.java
deleted file mode 100755
index febcbba..0000000
--- a/xmlquery/src/main/java/org/apache/oodt/xmlquery/Codec.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.xmlquery;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InvalidClassException;
-import java.io.OptionalDataException;
-import java.io.StreamCorruptedException;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
-/** Result encoder/decoder.
- *
- * Classes that implement this interface encode and decode query results to and from XML
- * format.
- *
- * @author Kelly
- */
-interface Codec {
- /** Encode the given object into XML format.
- *
- * The encoding takes the object, encodes into a DOM structure, and returns a
- * <resultValue> element.
- *
- * @param object Object to encode.
- * @param doc What document will own the created XML nodes.
- * @return A <resultValue> element encoding the <var>object</var>.
- * @throws DOMException If an error occurs while encoding the object.
- */
- Node encode(Object object, Document doc) throws DOMException;
-
- /** Decode the given XML representation into its object.
- *
- * The decoding takes the <resultValue> node, and decodes it into the object
- * it represents.
- *
- * @param node The <resultValue> node.
- * @return The object that the <var>node</var> represents.
- * @throws ClassNotFoundException If the class of the object in <var>node</var> can't be found.
- * @throws InvalidClassException If something is wrong with the class encoded in <var>node</var>.
- * @throws StreamCorruptedException When control information in <var>node</var> is inconsistent.
- * @throws OptionalDataException If primitive datatypes instead of an object was found encoded in the <var>node</var>.
- */
- Object decode(Node node) throws ClassNotFoundException, InvalidClassException, StreamCorruptedException,
- OptionalDataException;
-
- /**
- * Compute the size of the given object.
- *
- * @param object Object.
- * @return Size of <var>object</var> in bytes.
- */
- long sizeOf(Object object);
-
- /**
- * Yield the given object as a stream.
- *
- * This method takes the given object and yields a stream version of it
- * appropriate concrete codec type. For example, {@link ByteArrayCodec}s may
- * yield simple {@link ByteArrayInputStream}s for their objects.
- *
- * @param object The object to be streamed.
- * @return An <code>InputStream</code> of <var>object</var>.
- * @throws IOException if an error occurs.
- */
- InputStream getInputStream(Object object) throws IOException;
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlquery/src/main/java/org/apache/oodt/xmlquery/CodecFactory.java
----------------------------------------------------------------------
diff --git a/xmlquery/src/main/java/org/apache/oodt/xmlquery/CodecFactory.java b/xmlquery/src/main/java/org/apache/oodt/xmlquery/CodecFactory.java
deleted file mode 100755
index 658617c..0000000
--- a/xmlquery/src/main/java/org/apache/oodt/xmlquery/CodecFactory.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.xmlquery;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-/** A factory for codecs.
- *
- * The codec factory creates and maintains codec objects.
- *
- * @author Kelly
- */
-class CodecFactory {
- /** Create a codec.
- *
- * If the codec with the given class name already exists, it's returned.
- * Otherwise, the factory creates a new instance of the codec and returns it. Any
- * to instantiate the codec results in a runtime exception.
- *
- * @param className Name of the codec class to create.
- * @return The codec object of the class with the given <var>className</var>.
- */
- public static Codec createCodec(String className) {
- Codec codec = (Codec) codecs.get(className);
- if (codec == null) {
- try {
- Class clazz = Class.forName(className);
- codec = (Codec) clazz.newInstance();
- codecs.put(className, codec);
- } catch (ClassNotFoundException ex) {
- throw new RuntimeException("Class \"" + className + "\" not found");
- } catch (InstantiationException ex) {
- throw new RuntimeException("Class \"" + className + "\" is abstract or is an interface");
- } catch (IllegalAccessException ex) {
- throw new RuntimeException("Class \"" + className + "\" doesn't have public no-args constructor");
- }
- }
- return codec;
- }
-
- /** Cachec codecs; the mapping is from {@link String} class name to {@link Codec} object. */
- private static Map codecs = new ConcurrentHashMap();
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlquery/src/main/java/org/apache/oodt/xmlquery/CompressedObjectCodec.java
----------------------------------------------------------------------
diff --git a/xmlquery/src/main/java/org/apache/oodt/xmlquery/CompressedObjectCodec.java b/xmlquery/src/main/java/org/apache/oodt/xmlquery/CompressedObjectCodec.java
deleted file mode 100755
index 2563890..0000000
--- a/xmlquery/src/main/java/org/apache/oodt/xmlquery/CompressedObjectCodec.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.xmlquery;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InvalidClassException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.OptionalDataException;
-import java.io.StreamCorruptedException;
-import java.util.zip.GZIPInputStream;
-import java.util.zip.GZIPOutputStream;
-import org.apache.oodt.commons.io.Base64DecodingInputStream;
-import org.apache.oodt.commons.io.Base64EncodingOutputStream;
-import org.apache.oodt.commons.io.NullOutputStream;
-import org.apache.oodt.commons.util.XML;
-import org.apache.oodt.commons.io.CountingOutputStream;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-/** A result encoder/decoder for compressed, serialized objects.
- *
- * This codec uses a GZIP compressed serialized object format for objects.
- *
- * @author Kelly
- */
-class CompressedObjectCodec implements Codec {
- public Node encode(Object object, Document doc) throws DOMException {
- ByteArrayOutputStream byteArray = new ByteArrayOutputStream();
- try {
- Base64EncodingOutputStream base64 = new Base64EncodingOutputStream(byteArray);
- GZIPOutputStream gzip = new GZIPOutputStream(base64);
- ObjectOutputStream objStream = new ObjectOutputStream(gzip);
- objStream.writeObject(object);
- objStream.close();
- } catch (IOException ignored) {}
- Element value = doc.createElement("resultValue");
- value.appendChild(doc.createCDATASection(byteArray.toString()));
- return value;
- }
-
- public Object decode(Node node) throws ClassNotFoundException, InvalidClassException, StreamCorruptedException,
- OptionalDataException {
- String encodedValue;
- if (node.getFirstChild().getNodeType() == Node.CDATA_SECTION_NODE) {
- encodedValue = node.getFirstChild().getNodeValue();
- } else {
- encodedValue = XML.text(node);
- }
- Object rc = null;
- try {
- ByteArrayInputStream byteArray = new ByteArrayInputStream(encodedValue.getBytes());
- Base64DecodingInputStream base64 = new Base64DecodingInputStream(byteArray);
- GZIPInputStream gzip = new GZIPInputStream(base64);
- ObjectInputStream objStream = new ObjectInputStream(gzip);
- rc = objStream.readObject();
- objStream.close();
- } catch (InvalidClassException ex) {
- throw ex;
- } catch (StreamCorruptedException ex) {
- throw ex;
- } catch (OptionalDataException ex) {
- throw ex;
- } catch (IOException ignored) {}
- return rc;
- }
-
- public InputStream getInputStream(Object value) throws IOException {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ObjectOutputStream oos = new ObjectOutputStream(baos);
- oos.writeObject(value);
- oos.close();
- baos.close();
- return new ByteArrayInputStream(baos.toByteArray());
- }
-
- public long sizeOf(Object obj) {
- try {
- CountingOutputStream c = new CountingOutputStream(new NullOutputStream());
- ObjectOutputStream stream = new ObjectOutputStream(c);
- stream.writeObject(obj);
- stream.close();
- return c.getBytesWritten();
- } catch (IOException ex) {
- throw new IllegalStateException("I/O exception " + ex.getClass().getName() + " can't happen, yet did: "
- + ex.getMessage());
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlquery/src/main/java/org/apache/oodt/xmlquery/CompressedStringCodec.java
----------------------------------------------------------------------
diff --git a/xmlquery/src/main/java/org/apache/oodt/xmlquery/CompressedStringCodec.java b/xmlquery/src/main/java/org/apache/oodt/xmlquery/CompressedStringCodec.java
deleted file mode 100755
index 9f7175e..0000000
--- a/xmlquery/src/main/java/org/apache/oodt/xmlquery/CompressedStringCodec.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.xmlquery;
-
-import org.apache.oodt.commons.io.Base64DecodingInputStream;
-import org.apache.oodt.commons.io.Base64EncodingOutputStream;
-import org.apache.oodt.commons.util.XML;
-
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.zip.GZIPInputStream;
-import java.util.zip.GZIPOutputStream;
-
-/** A result encoder/decoder for compressed strings.
- *
- * This codec uses a GZIP compressed string format for objects.
- *
- * @author Kelly
- */
-class CompressedStringCodec implements Codec {
-
- public static final int INT = 1024;
-
- public Node encode(Object object, Document doc) throws DOMException {
- ByteArrayOutputStream byteArray = new ByteArrayOutputStream();
- try {
- Base64EncodingOutputStream base64 = new Base64EncodingOutputStream(byteArray);
- GZIPOutputStream gzip = new GZIPOutputStream(base64);
- gzip.write(object.toString().getBytes());
- gzip.close();
- } catch (IOException ignored) {}
- Element value = doc.createElement("resultValue");
- value.appendChild(doc.createCDATASection(byteArray.toString()));
- return value;
- }
-
- public Object decode(Node node) {
- String encodedValue;
- if (node.getFirstChild().getNodeType() == Node.CDATA_SECTION_NODE) {
- encodedValue = node.getFirstChild().getNodeValue();
- } else {
- encodedValue = XML.text(node);
- }
- String rc = null;
- try {
- ByteArrayInputStream byteArray = new ByteArrayInputStream(encodedValue.getBytes());
- Base64DecodingInputStream base64 = new Base64DecodingInputStream(byteArray);
- GZIPInputStream gzip = new GZIPInputStream(base64);
- StringBuilder b = new StringBuilder();
- int numRead;
- byte[] buf = new byte[INT];
- while ((numRead = gzip.read(buf)) != -1) {
- b.append(new String(buf, 0, numRead));
- }
- gzip.close();
- rc = b.toString();
- } catch (IOException ignored) {}
- return rc;
- }
-
- public InputStream getInputStream(Object value) {
- return new ByteArrayInputStream(((String) value).getBytes());
- }
-
- public long sizeOf(Object obj) {
- return ((String) obj).getBytes().length;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlquery/src/main/java/org/apache/oodt/xmlquery/Header.java
----------------------------------------------------------------------
diff --git a/xmlquery/src/main/java/org/apache/oodt/xmlquery/Header.java b/xmlquery/src/main/java/org/apache/oodt/xmlquery/Header.java
deleted file mode 100755
index f148425..0000000
--- a/xmlquery/src/main/java/org/apache/oodt/xmlquery/Header.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.xmlquery;
-
-import org.apache.oodt.commons.util.Documentable;
-import org.apache.oodt.commons.util.XML;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-/** A single header.
- *
- * An object of this class is a header element of a query.
- *
- * @author Kelly
- */
-public class Header implements Serializable, Cloneable, Documentable {
- /** Create a list of headers from an XML document.
- *
- * @param root A <resultHeader> element.
- * @return A list of <code>Header</code>s.
- */
- public static List createHeaders(Node root) {
- if (!"resultHeader".equals(root.getNodeName())) {
- throw new IllegalArgumentException("Expected <resultHeader> but got <" + root.getNodeName() + ">");
- }
- NodeList children = root.getChildNodes();
- List rc = new ArrayList();
- for (int i = 0; i < children.getLength(); ++i){
- Node node = children.item(i);
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Header header = new Header(node);
- rc.add(header);
- }
- }
- return rc;
- }
-
- /** Create a new, blank header.
- *
- * This initializes the result with default values for various properties.
- */
- public Header() {
- this(/*name*/"UNKNOWN");
- }
-
- /** Create a header.
- *
- * Here, you specify the header's name only.
- *
- * @param name Name of this header.
- */
- public Header(String name) {
- this(name, /*type*/null, /*unit*/null);
- }
-
- /** Create a fully specified header.
- *
- * @param name Name of this header.
- * @param type Data type.
- * @param unit Units.
- */
- public Header(String name, String type, String unit) {
- this.name = name;
- this.type = type;
- this.unit = unit;
- }
-
- /** Create a header from a DOM node.
- *
- * @param node The DOM node, which must be a <headerElement> element.
- */
- public Header(Node node) {
- if (!"headerElement".equals(node.getNodeName())) {
- throw new IllegalArgumentException("Header must be constructed from <headerElement> node, not <"
- + node.getNodeName() + ">");
- }
- NodeList children = node.getChildNodes();
- for (int i = 0; i < children.getLength(); ++i) {
- Node child = children.item(i);
- if ("elemName".equals(child.getNodeName())) {
- name = XML.unwrappedText(child);
- } else if ("elemType".equals(child.getNodeName())) {
- type = XML.unwrappedText(child);
- } else if ("elemUnit".equals(child.getNodeName())) {
- unit = XML.unwrappedText(child);
- }
- }
- }
-
- /** Get the name.
- *
- * @return The name of the header, suitable for printing in a column heading.
- */
- public String getName() {
- return name;
- }
-
- /** Get the type of this result.
- *
- * @return The type, as in data type.
- */
- public String getType() {
- return type;
- }
-
- /** Get the unit.
- *
- * @return The units in which the header is presented.
- */
- public String getUnit() {
- return unit;
- }
-
- /** Set the name.
- *
- * @param name The name of the header, suitable for printing in a column heading.
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /** Set the type of this result.
- *
- * @param type The type, as in data type.
- */
- public void setType(String type) {
- this.type = type;
- }
-
- /** Set the unit.
- *
- * @param unit The units in which the header is presented.
- */
- public void setUnit(String unit) {
- this.unit = unit;
- }
-
- public Node toXML(Document doc) throws DOMException {
- Element root = doc.createElement("headerElement");
- XML.add(root, "elemName", getName());
- XML.addNonNull(root, "elemType", getType());
- XML.addNonNull(root, "elemUnit", getUnit());
- return root;
- }
-
- public int hashCode() {
- return name.hashCode();
- }
-
- public boolean equals(Object rhs) {
- if (rhs == this) {
- return true;
- }
- if (rhs == null || !(rhs instanceof Header)) {
- return false;
- }
- Header obj = (Header) rhs;
- return name.equals(obj.name) && ((type == null && obj.type == null) || type.equals(obj.type))
- && ((unit == null && obj.unit == null) || unit.equals(obj.unit));
- }
-
- public Object clone() {
- Object rc;
- try {
- rc = super.clone();
- } catch (CloneNotSupportedException cantHappen) {
- throw new RuntimeException("CloneNotSupportedException thrown for class that implements Cloneable: "
- + cantHappen.getMessage());
- }
- return rc;
- }
-
- public String toString() {
- return getClass().getName() + "[name=" + getName() + ",type=" + getType() + ",unit=" + getUnit() + "]";
- }
-
- /** Name of the header. */
- private String name;
-
- /** Type, as in type of the data. */
- private String type;
-
- /** Unit, as in the units of the data type. */
- private String unit;
-
- /** Serial version unique ID. */
- static final long serialVersionUID = -4596588383046581840L;
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlquery/src/main/java/org/apache/oodt/xmlquery/ObjectCodec.java
----------------------------------------------------------------------
diff --git a/xmlquery/src/main/java/org/apache/oodt/xmlquery/ObjectCodec.java b/xmlquery/src/main/java/org/apache/oodt/xmlquery/ObjectCodec.java
deleted file mode 100755
index 02723d8..0000000
--- a/xmlquery/src/main/java/org/apache/oodt/xmlquery/ObjectCodec.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.xmlquery;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InvalidClassException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.OptionalDataException;
-import java.io.StreamCorruptedException;
-import org.apache.oodt.commons.io.Base64DecodingInputStream;
-import org.apache.oodt.commons.io.Base64EncodingOutputStream;
-import org.apache.oodt.commons.io.NullOutputStream;
-import org.apache.oodt.commons.util.XML;
-import org.apache.oodt.commons.io.CountingOutputStream;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-/** A result encoder/decoder for serialized objects.
- *
- * This codec uses a serialized object format for objects.
- *
- * @author Kelly
- */
-class ObjectCodec implements Codec {
- public Node encode(Object object, Document doc) throws DOMException {
- ByteArrayOutputStream byteArray = new ByteArrayOutputStream();
- try {
- Base64EncodingOutputStream base64 = new Base64EncodingOutputStream(byteArray);
- ObjectOutputStream objStream = new ObjectOutputStream(base64);
- objStream.writeObject(object);
- objStream.close();
- } catch (IOException ignored) {}
- Element value = doc.createElement("resultValue");
- value.appendChild(doc.createCDATASection(byteArray.toString()));
- return value;
- }
-
- public Object decode(Node node) throws ClassNotFoundException, InvalidClassException, StreamCorruptedException,
- OptionalDataException {
- String encodedValue;
- if (node.getFirstChild().getNodeType() == Node.CDATA_SECTION_NODE) {
- encodedValue = node.getFirstChild().getNodeValue();
- } else {
- encodedValue = XML.text(node);
- }
- Object rc = null;
- try {
- ByteArrayInputStream byteArray = new ByteArrayInputStream(encodedValue.getBytes());
- Base64DecodingInputStream base64 = new Base64DecodingInputStream(byteArray);
- ObjectInputStream objStream = new ObjectInputStream(base64);
- rc = objStream.readObject();
- objStream.close();
- } catch (InvalidClassException ex) {
- throw ex;
- } catch (StreamCorruptedException ex) {
- throw ex;
- } catch (OptionalDataException ex) {
- throw ex;
- } catch (IOException ignored) {}
- return rc;
- }
-
- public InputStream getInputStream(Object value) throws IOException {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ObjectOutputStream oos = new ObjectOutputStream(baos);
- oos.writeObject(value);
- oos.close();
- baos.close();
- return new ByteArrayInputStream(baos.toByteArray());
- }
-
- public long sizeOf(Object obj) {
- try {
- CountingOutputStream c = new CountingOutputStream(new NullOutputStream());
- ObjectOutputStream stream = new ObjectOutputStream(c);
- stream.writeObject(obj);
- stream.close();
- return c.getBytesWritten();
- } catch (IOException ex) {
- throw new IllegalStateException("I/O exception " + ex.getClass().getName() + " can't happen, yet did: "
- + ex.getMessage());
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlquery/src/main/java/org/apache/oodt/xmlquery/QueryElement.java
----------------------------------------------------------------------
diff --git a/xmlquery/src/main/java/org/apache/oodt/xmlquery/QueryElement.java b/xmlquery/src/main/java/org/apache/oodt/xmlquery/QueryElement.java
deleted file mode 100755
index 7529f5f..0000000
--- a/xmlquery/src/main/java/org/apache/oodt/xmlquery/QueryElement.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.xmlquery;
-
-import java.io.*;
-
-import org.apache.oodt.commons.util.*;
-import org.w3c.dom.*;
-
-/** A single query element.
- *
- * An object of this class is an element of a query.
- *
- * <p>TODO: Consider computing proper mime-type based on class of object being inserted as
- * a value into the result.
- *
- * @author Kelly
- */
-public class QueryElement implements Serializable, Cloneable, Documentable {
- /** Create a blank query element.
- */
- public QueryElement() {
- this("UNKNOWN", "UNKNOWN");
- }
-
- /** Create a query element.
- *
- * @param role The role the element plays.
- * @param value The value of the element.
- */
- public QueryElement(String role, String value) {
- this.role = role;
- this.value = value;
- }
-
- public QueryElement(Node node) {
- if (!"queryElement".equals(node.getNodeName())) {
- throw new IllegalArgumentException("Query element must be constructed from <queryElement> node, not <"
- + node.getNodeName() + ">");
- }
- NodeList children = node.getChildNodes();
- for (int i = 0; i < children.getLength(); ++i) {
- Node child = children.item(i);
- if ("tokenRole".equals(child.getNodeName())) {
- role = XML.unwrappedText(child);
- } else if ("tokenValue".equals(child.getNodeName())) {
- value = XML.unwrappedText(child);
- }
- }
- }
-
- /** Get my role.
- *
- * @return The role this element plays.
- */
- public String getRole() {
- return role;
- }
-
- /** Get my value.
- *
- * @return The value of this element.
- */
- public String getValue() {
- return value;
- }
-
- /** Set my role.
- *
- * @param role The new role this element plays.
- */
- public void setRole(String role) {
- if (role == null) {
- role = "UNKNOWN";
- }
- this.role = role;
- }
-
- /** Set my value.
- *
- * @param value The new value of this element.
- */
- public void setValue(String value) {
- if (value == null) {
- value = "UNKNOWN";
- }
- this.value = value;
- }
-
- public Node toXML(Document doc) throws DOMException {
- Element root = doc.createElement("queryElement");
- XML.add(root, "tokenRole", getRole());
- XML.add(root, "tokenValue", getValue());
- return root;
- }
-
- public boolean equals(Object rhs) {
- if (rhs == this) {
- return true;
- }
- if (rhs == null || !(rhs instanceof QueryElement)) {
- return false;
- }
- QueryElement obj = (QueryElement) rhs;
- return role.equals(obj.role) && value.equals(obj.value);
- }
-
- public int hashCode() {
- return role.hashCode() ^ value.hashCode();
- }
-
- public Object clone() {
- Object rc = null;
- try {
- rc = super.clone();
- } catch (CloneNotSupportedException ignored) {}
- return rc;
- }
-
- public String toString() {
- return getClass().getName() + "[role=" + role + ",value=" + value + "]";
- }
-
- /** The role I play. */
- private String role;
-
- /** The value my role has. */
- private String value;
-
- /** Serial version unique ID. */
- static final long serialVersionUID = -8401434443475540800L;
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/098cc4fa/xmlquery/src/main/java/org/apache/oodt/xmlquery/QueryException.java
----------------------------------------------------------------------
diff --git a/xmlquery/src/main/java/org/apache/oodt/xmlquery/QueryException.java b/xmlquery/src/main/java/org/apache/oodt/xmlquery/QueryException.java
deleted file mode 100755
index 769e042..0000000
--- a/xmlquery/src/main/java/org/apache/oodt/xmlquery/QueryException.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.oodt.xmlquery;
-
-/** Checked exception to indicate a query fault.
- *
- * @author Kelly
- */
-public class QueryException extends Exception {
- /** Construct a query exception with no detail message.
- */
- public QueryException() {}
-
- /** Construct a query exception with the given detail message.
- *
- * @param msg Detail message.
- */
- public QueryException(String msg) {
- super(msg);
- }
-}