org.apache.juddi.datastore.jdbc
Class JDBCDataStore

java.lang.Object
  extended by org.apache.juddi.datastore.jdbc.JDBCDataStore
All Implemented Interfaces:
DataStore

public class JDBCDataStore
extends java.lang.Object
implements DataStore

Author:
Steve Viens (sviens@apache.org), Anil Saldhana (anil@apache.org)

Constructor Summary
JDBCDataStore()
          Create a new JDBCDataStore and aquire a JDBC connection from the connection pool.
 
Method Summary
 void beginTrans()
          begin a new transaction
 void commit()
          commit on all connections.
 void deleteAssertions(java.lang.String publisherID, java.util.Vector assertions)
          For each PublisherAssertion in the Vector of PublisherAssertions passed in perform the following steps: 1.
 void deleteBinding(java.lang.String bindingKey)
           
 void deleteBusiness(java.lang.String businessKey)
           
 void deletePublisher(java.lang.String publisherID)
           
 void deleteService(java.lang.String serviceKey)
           
 void deleteTModel(java.lang.String tModelKey)
           
 BindingTemplate fetchBinding(java.lang.String bindingKey)
           
 BusinessEntity fetchBusiness(java.lang.String businessKey)
           
 BusinessInfo fetchBusinessInfo(java.lang.String businessKey)
           
 PublisherInfo fetchPublisherInfo(java.lang.String publisherID)
           
 BusinessService fetchService(java.lang.String serviceKey)
           
 ServiceInfo fetchServiceInfo(java.lang.String serviceKey)
           
 TModel fetchTModel(java.lang.String tModelKey)
           
 TModelInfo fetchTModelInfo(java.lang.String tModelKey)
           
 java.util.Vector findBinding(java.lang.String serviceKey, CategoryBag categoryBag, TModelBag tModelBag, FindQualifiers findQualifiers)
           
 java.util.Vector findBusiness(java.util.Vector nameVector, DiscoveryURLs discoveryURLs, IdentifierBag identifierBag, CategoryBag categoryBag, TModelBag tModelBag, FindQualifiers findQualifiers)
           
 java.util.Vector findPublisher(java.lang.String name, FindQualifiers findQualifiers)
           
 java.util.Vector findRegisteredBusinesses(java.lang.String publisherID)
           
 java.util.Vector findRegisteredTModels(java.lang.String publisherID)
           
 java.util.Vector findRelatedBusinesses(java.lang.String businessKey, KeyedReference keyedRef, FindQualifiers findQualifiers)
          1.
 java.util.Vector findService(java.lang.String businessKey, java.util.Vector nameVector, CategoryBag categoryBag, TModelBag tModelBag, FindQualifiers findQualifiers)
           
 java.util.Vector findTModel(java.lang.String name, CategoryBag categoryBag, IdentifierBag identifierBag, FindQualifiers findQualifiers)
           
 java.lang.String generateToken(Publisher publisher)
           
 java.util.Vector getAssertions(java.lang.String publisherID)
          1.
 java.util.Vector getAssertionStatusItems(java.lang.String publisherID, java.lang.String completionStatus)
          1.
 Publisher getAuthTokenPublisher(java.lang.String token)
           
 java.sql.Connection getConnection()
           
 Publisher getPublisher(java.lang.String publisherID)
          verify that the individual or system identified by the 'publisherID' is a valid jUDDI user (aka publisher).
 boolean isAdministrator(java.lang.String publisherID)
          Will return true if the publisherID parameter specified has been tagged with registry administrator priviledges otherwise returns false.
 boolean isAuthTokenExpired(java.lang.String token)
           
 boolean isBindingPublisher(java.lang.String bindingKey, java.lang.String publisherID)
           
 boolean isBusinessPublisher(java.lang.String businessKey, java.lang.String publisherID)
           
 boolean isEnabled(java.lang.String publisherID)
          Will return true if the publisherID parameter specified is currently enabled otherwise returns false.
 boolean isServicePublisher(java.lang.String serviceKey, java.lang.String publisherID)
           
 boolean isTModelPublisher(java.lang.String tModelKey, java.lang.String publisherID)
           
 boolean isValidBindingKey(java.lang.String bindingKey)
           
 boolean isValidBusinessKey(java.lang.String businessKey)
           
 boolean isValidServiceKey(java.lang.String serviceKey)
           
 boolean isValidTModelKey(java.lang.String tModelKey)
           
 void markTModelAsDeleted(java.lang.String tModelKey)
           
 void release()
          Release all JDBC connections used by this JDBCDataStore back into the connection pool.
 void retireAuthToken(java.lang.String token)
           
 void rollback()
          rollback on all connections.
 void saveAssertions(java.lang.String publisherID, java.util.Vector assertions)
          For each PublisherAssertion in the Vector of PublisherAssertions passed in perform the following steps: 1.
 void saveBinding(BindingTemplate binding)
           
 void saveBusiness(BusinessEntity business, java.lang.String publisherID)
           
 void savePublisher(Publisher publisher)
           
 void saveService(BusinessService service)
           
 void saveTModel(TModel tModel, java.lang.String authorizedUserID)
           
 java.util.Vector setAssertions(java.lang.String publisherID, java.util.Vector newAssertions)
          1.
 void storeAuthToken(java.lang.String token, Publisher publisher)
           
 void touchAuthToken(java.lang.String token)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JDBCDataStore

public JDBCDataStore()
Create a new JDBCDataStore and aquire a JDBC connection from the connection pool.

Method Detail

release

public void release()
Release all JDBC connections used by this JDBCDataStore back into the connection pool.

Specified by:
release in interface DataStore

getConnection

public java.sql.Connection getConnection()

beginTrans

public void beginTrans()
                throws RegistryException
begin a new transaction

Specified by:
beginTrans in interface DataStore
Throws:
RegistryException

commit

public void commit()
            throws RegistryException
commit on all connections.

Specified by:
commit in interface DataStore
Throws:
RegistryException

rollback

public void rollback()
              throws RegistryException
rollback on all connections.

Specified by:
rollback in interface DataStore
Throws:
RegistryException

getPublisher

public Publisher getPublisher(java.lang.String publisherID)
                       throws RegistryException
verify that the individual or system identified by the 'publisherID' is a valid jUDDI user (aka publisher).

Specified by:
getPublisher in interface DataStore
Parameters:
publisherID -
Returns:
publisher
Throws:
RegistryException

isAdministrator

public boolean isAdministrator(java.lang.String publisherID)
                        throws RegistryException
Will return true if the publisherID parameter specified has been tagged with registry administrator priviledges otherwise returns false. An Unknown user exception is thrown if the publisherID specified is null, blank or does not exist (can't be found in the PUBLISHER table).

Specified by:
isAdministrator in interface DataStore
Parameters:
publisherID -
Returns:
Returns true if publisherID parameter specified has jUDDI administrator priv's otherwise returns false.
Throws:
RegistryException

isEnabled

public boolean isEnabled(java.lang.String publisherID)
                  throws RegistryException
Will return true if the publisherID parameter specified is currently enabled otherwise returns false. An UnknownUserException is thrown if the publisherID specified is null, blank or does not exist (can't be found in the PUBLISHER table).

Parameters:
publisherID -
Returns:
Returns true if publisherID parameter specified has jUDDI administrator priv's otherwise returns false.
Throws:
RegistryException

generateToken

public java.lang.String generateToken(Publisher publisher)
                               throws RegistryException
Specified by:
generateToken in interface DataStore
Parameters:
publisher -
Returns:
String
Throws:
RegistryException

storeAuthToken

public void storeAuthToken(java.lang.String token,
                           Publisher publisher)
                    throws RegistryException
Specified by:
storeAuthToken in interface DataStore
Throws:
RegistryException

retireAuthToken

public void retireAuthToken(java.lang.String token)
                     throws RegistryException
Specified by:
retireAuthToken in interface DataStore
Throws:
RegistryException

getAuthTokenPublisher

public Publisher getAuthTokenPublisher(java.lang.String token)
                                throws RegistryException
Specified by:
getAuthTokenPublisher in interface DataStore
Throws:
RegistryException

isAuthTokenExpired

public boolean isAuthTokenExpired(java.lang.String token)
                           throws RegistryException
Specified by:
isAuthTokenExpired in interface DataStore
Throws:
RegistryException

touchAuthToken

public void touchAuthToken(java.lang.String token)
                    throws RegistryException
Specified by:
touchAuthToken in interface DataStore
Throws:
RegistryException

saveBusiness

public void saveBusiness(BusinessEntity business,
                         java.lang.String publisherID)
                  throws RegistryException
Specified by:
saveBusiness in interface DataStore
Throws:
RegistryException

fetchBusiness

public BusinessEntity fetchBusiness(java.lang.String businessKey)
                             throws RegistryException
Specified by:
fetchBusiness in interface DataStore
Throws:
RegistryException

deleteBusiness

public void deleteBusiness(java.lang.String businessKey)
                    throws RegistryException
Specified by:
deleteBusiness in interface DataStore
Throws:
RegistryException

isBusinessPublisher

public boolean isBusinessPublisher(java.lang.String businessKey,
                                   java.lang.String publisherID)
                            throws RegistryException
Specified by:
isBusinessPublisher in interface DataStore
Throws:
RegistryException

isValidBusinessKey

public boolean isValidBusinessKey(java.lang.String businessKey)
                           throws RegistryException
Specified by:
isValidBusinessKey in interface DataStore
Throws:
RegistryException

saveService

public void saveService(BusinessService service)
                 throws RegistryException
Specified by:
saveService in interface DataStore
Throws:
RegistryException

fetchService

public BusinessService fetchService(java.lang.String serviceKey)
                             throws RegistryException
Specified by:
fetchService in interface DataStore
Throws:
RegistryException

deleteService

public void deleteService(java.lang.String serviceKey)
                   throws RegistryException
Specified by:
deleteService in interface DataStore
Throws:
RegistryException

isValidServiceKey

public boolean isValidServiceKey(java.lang.String serviceKey)
                          throws RegistryException
Specified by:
isValidServiceKey in interface DataStore
Throws:
RegistryException

isServicePublisher

public boolean isServicePublisher(java.lang.String serviceKey,
                                  java.lang.String publisherID)
                           throws RegistryException
Specified by:
isServicePublisher in interface DataStore
Throws:
RegistryException

saveBinding

public void saveBinding(BindingTemplate binding)
                 throws RegistryException
Specified by:
saveBinding in interface DataStore
Throws:
RegistryException

fetchBinding

public BindingTemplate fetchBinding(java.lang.String bindingKey)
                             throws RegistryException
Specified by:
fetchBinding in interface DataStore
Throws:
RegistryException

deleteBinding

public void deleteBinding(java.lang.String bindingKey)
                   throws RegistryException
Specified by:
deleteBinding in interface DataStore
Throws:
RegistryException

isValidBindingKey

public boolean isValidBindingKey(java.lang.String bindingKey)
                          throws RegistryException
Specified by:
isValidBindingKey in interface DataStore
Throws:
RegistryException

isBindingPublisher

public boolean isBindingPublisher(java.lang.String bindingKey,
                                  java.lang.String publisherID)
                           throws RegistryException
Specified by:
isBindingPublisher in interface DataStore
Throws:
RegistryException

saveTModel

public void saveTModel(TModel tModel,
                       java.lang.String authorizedUserID)
                throws RegistryException
Specified by:
saveTModel in interface DataStore
Throws:
RegistryException

fetchTModel

public TModel fetchTModel(java.lang.String tModelKey)
                   throws RegistryException
Specified by:
fetchTModel in interface DataStore
Throws:
RegistryException

deleteTModel

public void deleteTModel(java.lang.String tModelKey)
                  throws RegistryException
Specified by:
deleteTModel in interface DataStore
Throws:
RegistryException

markTModelAsDeleted

public void markTModelAsDeleted(java.lang.String tModelKey)
                         throws RegistryException
Specified by:
markTModelAsDeleted in interface DataStore
Throws:
RegistryException

isValidTModelKey

public boolean isValidTModelKey(java.lang.String tModelKey)
                         throws RegistryException
Specified by:
isValidTModelKey in interface DataStore
Throws:
RegistryException

isTModelPublisher

public boolean isTModelPublisher(java.lang.String tModelKey,
                                 java.lang.String publisherID)
                          throws RegistryException
Specified by:
isTModelPublisher in interface DataStore
Throws:
RegistryException

fetchBusinessInfo

public BusinessInfo fetchBusinessInfo(java.lang.String businessKey)
                               throws RegistryException
Specified by:
fetchBusinessInfo in interface DataStore
Throws:
RegistryException

fetchServiceInfo

public ServiceInfo fetchServiceInfo(java.lang.String serviceKey)
                             throws RegistryException
Specified by:
fetchServiceInfo in interface DataStore
Throws:
RegistryException

fetchTModelInfo

public TModelInfo fetchTModelInfo(java.lang.String tModelKey)
                           throws RegistryException
Specified by:
fetchTModelInfo in interface DataStore
Throws:
RegistryException

findBusiness

public java.util.Vector findBusiness(java.util.Vector nameVector,
                                     DiscoveryURLs discoveryURLs,
                                     IdentifierBag identifierBag,
                                     CategoryBag categoryBag,
                                     TModelBag tModelBag,
                                     FindQualifiers findQualifiers)
                              throws RegistryException
Specified by:
findBusiness in interface DataStore
Throws:
RegistryException

findService

public java.util.Vector findService(java.lang.String businessKey,
                                    java.util.Vector nameVector,
                                    CategoryBag categoryBag,
                                    TModelBag tModelBag,
                                    FindQualifiers findQualifiers)
                             throws RegistryException
Specified by:
findService in interface DataStore
Throws:
RegistryException

findTModel

public java.util.Vector findTModel(java.lang.String name,
                                   CategoryBag categoryBag,
                                   IdentifierBag identifierBag,
                                   FindQualifiers findQualifiers)
                            throws RegistryException
Specified by:
findTModel in interface DataStore
Throws:
RegistryException

findBinding

public java.util.Vector findBinding(java.lang.String serviceKey,
                                    CategoryBag categoryBag,
                                    TModelBag tModelBag,
                                    FindQualifiers findQualifiers)
                             throws RegistryException
Specified by:
findBinding in interface DataStore
Throws:
RegistryException

findRelatedBusinesses

public java.util.Vector findRelatedBusinesses(java.lang.String businessKey,
                                              KeyedReference keyedRef,
                                              FindQualifiers findQualifiers)
                                       throws RegistryException
1. Retrieve a Vector of BusinessKeys for related BusinessEntities by calling FindRelatedBusinessQuery.select(businessKey) or if a KeyedReference was specified in the query call FindRelatedBusinessQuery.selectWithKeyedRef(businessKey,KeyedReference) 2. Call FindBusinessByNameQuery.select(null,keyVector,qualifiers,connection) to return the Vector of relatedBusinessKeys from step 1 in the requested order as specified by any FindQualifiers supplied with the UDDI Request. 3. For each relatedBusinessKey returned in step 2 perform the following: 4. Create a new RelatedBusinessInfo instance. 5. Fetch the related businesses BusinessInfo instance by calling DataStore.fetchBusinessInfo(relatedBusinessKey) and save the Name Vector and Description Vector to the RelatedBusinessInfo created in step 4. 6. Using the businessKey passed in to the query and the relatedBusinessKey from the BusinessInfo fetched (step 4) get all KeyedReference instances for this pair of keys and add them to the RelatedBusinessInfo created in step 4. (only grab KeyedReference values from rows where both FROM_CHECK and TO_CHECK columns are = 'true'. Do this by making a call to PublisherAssertionTable.selectBusinessRelationships(businessKey,relatedKey)

Specified by:
findRelatedBusinesses in interface DataStore
Throws:
RegistryException

findRegisteredBusinesses

public java.util.Vector findRegisteredBusinesses(java.lang.String publisherID)
                                          throws RegistryException
Specified by:
findRegisteredBusinesses in interface DataStore
Throws:
RegistryException

findRegisteredTModels

public java.util.Vector findRegisteredTModels(java.lang.String publisherID)
                                       throws RegistryException
Specified by:
findRegisteredTModels in interface DataStore
Throws:
RegistryException

saveAssertions

public void saveAssertions(java.lang.String publisherID,
                           java.util.Vector assertions)
                    throws RegistryException
For each PublisherAssertion in the Vector of PublisherAssertions passed in perform the following steps: 1. Determine if the BusinessEntity specified in the 'fromKey' is managed by publisherID retrieved in step 1. Do this by calling: BusinessEntityTable.selectPublisherID(fromKey); 2. Determine if the BusinessEntity specified in the 'toKey' is managed by publisherID retrieved in step 1. Do this by calling: BusinessEntityTable.selectPublisherID(toKey); 3. If at least one of the two BusinessKeys specified in this PublisherAssertion is managed by providerID then check to see if a row already exists in the PUBLISHER_ASSERTION table by calling: PublisherAssertionTable.select(PublisherAssertion assertionIn) 4. If a row doesn't exist then insert a new one (set the values of the to_check and from_check columns appropriately based on info returned in steps 3 & 4.) Insert the row by calling: PublisherAssertionTable.insert(PublisherAssertion,fromCheck,toCheck) 5. If a row does exist and publisherID is responsible for the BusinessEntity identified by 'fromKey' then update the row by calling: PublisherAssertionTable.updateFromCheck(PublisherAssertion,true) 6. If a row does exist and publisherID is responsible for the BusinessEntity identified by 'toKey' then update the row by calling: PublisherAssertionTable.updateToCheck(PublisherAssertion,true)

Specified by:
saveAssertions in interface DataStore
Throws:
RegistryException

deleteAssertions

public void deleteAssertions(java.lang.String publisherID,
                             java.util.Vector assertions)
                      throws RegistryException
For each PublisherAssertion in the Vector of PublisherAssertions passed in perform the following steps: 1. Determine if the BusinessEntity specified in the 'fromKey' is managed by publisherID retrieved in step 1. Do this by calling: BusinessEntityTable.selectPublisherID(fromKey); 2. If the publisherID does manage the BusinessEntity identified by the PublisherAssertions 'fromKey' then call the following method: PublisherAssertionTable.updateFromCheck(PublisherAssertion,false) 3. Determine if the BusinessEntity specified in the 'toKey' is managed by publisherID retrieved in step 1. Do this by calling: BusinessEntityTable.selectPublisherID(toKey); 4. If the publisherID does manage the BusinessEntity identified by the PublisherAssertions 'toKey then call the following method: PublisherAssertionTable.updateToCheck(PublisherAssertion,false) 5. After iterating through the entire Vector of PublisherAssertions call the following method: PublisherAssertionTable.deleteDeadAssertions()

Specified by:
deleteAssertions in interface DataStore
Throws:
RegistryException

getAssertions

public java.util.Vector getAssertions(java.lang.String publisherID)
                               throws RegistryException
1. Retrieve all BusinessKey's that the publisherID is responsible for managing by calling: BusinessEntityTable.selectByPublisherID(publisherID) 2. Retrieve all PublisherAssertion's that publisherID has made by calling: PublisherAssertionTable.selectAssertions(Vector) where 'Vector' is the collection of BusinessKey's returned in step 2.

Specified by:
getAssertions in interface DataStore
Throws:
RegistryException

setAssertions

public java.util.Vector setAssertions(java.lang.String publisherID,
                                      java.util.Vector newAssertions)
                               throws RegistryException
1. Retrieve all PublisherAssertions associated with the publisherID passed in by calling DataSource.getAssertions(publisherID) 2. With the Vector of PublisherAssertions retrieved in step 1 call DataSource.deleteAssertions(publisherID,Vector) 3. With the Vector of PublisherAssertions passed into this method call: DataSource.addAssertions(publisherID,Vector)

Specified by:
setAssertions in interface DataStore
Throws:
RegistryException

getAssertionStatusItems

public java.util.Vector getAssertionStatusItems(java.lang.String publisherID,
                                                java.lang.String completionStatus)
                                         throws RegistryException
1. Retrieve Vector of BusinessKeys for BusinessEntities managed by publisherID by calling: BusinessEntityTable.selectByPublisherID(publisherID) 2. Call PublisherAssertionTable.selectBothKeysOwnedAssertions(Vector of BusinessKeys) 3. Call PublisherAssertionTable.selectFromKeyOwnedAssertions(Vector of BusinessKeys) 4. Call PublisherAssertionTable.selectToKeyOwnedAssertions(Vector of BusinessKeys) 5. Combine Vectors from steps 3, 4 and 5 above into one Vector of AssertionStatusItem instances 5. Loop through Vector from step 6 copying only AssertionStatusItem instances that have a CompletionStatus that matches the completionStatus requested.

Specified by:
getAssertionStatusItems in interface DataStore
Throws:
RegistryException

savePublisher

public void savePublisher(Publisher publisher)
                   throws RegistryException
Specified by:
savePublisher in interface DataStore
Throws:
RegistryException

deletePublisher

public void deletePublisher(java.lang.String publisherID)
                     throws RegistryException
Specified by:
deletePublisher in interface DataStore
Throws:
RegistryException

fetchPublisherInfo

public PublisherInfo fetchPublisherInfo(java.lang.String publisherID)
                                 throws RegistryException
Specified by:
fetchPublisherInfo in interface DataStore
Throws:
RegistryException

findPublisher

public java.util.Vector findPublisher(java.lang.String name,
                                      FindQualifiers findQualifiers)
                               throws RegistryException
Specified by:
findPublisher in interface DataStore
Throws:
RegistryException


Copyright © 2004-2007. All Rights Reserved.