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); -}
