[prev in list] [next in list] [prev in thread] [next in thread] 

List:       juddi-cvs
Subject:    svn commit: r492694 - in
From:       kstam () apache ! org
Date:       2007-01-04 19:12:18
Message-ID: 20070104191218.D6A561A981A () eris ! apache ! org
[Download RAW message or body]

Author: kstam
Date: Thu Jan  4 11:12:17 2007
New Revision: 492694

URL: http://svn.apache.org/viewvc?view=rev&rev=492694
Log:
JUDDI-90 embedded mode execution Part II (and final). Adding the local transport \
support.  We should refactor the implementation of all these different transports so \
that they all reuse the same core implementation, but for now I don't want to \
introduce any issues with the current code base.

Added:
    webservices/juddi/trunk/src/java/org/apache/juddi/registry/local/
    webservices/juddi/trunk/src/java/org/apache/juddi/registry/local/AbstractService.java
  webservices/juddi/trunk/src/java/org/apache/juddi/registry/local/InquiryService.java
  webservices/juddi/trunk/src/java/org/apache/juddi/registry/local/PublishService.java
  webservices/juddi/trunk/src/java/org/apache/juddi/registry/local/Registry.java

Added: webservices/juddi/trunk/src/java/org/apache/juddi/registry/local/AbstractService.java
                
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/src/java/org/apache/juddi/registry/local/AbstractService.java?view=auto&rev=492694
 ==============================================================================
--- webservices/juddi/trunk/src/java/org/apache/juddi/registry/local/AbstractService.java \
                (added)
+++ webservices/juddi/trunk/src/java/org/apache/juddi/registry/local/AbstractService.java \
Thu Jan  4 11:12:17 2007 @@ -0,0 +1,311 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.juddi.registry.local;
+
+import java.util.Vector;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.soap.SOAPException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.juddi.datatype.RegistryObject;
+import org.apache.juddi.datatype.response.DispositionReport;
+import org.apache.juddi.datatype.response.ErrInfo;
+import org.apache.juddi.datatype.response.Result;
+import org.apache.juddi.error.BusyException;
+import org.apache.juddi.error.FatalErrorException;
+import org.apache.juddi.error.RegistryException;
+import org.apache.juddi.error.UnsupportedException;
+import org.apache.juddi.handler.HandlerMaker;
+import org.apache.juddi.handler.IHandler;
+import org.apache.juddi.registry.RegistryEngine;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * @author Kurt Stam (kurt.stam@redhat.com)
+ */
+public abstract class AbstractService
+{
+  // private reference to the webapp's logger.
+  private static Log log = LogFactory.getLog(AbstractService.class);
+  
+  // XML Document Builder
+  private static DocumentBuilder docBuilder = null;
+
+  public Node handleRequest(Element uddiReq) throws \
javax.xml.registry.RegistryException +  {
+    try 
+    {
+      if (uddiReq == null)
+        throw new FatalErrorException("A UDDI request was not " +
+          "found in the SOAP message.");
+      
+      // Grab the local name of the UDDI request element
+      // from the UDDI Request. If a value isn't returned 
+      // (either null or an empty String is returned) then 
+      // throw a FatalError exception. This is probably a 
+      // configuration problem related to the XML Parser 
+      // that jUDDI is using.
+      
+      String operation = uddiReq.getLocalName();
+      if ((operation == null) || (operation.trim().length() == 0))
+        throw new FatalErrorException("The UDDI service operation " +
+          "could not be identified.");
+      
+      // Grab the generic attribute value (version value).  If 
+      // one isn't specified or the value specified is not "2.0" 
+      // then throw an exception (this value must be specified 
+      // for all UDDI requests and currently only vesion 2.0
+      // UDDI requests are supported).
+
+      String version = uddiReq.getAttribute("generic");
+      if (version == null)
+        throw new FatalErrorException("A UDDI generic attribute " +
+          "value was not found for UDDI request: "+operation+" (The " +
+          "'generic' attribute must be present)");
+
+      // Verify that the appropriate endpoint was targeted for
+      // this service request.  The validateRequest method will
+      // throw an UnsupportedException if anything's amiss.
+
+      validateRequest(operation,version,uddiReq);
+      
+      // Lookup the appropriate XML handler.  Throw an 
+      // UnsupportedException if one could not be located.
+
+      HandlerMaker maker = HandlerMaker.getInstance();
+			IHandler requestHandler = maker.lookup(operation);
+      if (requestHandler == null)
+        throw new UnsupportedException("The UDDI service operation " +
+          "specified is unknown or unsupported: " +operation);
+      
+      // Unmarshal the raw xml into the appropriate jUDDI
+      // request object.
+
+      RegistryObject uddiReqObj = requestHandler.unmarshal(uddiReq);
+      
+      // Grab a reference to the shared jUDDI registry 
+      // instance (make sure it's running) and execute the 
+      // requested UDDI function.
+      
+      RegistryObject uddiResObj = null;      
+      RegistryEngine registry = Registry.getRegistry();
+      if ((registry != null) && (registry.isAvailable()))
+        uddiResObj = registry.execute(uddiReqObj);
+      else
+        throw new BusyException("The Registry is currently unavailable.");
+      
+      // Lookup the appropriate response handler which will
+      // be used to marshal the UDDI object into the appropriate 
+      // xml format.
+      
+      IHandler responseHandler = maker.lookup(uddiResObj.getClass().getName());
+      if (responseHandler == null)
+        throw new FatalErrorException("The response object " +
+          "type is unknown: " +uddiResObj.getClass().getName());
+      
+      // Create a new 'temp' XML element to use as a container 
+      // in which to marshal the UDDI response data into.
+        
+      DocumentBuilder docBuilder = getDocumentBuilder();
+      Document document = docBuilder.newDocument();
+      Element element = document.createElement("temp");
+      
+      // Lookup the appropriate response handler and marshal 
+      // the juddi object into the appropriate xml format (we 
+      // only support UDDI v2.0 at this time).  Attach the
+      // results to the body of the SOAP response.
+        
+      responseHandler.marshal(uddiResObj,element);
+      
+      // Grab a reference to the 'temp' element's
+      // only child here (this has the effect of
+      // discarding the temp element) and append 
+      // this child to the soap response body
+      document.appendChild(element.getFirstChild());
+
+      return document;
+    } 
+    catch(Exception ex) // Catch ALL exceptions
+    {
+      // SOAP Fault values
+      String faultCode = null;
+      String faultString = null;
+      String faultActor = null;
+      
+      // UDDI DispositionReport values
+      String errno = null;
+      String errCode = null;
+      String errText = null;
+      
+      // All RegistryException and subclasses of RegistryException
+      // should contain values for populating a SOAP Fault as well
+      // as a UDDI DispositionReport with specific information 
+      // about the problem.
+      //
+      // We've got to dig out the dispositionReport and populate  
+      // the SOAP Fault 'detail' element with this information.        
+      
+      if (ex instanceof RegistryException)
+      {
+        // Since we've intercepted a RegistryException type
+        // then we can assume this is a "controlled" event
+        // and simply log the error message without a stack
+        // trace.
+
+        log.error(ex.getMessage());
+
+        RegistryException rex = (RegistryException)ex;
+        
+        faultCode = rex.getFaultCode();  // SOAP Fault faultCode
+        faultString = rex.getFaultString();  // SOAP Fault faultString
+        faultActor = rex.getFaultActor();  // SOAP Fault faultActor
+        
+        DispositionReport dispRpt = rex.getDispositionReport();
+        if (dispRpt != null)
+        {
+          Result result = null;
+          ErrInfo errInfo = null;
+        
+          Vector results = dispRpt.getResultVector();
+          if ((results != null) && (!results.isEmpty()))
+            result = (Result)results.elementAt(0);
+        
+          if (result != null)
+          {
+            errno = String.valueOf(result.getErrno());  // UDDI Result errno
+            errInfo = result.getErrInfo();
+          
+            if (errInfo != null)
+            {
+              errCode = errInfo.getErrCode();  // UDDI ErrInfo errCode
+              errText = errInfo.getErrMsg();  // UDDI ErrInfo errMsg
+            }
+          }
+        }
+      }
+      else if (ex instanceof SOAPException)
+      {
+        log.error(ex.getMessage());
+          
+        // Because something occured that jUDDI wasn't expecting
+        // let's set default SOAP Fault values.  Since SOAPExceptions
+        // here are most likely XML validation errors let's blame the
+        // client by placing "Client" in the Fault Code and pass
+        // the Exception message back to the client.
+        
+        faultCode = "Client";
+        faultString = ex.getMessage();
+        faultActor = null;
+        
+        // Let's set default values for the UDDI DispositionReport
+        // here.  While we didn't catch a RegistryException (or 
+        // subclass) we're going to be friendly and include a
+        // FatalError DispositionReport within the message from the 
+        // SAX parsing problem in the SOAP Fault anyway.
+        
+        errno = String.valueOf(Result.E_FATAL_ERROR);
+        errCode = Result.lookupErrCode(Result.E_FATAL_ERROR); 
+        errText = Result.lookupErrText(Result.E_FATAL_ERROR) + 
+                  " " + ex.getMessage();
+      }
+      else // anything else
+      {
+        // All other exceptions (other than SOAPException or 
+        // RegistryException and subclasses) are either a result 
+        // of a jUDDI configuration problem or something that 
+        // we *should* be catching and converting to a 
+        // RegistryException but are not (yet!).
+            
+        log.error(ex.getMessage(),ex);
+
+        // Because something occured that jUDDI wasn't expecting
+        // let's set default SOAP Fault values.  Since jUDDI
+        // should be catching anything significant let's blame 
+        // jUDDI by placing "Server" in the Fault Code and pass
+        // the Exception message on to the client.
+        
+        faultCode = "Server";
+        faultString = ex.getMessage();
+        faultActor = null;
+          
+        // Let's set default values for the UDDI DispositionReport
+        // here.  While we didn't catch a RegistryException (or 
+        // subclass) but we're going to be friendly and include a
+        // FatalError DispositionReport within the SOAP Fault anyway.
+        
+        errno = String.valueOf(Result.E_FATAL_ERROR);
+        errCode = Result.lookupErrCode(Result.E_FATAL_ERROR); 
+        errText = Result.lookupErrText(Result.E_FATAL_ERROR) +
+                  " An internal UDDI server error has " +
+                  "occurred. Please report this error " +
+                  "to the UDDI server administrator.";
+      }
+      
+      // We should have everything we need to assemble 
+      // the SOAPFault so lets piece it together and 
+      // send it on it's way.
+      String fault = "faultCode=" + faultCode + ", faultString=" + faultString 
+  	+ ", faultActor=" + faultActor + ", errno=" + errno + ", errCode=" + errCode
+  	+ ", errText=" + errText;
+      //FIX ME Kurt, change to other type of exception.
+      throw new javax.xml.registry.RegistryException(fault);
+    }
+  }
+
+  /**
+   * 
+   */
+  public abstract void validateRequest(String operation,String generic,Element \
uddiReq) +  	throws RegistryException;
+  
+  /**
+   *
+   */
+  private DocumentBuilder getDocumentBuilder()
+  {
+    if (docBuilder == null)
+      docBuilder = createDocumentBuilder();    
+    return docBuilder;
+  }
+
+  /**
+   *
+   */
+  private synchronized DocumentBuilder createDocumentBuilder()
+  {
+    if (docBuilder != null)
+      return docBuilder;
+
+    try {
+     DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+     factory.setNamespaceAware(true);
+     //factory.setValidating(true);
+
+     docBuilder = factory.newDocumentBuilder();
+    }
+    catch(ParserConfigurationException pcex) {
+      pcex.printStackTrace();
+    }
+
+    return docBuilder;
+  }
+}
\ No newline at end of file

Added: webservices/juddi/trunk/src/java/org/apache/juddi/registry/local/InquiryService.java
                
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/src/java/org/apache/juddi/registry/local/InquiryService.java?view=auto&rev=492694
 ==============================================================================
--- webservices/juddi/trunk/src/java/org/apache/juddi/registry/local/InquiryService.java \
                (added)
+++ webservices/juddi/trunk/src/java/org/apache/juddi/registry/local/InquiryService.java \
Thu Jan  4 11:12:17 2007 @@ -0,0 +1,80 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.juddi.registry.local;
+
+import java.util.TreeSet;
+
+import org.apache.juddi.IRegistry;
+import org.apache.juddi.error.FatalErrorException;
+import org.apache.juddi.error.RegistryException;
+import org.apache.juddi.error.UnsupportedException;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * @author Kurt Stam (kurt.stam@redhat.com)
+ */
+public class InquiryService extends AbstractService
+{
+//	 collection of valid operations
+	  private TreeSet operations = null;
+	  
+  public InquiryService() {
+		super();
+		operations = new TreeSet();
+	  	operations.add("find_business");
+	  	operations.add("find_service");
+	  	operations.add("find_binding");
+	  	operations.add("find_tmodel");
+	  	operations.add("find_relatedbusinesses");
+	  	operations.add("get_businessdetail");
+	  	operations.add("get_businessdetailext");
+	  	operations.add("get_servicedetail");
+	  	operations.add("get_bindingdetail");
+	  	operations.add("get_tmodeldetail");
+	}
+
+  public void validateRequest(String operation,String version,Element uddiReq)
+		throws RegistryException
+	{
+    // If the value 
+  	// specified is not "2.0" then throw an exception (this 
+  	// value must be specified for all UDDI requests and 
+  	// only version 2.0 UDDI requests are supported by 
+  	// this endpoint).
+
+  	if (version == null)
+      throw new FatalErrorException("A UDDI generic attribute " +
+        "value was not found for UDDI request: "+operation+" (The " +
+        "'generic' attribute must be present)");
+    else if (!version.equals(IRegistry.UDDI_V2_GENERIC))
+      throw new UnsupportedException("Only UDDI v2 " +
+        "requests are currently supported. The generic attribute value " +
+        "received was: "+version);
+
+    if ((operation == null) || (operation.trim().length() == 0))
+      throw new FatalErrorException("The UDDI service operation " +
+        "could not be identified.");
+    else if (!operations.contains(operation.toLowerCase()))
+    	throw new UnsupportedException("The operation "+operation+" is not " +
+    			"supported by the UDDI version 2 Inquiry API.");
+	}
+  
+  public Node inquire(Element uddiReq) throws javax.xml.registry.RegistryException{
+	  return handleRequest(uddiReq);
+  }
+  
+}

Added: webservices/juddi/trunk/src/java/org/apache/juddi/registry/local/PublishService.java
                
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/src/java/org/apache/juddi/registry/local/PublishService.java?view=auto&rev=492694
 ==============================================================================
--- webservices/juddi/trunk/src/java/org/apache/juddi/registry/local/PublishService.java \
                (added)
+++ webservices/juddi/trunk/src/java/org/apache/juddi/registry/local/PublishService.java \
Thu Jan  4 11:12:17 2007 @@ -0,0 +1,86 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.juddi.registry.local;
+
+import java.util.TreeSet;
+
+import org.apache.juddi.IRegistry;
+import org.apache.juddi.error.FatalErrorException;
+import org.apache.juddi.error.RegistryException;
+import org.apache.juddi.error.UnsupportedException;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * @author Kurt Stam (kurt.stam@jboss.com)
+ */
+public class PublishService extends AbstractService
+{
+  // collection of valid operations
+  private TreeSet operations = null;
+
+  public PublishService() {
+	super();
+	operations = new TreeSet();
+  	operations.add("get_authtoken");
+  	operations.add("get_registeredinfo");
+  	operations.add("discard_authtoken");
+  	operations.add("save_business");
+  	operations.add("save_service");
+  	operations.add("save_binding");
+  	operations.add("save_tmodel");
+  	operations.add("delete_business");
+  	operations.add("delete_service");
+  	operations.add("delete_binding");
+  	operations.add("delete_tmodel");
+  	operations.add("add_publisherassertions");
+  	operations.add("set_publisherassertions");
+  	operations.add("get_publisherassertions");
+  	operations.add("delete_publisherassertions");
+  	operations.add("get_assertionstatusreport");
+}
+
+
+  public void validateRequest(String operation,String version,Element uddiReq)
+		throws RegistryException
+	{
+    // If the value 
+  	// specified is not "2.0" then throw an exception (this 
+  	// value must be specified for all UDDI requests and 
+  	// only version 2.0 UDDI requests are supported by 
+  	// this endpoint).
+
+  	if (version == null)
+      throw new FatalErrorException("A UDDI generic attribute " +
+        "value was not found for UDDI request: "+operation+" (The " +
+        "'generic' attribute must be present)");
+    else if (!version.equals(IRegistry.UDDI_V2_GENERIC))
+      throw new UnsupportedException("Only UDDI v2 " +
+        "requests are currently supported. The generic attribute value " +
+        "received was: "+version);
+
+    if ((operation == null) || (operation.trim().length() == 0))
+      throw new FatalErrorException("The UDDI service operation " +
+        "could not be identified.");
+    else if (!operations.contains(operation.toLowerCase()))
+    	throw new UnsupportedException("The operation "+operation+" is not " +
+    			"supported by the UDDI version 2 Publish API.");
+	}
+  
+  public Node publish(Element uddiReq) throws javax.xml.registry.RegistryException{
+	  return handleRequest(uddiReq);
+  }
+}

Added: webservices/juddi/trunk/src/java/org/apache/juddi/registry/local/Registry.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/src/java/org/apache/juddi/registry/local/Registry.java?view=auto&rev=492694
 ==============================================================================
--- webservices/juddi/trunk/src/java/org/apache/juddi/registry/local/Registry.java \
                (added)
+++ webservices/juddi/trunk/src/java/org/apache/juddi/registry/local/Registry.java \
Thu Jan  4 11:12:17 2007 @@ -0,0 +1,210 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.juddi.registry.local;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.juddi.registry.RegistryEngine;
+import org.apache.juddi.util.Loader;
+
+/**
+ * This servlet is ONLY used to initialize the jUDDI webapp on
+ * startup and cleanup the jUDDI webapp on shutdown.
+ * 
+ * @author Kurt Stam (kurt.stam@redhat.com)
+ */
+public abstract class Registry
+{ 
+  private static final String CONFIG_FILE_PROPERTY_NAME = "juddi.propertiesFile";
+  // default config file name. 
+  private static final String DEFAULT_PROPERTY_FILE = "/juddi.properties";
+   
+  // private reference to the webapp's logger.
+  private static Log log = LogFactory.getLog(Registry.class);
+
+  // registry singleton instance
+  private static RegistryEngine registry = null;
+
+/**
+   * Create the shared instance of jUDDI's Registry class
+   * and call it's "init()" method to initialize all core 
+   * components.
+   */
+  public static void init() 
+  {   
+
+    Properties props = new Properties();
+
+    try
+    {      
+      log.info("Loading jUDDI configuration.");
+        
+//    determine the name of the juddi property file to use from web.xml
+      String propFile = System.getProperty(CONFIG_FILE_PROPERTY_NAME);
+      if ((propFile == null) || (propFile.trim().length() == 0)) {
+        propFile = DEFAULT_PROPERTY_FILE;
+      }
+   
+      InputStream is = Loader.getResourceAsStream(propFile);
+      if (is==null) {
+    	  is = Class.class.getResourceAsStream(propFile);
+      }
+      if (is==null) {
+    	  File configFile = new File(propFile);
+    	  is = new FileInputStream(configFile);
+      }
+        
+      if (is != null)
+      {
+        log.info("Resources loaded from: "+propFile);
+
+        // Load jUDDI configuration from the 
+        // juddi.properties file found in root directory.
+
+        props.load(is);
+      }
+      else
+      {
+        log.warn("Could not locate jUDDI properties '" + propFile + 
+                "'. Using defaults.");
+
+        // A juddi.properties file doesn't exist
+        // yet so create create a new Properties 
+        // instance using default property values.
+        
+        props.put(RegistryEngine.PROPNAME_OPERATOR_NAME,
+                  RegistryEngine.DEFAULT_OPERATOR_NAME);
+        
+        props.put(RegistryEngine.PROPNAME_I18N_LANGUAGE_CODE,
+            			RegistryEngine.DEFAULT_I18N_LANGUAGE_CODE);
+  
+        props.put(RegistryEngine.PROPNAME_I18N_COUNTRY_CODE,
+            			RegistryEngine.DEFAULT_I18N_COUNTRY_CODE);
+  
+        props.put(RegistryEngine.PROPNAME_DISCOVERY_URL,
+                  RegistryEngine.DEFAULT_DISCOVERY_URL);
+        
+        props.put(RegistryEngine.PROPNAME_ADMIN_EMAIL_ADDRESS,
+                  RegistryEngine.DEFAULT_ADMIN_EMAIL_ADDRESS);
+        
+        props.put(RegistryEngine.PROPNAME_DATASOURCE_NAME,
+                  RegistryEngine.DEFAULT_DATASOURCE_NAME);
+        
+        props.put(RegistryEngine.PROPNAME_IS_USE_DATASOURCE,
+                  RegistryEngine.DEFAULT_IS_USE_DATASOURCE);
+        
+        props.put(RegistryEngine.PROPNAME_JDBC_DRIVER,
+                RegistryEngine.DEFAULT_JDBC_DRIVER);
+      
+        props.put(RegistryEngine.PROPNAME_JDBC_URL,
+                RegistryEngine.DEFAULT_JDBC_URL);
+      
+        props.put(RegistryEngine.PROPNAME_JDBC_USERNAME,
+                RegistryEngine.DEFAULT_JDBC_USERNAME);
+      
+        props.put(RegistryEngine.PROPNAME_JDBC_PASSWORD,
+                RegistryEngine.DEFAULT_JDBC_PASSWORD);
+              
+        props.put(RegistryEngine.PROPNAME_AUTH_CLASS_NAME,
+                  RegistryEngine.DEFAULT_AUTH_CLASS_NAME);
+        
+        props.put(RegistryEngine.PROPNAME_CRYPTOR_CLASS_NAME,
+                  RegistryEngine.DEFAULT_CRYPTOR_CLASS_NAME);
+        
+        props.put(RegistryEngine.PROPNAME_DATASTORE_CLASS_NAME,
+                  RegistryEngine.DEFAULT_DATASTORE_CLASS_NAME);
+        
+        props.put(RegistryEngine.PROPNAME_UUIDGEN_CLASS_NAME,
+                  RegistryEngine.DEFAULT_UUIDGEN_CLASS_NAME);
+        
+        props.put(RegistryEngine.PROPNAME_VALIDATOR_CLASS_NAME,
+                  RegistryEngine.DEFAULT_VALIDATOR_CLASS_NAME);  
+
+        props.put(RegistryEngine.PROPNAME_MAX_NAME_ELEMENTS,
+                  Integer.toString(RegistryEngine.DEFAULT_MAX_NAME_ELEMENTS));
+        
+        props.put(RegistryEngine.PROPNAME_MAX_NAME_LENGTH,
+                  Integer.toString(RegistryEngine.DEFAULT_MAX_NAME_LENGTH));
+
+        props.put(RegistryEngine.PROPNAME_MAX_MESSAGE_SIZE,
+                  Integer.toString(RegistryEngine.DEFAULT_MAX_MESSAGE_SIZE));        \
 +
+        props.put(RegistryEngine.PROPNAME_MAX_BUSINESSES_PER_PUBLISHER,
+                  Integer.toString(RegistryEngine.DEFAULT_MAX_BUSINESSES_PER_PUBLISHER));
 +        
+        props.put(RegistryEngine.PROPNAME_MAX_SERVICES_PER_BUSINESS,
+                  Integer.toString(RegistryEngine.DEFAULT_MAX_SERVICES_PER_BUSINESS));
 +        
+        props.put(RegistryEngine.PROPNAME_MAX_BINDINGS_PER_SERVICE,
+                  Integer.toString(RegistryEngine.DEFAULT_MAX_BINDINGS_PER_SERVICE));
 +        
+        props.put(RegistryEngine.PROPNAME_MAX_TMODELS_PER_PUBLISHER,
+                  Integer.toString(RegistryEngine.DEFAULT_MAX_TMODELS_PER_PUBLISHER));
 +        
+        props.put(RegistryEngine.PROPNAME_MAX_ROWS_LIMIT,           
+                  Integer.toString(RegistryEngine.DEFAULT_MAX_ROWS_LIMIT));
+        
+        props.put(RegistryEngine.PROPNAME_JAVA_NAMING_FACTORY_INITIAL,           
+                RegistryEngine.DEFAULT_JAVA_NAMING_FACTORY_INITIAL);
+      
+        props.put(RegistryEngine.PROPNAME_JAVA_NAMING_PROVIDER_URL,           
+                RegistryEngine.DEFAULT_JAVA_NAMING_PROVIDER_URL);
+      
+        props.put(RegistryEngine.PROPNAME_JAVA_NAMING_FACTORY_URL_PKGS,           
+                RegistryEngine.DEFAULT_JAVA_NAMING_FACTORY_URL_PKGS);
+        
+      }
+    }
+    catch(IOException ioex) {
+      log.error(ioex.getMessage(),ioex);
+    }
+
+    log.info("Initializing jUDDI components.");
+    
+    registry = new RegistryEngine(props);
+    registry.init();
+  }
+  
+  /**
+   * Grab the shared instance of jUDDI's Registry class and
+   * call it's "dispose()" method to notify all sub-components
+   * to stop any background threads and release any external
+   * resources they may have aquired.
+   */
+  public void destroy()
+  {
+    log.info("jUDDI Stopping: Cleaning up existing resources.");
+
+    RegistryEngine registry = Registry.getRegistry();
+    if (registry != null)
+      registry.dispose();
+  }
+
+  /**
+   *
+   */
+  public static RegistryEngine getRegistry()
+  {
+	  init();
+      return registry;
+  }
+}
\ No newline at end of file



---------------------------------------------------------------------
To unsubscribe, e-mail: juddi-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: juddi-cvs-help@ws.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic