You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by ad...@apache.org on 2006/02/28 17:35:26 UTC

svn commit: r381694 [35/38] - in /incubator/ode/scratch: bpe/ ode/ ode/bpelTests/ ode/bpelTests/probeService/ ode/bpelTests/test1/ ode/bpelTests/test10/ ode/bpelTests/test12/ ode/bpelTests/test13/ ode/bpelTests/test14/ ode/bpelTests/test15/ ode/bpelTes...

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/util/LoggerInformation.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/util/LoggerInformation.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/util/LoggerInformation.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/util/LoggerInformation.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2006 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.
+*/
+/*
+ * Created on Jun 6, 2003
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.apache.ode.util;
+import java.util.Enumeration;
+import java.util.logging.Formatter;
+import java.util.logging.Handler;
+import java.util.logging.LogManager;
+import java.util.logging.Logger;
+
+
+/**
+ * @author charper
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class LoggerInformation {
+	  
+	  public static void getInfo() {
+		// Get the Log Manager
+		LogManager manager = LogManager.getLogManager();
+		// Get all defined loggers
+		Enumeration names = manager.getLoggerNames();
+    
+		System.out.println("***Begin Logger Information");
+		// For each logger: show name, level, handlers etc. 
+		while (names.hasMoreElements()) {
+		  String loggername = (String)names.nextElement();
+		  Logger logger = manager.getLogger(loggername);
+		  System.out.println("-----------------------");
+		  System.out.println("Logger name: >" + logger.getName() + "<");
+		  System.out.println("Logger level: " + logger.getLevel());
+      
+		  // See if a filter is defined
+		  if (logger.getFilter() != null) 
+			System.out.println("Using a filter");
+		  else 
+			System.out.println("No filter used");
+      
+		  // For each handler: show formatter, level, etc. 
+		  Handler[] h = logger.getHandlers();
+		  if (h.length == 0) System.out.println("No handlers defined");
+		  for (int i = 0; i < h.length; i++) {
+			if (i == 0) System.out.println("Handlers:");
+			Formatter f = h[i].getFormatter();
+			System.out.println(h[i].getClass().getName());
+			System.out.println("  using formatter: " + f.getClass().getName());
+			System.out.println("  using level: " + h[i].getLevel());
+			if (h[i].getFilter() != null) 
+			  System.out.println("  using a filter");
+			else 
+			  System.out.println("  no filter");
+		  }
+
+		  // See if a parent exists 
+		  Logger parent = logger.getParent();
+		  if (parent != null) 
+			System.out.println("Parent: >" + parent.getName() + "<");
+		  else 
+			System.out.println("No parent");
+		}
+		System.out.println("*** End Logger Information");
+	  }
+  
+	  // Send all message types to the logger
+	  public static void tryLevels(Logger logger) {
+		logger.severe("severe message");
+		logger.warning("warning message");
+		logger.info("info message");
+		logger.config("config message");
+		logger.fine("fine message");
+		logger.finer("finer message");
+		logger.finest("finest message");
+	  }  
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/util/NamespaceUtil.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/util/NamespaceUtil.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/util/NamespaceUtil.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/util/NamespaceUtil.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2006 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.ode.util;
+
+import java.util.Collection;
+import java.util.HashMap;
+
+
+import org.apache.xml.utils.XMLChar;
+
+public class NamespaceUtil
+{
+	/**
+	 * Extract the namespace prefixes from an xpath expression.
+	 * This routine does not do xpath validation.
+	 * 
+	 * @param iXPathExpression
+	 * The xpath expression.
+	 * 
+	 * @return 
+	 * A collection of strings.  Each string holds a namespace prefix.
+	 */
+	public static Collection getNamespacePrefixes( String iXPathExpression )
+	{			
+		HashMap prefixMap = new HashMap();
+		String potentialPrefix = "";
+		
+		int length = iXPathExpression.length();
+		int currentIndex = 0;
+		int quote = '"';
+		int tick = '\'';
+		
+		while( currentIndex < length )
+		{
+			int currentChar = iXPathExpression.charAt( currentIndex );
+			
+			//Skip past any literals contained in the expression.
+			if ( currentChar == quote || currentChar == tick)
+			{
+				int closeIndex = 
+				  iXPathExpression.indexOf( currentChar, currentIndex + 1 );
+				if ( closeIndex >= 0 )
+				{
+					currentIndex = closeIndex + 1;
+				}
+				else
+				{
+					break;
+				}
+			}	
+			else if ( currentChar == ':')
+			{
+				if ( potentialPrefix.length() > 0 )
+				{
+					// Use a map to ensure uniqueness.
+					prefixMap.put( new String( potentialPrefix ), 
+					  new String(potentialPrefix) );
+					potentialPrefix = "";			
+				}
+			}
+			else if( XMLChar.isName(currentChar) )
+			{
+				potentialPrefix += (char)currentChar;
+			}
+			else
+			{
+				potentialPrefix = "";
+			}
+			
+			currentIndex++;
+		}
+		
+		return prefixMap.values();
+	}	
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/util/ObjectInputStreamContextClassLoader.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/util/ObjectInputStreamContextClassLoader.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/util/ObjectInputStreamContextClassLoader.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/util/ObjectInputStreamContextClassLoader.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2006 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.
+*/
+/*
+ * Created on Jun 17, 2005
+ *
+ * To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package org.apache.ode.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectStreamClass;
+import java.lang.reflect.Proxy;
+
+/**
+ * @author charper
+ *
+ * To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+public class ObjectInputStreamContextClassLoader extends ObjectInputStream {
+	ClassLoader cl;
+
+	public ObjectInputStreamContextClassLoader(InputStream in)
+		throws IOException
+	{
+		super(in);
+		this.cl = Thread.currentThread().getContextClassLoader();
+	}
+
+	protected Class resolveClass(ObjectStreamClass osc)
+		throws IOException, ClassNotFoundException
+	{
+		return cl.loadClass(osc.getName());
+	}
+
+	protected Class resolveProxyClass(String[] interfaces)
+		throws IOException, ClassNotFoundException
+	{
+		Class[] interfacesClass = new Class[interfaces.length];
+		for (int i = 0; i < interfaces.length; i++)
+		{
+			interfacesClass[i] = Class.forName(interfaces[i], false, cl);
+		}
+		return Proxy.getProxyClass(cl, interfacesClass);
+
+	}
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/util/PerfTimer.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/util/PerfTimer.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/util/PerfTimer.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/util/PerfTimer.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2006 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.ode.util;
+
+/**
+ * @author charper
+ *
+ * Timer for tests
+ */
+public class PerfTimer {
+
+	private long startTime = 0;
+	private boolean isAdditive = false;
+	private long totalTime = 0;
+	
+	public static void main(String[] args) {
+	}
+	public void start() {
+		startTime=System.currentTimeMillis();	
+	}
+	public void stop(){
+		isAdditive = true;
+		totalTime += getTime();
+	}
+	private long getTime() {
+		if ( startTime == 0 ) return 0;
+		return System.currentTimeMillis() - startTime;
+	}
+	public String getTimeSum(String name, int iterations) {
+		long time;
+		if ( isAdditive ) {
+			time = totalTime;
+		} else {
+			time = getTime();
+		}			
+		String s = ("****************************" + name+ " run complete.\n"+
+					"Iterations = " + iterations+"\n"+
+					"Total time in milliseconds  = " + time+"\n"+
+					"Total time in seconds = " + (double)time/(double)1000 +"\n"+
+					"Iterations/second = " + (double)iterations/((double)time/(double)1000));
+		return s;
+	}
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/util/TraceLog.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/util/TraceLog.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/util/TraceLog.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/util/TraceLog.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2006 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.ode.util;
+
+import java.util.logging.LogManager;
+//import java.util.logging.Logger;
+
+
+public class TraceLog {
+
+//private static Logger logger =
+//	Logger.getLogger(TraceLog.class.getName());
+
+	private static String TRACE_LOG = "bpe.trace.log";
+	private static boolean enabled = 
+		Boolean.valueOf(
+				LogManager.getLogManager().getProperty(TRACE_LOG)).booleanValue();
+
+	public static void println(String iValue)
+	{
+		if (enabled())
+		{
+			System.out.println("TRACELOG: " + iValue);
+		}
+	}
+
+	public static void println(Class iClass, String iValue)
+	{
+		if (enabled())
+		{
+			println("Inside " + iClass.getName() + " : " + iValue);
+		}
+	}
+	
+	public static void printlnInside( Class iClass, String iFunction, String iValue )
+	{
+		if ( enabled() )
+		{
+			println( iClass, "function = " + iFunction + " : " + iValue );
+		}	
+	}
+	
+	public static void printlnInsideID( Class iClass, String iFunction, String iID, String iValue )
+	{
+		if ( enabled() )
+		{
+			printlnInside( iClass, iFunction, "id = " + iID + " : " + iValue );
+		}
+	}
+	
+	public static void printRefCount( Class iClass, String iFunction, String iID, long iRefCount )
+	{
+		if ( enabled() )
+		{
+			printlnInsideID( iClass, iFunction, iID, " refCount = " + iRefCount );
+		}
+	}
+	
+	public static void printUpdateCount( Class iClass, String iFunction, String iID, long iUpdateCount )
+	{
+		if ( enabled() )
+		{
+			printlnInsideID( iClass, iFunction, iID, " updateCount = " + iUpdateCount );
+		}
+	}
+	
+	public static boolean enabled()
+	{
+		//return logger.isLoggable(Level.FINEST);
+		return enabled;
+	}
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/util/XMLDocBuilderByThread.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/util/XMLDocBuilderByThread.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/util/XMLDocBuilderByThread.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/util/XMLDocBuilderByThread.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2006 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.
+*/
+/*
+ * Created on Oct 27, 2004
+ *
+ * To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package org.apache.ode.util;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.ode.interaction.InteractionException;
+import org.apache.ode.interaction.XMLInteractionObject;
+
+public class XMLDocBuilderByThread {
+	
+	private static final Logger logger =
+		Logger.getLogger(XMLInteractionObject.class.getName());
+	private static Map _threadToXMLDocBuilder = Collections.synchronizedMap(new HashMap());
+	
+	public static DocumentBuilder getDocBuilder() throws InteractionException {
+		DocumentBuilder retValue = null;
+	
+		// get current thread object
+		Thread currThread = Thread.currentThread();
+	
+		// check to see if the tread object link already exists
+		if (_threadToXMLDocBuilder.containsKey(currThread) == false) {
+		// has no doc builder factory associate with this thread
+			// create the doc builder factory
+			DocumentBuilderFactory xmlDocBuilderFactory = DocumentBuilderFactory.newInstance();
+			xmlDocBuilderFactory.setNamespaceAware(true);
+
+			try {
+				retValue = xmlDocBuilderFactory.newDocumentBuilder();
+			} catch (ParserConfigurationException e) {
+				InteractionException bpx = new InteractionException("NATIVE_EXCEPTION",new Object[] {"ParserConfigurationException"},e);
+				bpx.log(logger,Level.SEVERE);
+				throw bpx;
+			}
+			// add the link to the map
+			_threadToXMLDocBuilder.put(currThread, retValue);
+		} else {
+		// has doc builder factory associated with this thread
+			// get the doc builder factory
+			retValue = (DocumentBuilder)(_threadToXMLDocBuilder.get(currThread));
+		}
+		return retValue;
+	}
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/util/xpath/XPathBoolean.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/util/xpath/XPathBoolean.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/util/xpath/XPathBoolean.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/util/xpath/XPathBoolean.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2006 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.
+*/
+/*
+ * Created on Jun 27, 2003
+ *
+ */
+package org.apache.ode.util.xpath;
+
+import java.io.Serializable;
+
+/**
+ * @author waterman
+ *
+ */
+public class XPathBoolean implements Serializable {
+	
+    static final long serialVersionUID = -9008019265809713280L;
+	
+	private Boolean delegate;
+	
+	public XPathBoolean( boolean value ) {
+		delegate = new Boolean(value);
+	}
+	public XPathBoolean( String value ) {
+		delegate = new Boolean(value);
+	}
+	
+	
+
+	/**
+	 * @param name
+	 * @return
+	 */
+	public static boolean getBoolean(String name) {
+		return Boolean.getBoolean(name);
+	}
+
+	/**
+	 * @param b
+	 * @return
+	 */
+	public static String toString(boolean b) {
+		return Boolean.toString(b)+"()";
+	}
+
+	/**
+	 * @param b
+	 * @return
+	 */
+	public static Boolean valueOf(boolean b) {
+		return Boolean.valueOf(b);
+	}
+
+	/**
+	 * @param s
+	 * @return
+	 */
+	public static Boolean valueOf(String s) {
+		return Boolean.valueOf(s);
+	}
+
+	/**
+	 * @return
+	 */
+	public boolean booleanValue() {
+		return delegate.booleanValue();
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#equals(java.lang.Object)
+	 */
+	public boolean equals(Object obj) {
+		return delegate.equals(obj);
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#hashCode()
+	 */
+	public int hashCode() {
+		return delegate.hashCode();
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	public String toString() {
+		return delegate.toString()+"()";
+	}
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/AXISUUIDService.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/AXISUUIDService.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/AXISUUIDService.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/AXISUUIDService.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2006 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.ode.uuid;
+
+import org.apache.axis.components.uuid.UUIDGen;
+import org.apache.axis.components.uuid.UUIDGenFactory;
+
+import org.apache.ode.util.BPEProperties;
+
+public class AXISUUIDService implements UUIDService {
+	
+	private UUIDGen _generator;
+
+	public String getUUID() {
+		return _generator.nextUUID();
+	}
+
+	public void init(BPEProperties props) throws UUIDServiceException {
+		_generator = UUIDGenFactory.getUUIDGen();
+
+	}
+
+	public void close() {
+		_generator = null;
+	}
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/ConnectorUUIDService.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/ConnectorUUIDService.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/ConnectorUUIDService.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/ConnectorUUIDService.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2006 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.ode.uuid;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.resource.ResourceException;
+import javax.resource.cci.ConnectionFactory;
+
+import org.apache.ode.util.BPEProperties;
+import org.apache.ode.uuid.connector.IUUIDConnection;
+
+/**
+ * @author charper
+ */
+public class ConnectorUUIDService implements UUIDService {
+	
+	private static Logger logger =
+		Logger.getLogger(ConnectorUUIDService.class.getName());
+		
+	private IUUIDConnection conn;
+	
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.uuid.UUIDService#getUUID()
+	 */
+	public String getUUID() {
+		try {
+			InitialContext ic = new InitialContext();
+			ConnectionFactory cf = 
+				(ConnectionFactory)ic.lookup("java:comp/env/theUUIDService");
+			conn = (IUUIDConnection)cf.getConnection();
+			String uuid = conn.getUUID();
+			conn.close();
+			return uuid;
+			
+		} catch ( ResourceException re ) {
+			logger.log(Level.SEVERE,"",re);
+		} catch ( NamingException ne ) {
+			logger.log(Level.SEVERE,"",ne);
+		}
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.uuid.UUIDService#init(org.apache.ode.util.BPEProperties)
+	 */
+	public void init(BPEProperties props) throws UUIDServiceException {
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.uuid.UUIDService#close()
+	 */
+	public void close() {
+	}
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/UUIDService.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/UUIDService.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/UUIDService.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/UUIDService.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2006 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.ode.uuid;
+
+import org.apache.ode.util.BPEProperties;
+
+/**
+ * @author waterman
+ *
+ * Generates UUID values
+ * 
+ */
+public interface UUIDService {
+	
+	public String getUUID();
+	
+	public void init(BPEProperties props) throws UUIDServiceException;
+	
+	public void close();
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/UUIDServiceException.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/UUIDServiceException.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/UUIDServiceException.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/UUIDServiceException.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2006 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.ode.uuid;
+
+import org.apache.ode.util.BPException;
+
+/**
+ * @author waterman
+ *
+ * 
+ * 
+ */
+public class UUIDServiceException extends BPException {
+	
+	static final long serialVersionUID = -632552333835451373L;
+
+
+	/**
+	 * @param message_id
+	 * @param msgParams
+	 */
+	public UUIDServiceException(String message_id, Object[] msgParams) {
+		super(message_id, msgParams);
+	}
+
+	/**
+	 * @param message_id
+	 * @param msgParams
+	 * @param cause
+	 */
+	public UUIDServiceException(
+		String message_id,
+		Object[] msgParams,
+		Throwable cause) {
+		super(message_id, msgParams, cause);
+	}
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/UUIDServiceFactory.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/UUIDServiceFactory.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/UUIDServiceFactory.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/UUIDServiceFactory.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2006 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.ode.uuid;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.ode.uuid.UUIDService;
+import org.apache.ode.uuid.UUIDServiceException;
+import org.apache.ode.util.BPEProperties;
+import org.apache.ode.util.BPException;
+
+/**
+ * @author waterman
+ *
+ * Instantiates an implementation of UUIDService
+ * 
+ */
+public class UUIDServiceFactory {
+	
+private static Logger logger = 
+		Logger.getLogger(UUIDServiceFactory.class.getName());
+private static String IM_UUID_PROPERTY_FILE_NAME = "theUUIDService.properties";
+
+	public static UUIDService createUUIDService(BPEProperties props)
+			throws UUIDServiceException {
+		UUIDService uuidService;
+
+		if (props.getUUIDUseConnector()) {
+			uuidService = new ConnectorUUIDService();
+			uuidService.init(props);
+		} else {
+			try {
+				// load the implementation
+				Class uuidClass = java.lang.Class.forName(props
+						.getUUIDServiceClass());
+				// try to instantiate the subclass
+				uuidService = (UUIDService) uuidClass.newInstance();
+				uuidService.init(props);
+
+			} catch (ClassNotFoundException e) {
+				UUIDServiceException use = new UUIDServiceException(
+						"CLASS_NOT_FOUND", new Object[] { props
+								.getEventDirectorClass() });
+				use.log(logger, Level.SEVERE);
+				throw use;
+			} catch (InstantiationException e) {
+				UUIDServiceException use = new UUIDServiceException(
+						"NATIVE_EXCEPTION",
+						new Object[] { "InstantiationException" }, e);
+				use.log(logger, Level.SEVERE);
+				throw use;
+			} catch (IllegalAccessException e) {
+				UUIDServiceException use = new UUIDServiceException(
+						"NATIVE_EXCEPTION",
+						new Object[] { "IllegalAccessException" }, e);
+				use.log(logger, Level.SEVERE);
+				throw use;
+			} catch (BPException e) {
+				throw new UUIDServiceException("BPE_EXCEPTION",
+						new Object[] {}, e);
+			}
+		}
+
+		return uuidService;
+	}
+
+	// LLW: 10-22-03
+	// Init UUID service from properties file	
+	public static UUIDService createUUIDService()
+		throws UUIDServiceException {
+			BPEProperties props = new BPEProperties();
+			try {
+				File file = new File(IM_UUID_PROPERTY_FILE_NAME);
+				if (file.exists() == true) {
+					FileInputStream ifstrm = new FileInputStream(IM_UUID_PROPERTY_FILE_NAME);
+					props.load(ifstrm);
+				}
+			} catch (IOException e) {
+				UUIDServiceException se = new UUIDServiceException("NATIVE_EXCEPTION",new Object[] {"IOException"},e);
+				se.log(logger,Level.SEVERE);
+				throw se;
+			}
+				
+			return createUUIDService(props);
+	}
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/IUUIDConnection.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/IUUIDConnection.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/IUUIDConnection.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/IUUIDConnection.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2006 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.
+*/
+/*
+ * Created on Aug 15, 2003
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.apache.ode.uuid.connector;
+
+import javax.resource.ResourceException;
+import javax.resource.cci.Connection;
+
+/**
+ * @author jjin
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public interface IUUIDConnection extends Connection{
+	public String getUUID() throws ResourceException;
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDConnection.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDConnection.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDConnection.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDConnection.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2006 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.ode.uuid.connector;
+
+import java.util.logging.Logger;
+
+import javax.resource.ResourceException;
+import javax.resource.cci.ConnectionMetaData;
+import javax.resource.cci.Interaction;
+import javax.resource.cci.LocalTransaction;
+import javax.resource.cci.ResultSetInfo;
+import javax.resource.spi.ConnectionEvent;
+
+
+/**
+ * A UUIDConnection is a connection to a UUID service. The UUIDConnection is used
+ * to acquire a UUID. This is a non-transactional connection.
+ * 
+ * @author waterman
+ *
+ */
+public class UUIDConnection
+	implements IUUIDConnection {
+
+	private static Logger logger = 
+				Logger.getLogger(UUIDConnection.class.getName());
+
+		
+	public UUIDConnection(UUIDManagedConnection managedConnection) {
+		this.mc = managedConnection;
+	}										
+		
+	/**
+	 * Interaction is not supported
+	 */
+	public Interaction createInteraction() throws ResourceException {
+		throw new UUIDNotSupportedException(logger,"UUID_NOT_SUPPORTED",new Object[] {"createInteraction()"});
+	}
+
+	/**
+	 * Local Transaction is not supported
+	 */
+	public LocalTransaction getLocalTransaction() throws ResourceException {
+		throw new UUIDNotSupportedException(logger,"UUID_NOT_SUPPORTED",new Object[] {"getLocalTransaction()"});
+	}
+
+	/**
+	 * Auto Commit is not supported
+	 */
+	public void setAutoCommit(boolean arg0) throws ResourceException {
+		throw new UUIDNotSupportedException(logger,"UUID_NOT_SUPPORTED",new Object[] {"setAutoCommit()"});
+	}
+
+	/**
+	 * Auto Commit is not supported
+	 */
+	public boolean getAutoCommit() throws ResourceException {
+		throw new UUIDNotSupportedException(logger,"UUID_NOT_SUPPORTED",new Object[] {"getAutoCommit()"});
+	}
+
+	/**
+	 * This method creates connection metadata
+	 */
+	public ConnectionMetaData getMetaData() throws ResourceException {
+		return new UUIDConnectionMetadata();
+	}
+
+	/**
+	 * Result Set Info is not supported
+	 */
+	public ResultSetInfo getResultSetInfo() throws ResourceException {
+		throw new UUIDNotSupportedException(logger,"UUID_NOT_SUPPORTED",new Object[] {"getResultSetInfo()"});
+	}
+
+	/**
+	 * This method closes the connection
+	 */
+	public void close() throws ResourceException {
+		if (mc != null) {
+			mc.sendEvent(ConnectionEvent.CONNECTION_CLOSED, null, this);
+			// set managed connection to null
+			// TODO - Cory uncomment this when EAServer JCA's work
+			//mc = null;
+		}
+	}
+
+	public String getUUID() throws ResourceException {
+		if ( mc == null ) throw new ResourceException("");
+		return mc.getUUID();
+	}
+
+	private UUIDManagedConnection mc;
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDConnectionFactory.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDConnectionFactory.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDConnectionFactory.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDConnectionFactory.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2006 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.ode.uuid.connector;
+
+import java.util.logging.Logger;
+
+import javax.naming.NamingException;
+import javax.naming.Reference;
+import javax.resource.ResourceException;
+import javax.resource.cci.Connection;
+import javax.resource.cci.ConnectionSpec;
+import javax.resource.cci.RecordFactory;
+import javax.resource.cci.ResourceAdapterMetaData;
+import javax.resource.spi.ConnectionManager;
+
+
+/**
+ * Acquires a UUIDConnection from a ConnectionManager
+ * 
+ * @author waterman
+ *
+ */
+public class UUIDConnectionFactory implements javax.resource.cci.ConnectionFactory {
+		
+	static final long serialVersionUID = -7512179930970209326L;
+
+	public UUIDConnectionFactory(UUIDManagedConnectionFactory managedConnectionFactory,
+									ConnectionManager connectionManager) {
+		this.mcf = managedConnectionFactory;
+    	this.cm = connectionManager;
+	}											
+
+	/**
+	 * This method gets the connection
+	 */
+	public Connection getConnection() throws ResourceException {
+		Connection connection = null;
+		// call connection manager to allocate connection
+        connection = (Connection)(cm.allocateConnection(mcf,null));
+		return connection;
+	}
+
+	/**
+	 * This method gets the connection
+	 */
+	public Connection getConnection(ConnectionSpec properties)
+		throws ResourceException {
+		Connection connection = null;
+		// cast it to UUIDConnectionSpec
+        UUIDConnectionSpec info = (UUIDConnectionSpec)(properties);	 
+        // call connection manager to allocate connection by passing in
+        // the connection spec  
+        connection = (Connection)(cm.allocateConnection(mcf,info));
+		return connection;
+	}
+
+	/**
+	 * Record Factory is not supported
+	 */
+	public RecordFactory getRecordFactory() throws ResourceException {
+		throw new UUIDNotSupportedException(logger,"UUID_NOT_SUPPORTED",new Object[] {"getRecordFactory()"});
+	}
+
+	/**
+	 * Resource Adapter Meatdata is not supported
+	 */
+	public ResourceAdapterMetaData getMetaData() throws ResourceException {
+		throw new UUIDNotSupportedException(logger,"UUID_NOT_SUPPORTED",new Object[] {"getMetaData()"});
+	}
+	
+	/**
+	 * @see javax.resource.Referenceable#setReference(javax.naming.Reference)
+	 */
+	public void setReference(Reference arg0) {
+		ref = arg0;
+	}
+
+	/**
+	 * @see javax.naming.Referenceable#getReference()
+	 */
+	public Reference getReference() throws NamingException {
+		return ref;
+	}
+	
+
+	private UUIDManagedConnectionFactory mcf = null;
+    private ConnectionManager cm = null;
+	private Reference ref = null;
+	
+	private static Logger logger = 
+				Logger.getLogger(UUIDConnectionFactory.class.getName());
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDConnectionManager.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDConnectionManager.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDConnectionManager.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDConnectionManager.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,227 @@
+/*
+ * Copyright 2006 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.ode.uuid.connector;
+
+import java.util.HashSet;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionEvent;
+import javax.resource.spi.ConnectionEventListener;
+import javax.resource.spi.ConnectionManager;
+import javax.resource.spi.ConnectionRequestInfo;
+import javax.resource.spi.ManagedConnection;
+import javax.resource.spi.ManagedConnectionFactory;
+import javax.security.auth.Subject;
+
+import org.apache.ode.pool.MinMaxObjPool;
+import org.apache.ode.pool.ObjPoolObject;
+import org.apache.ode.pool.PoolException;
+
+/**
+ * In a non-managed enviornment the UUIDConnectionManager is used to pool
+ * UUIDConnections. 
+ * <br>
+ * As the {@link #allocateConnection(ManagedConnectionFactory managedConnectionFactory,ConnectionRequestInfo info) allocateConnection}
+ * signature implies, the ConnectionManager may hold a collection
+ * of connection pools - one for each ManagedConnectionFactory.
+ * In the non-managed senario the UUIDConnectionManager is a Pool 
+ * rather than has a Pool(s).
+ * If the user needs more than one pool they must create and manage
+ * UUIDConnectionManager instances.	
+ * 
+ * @author waterman
+ *
+ */
+public class UUIDConnectionManager extends MinMaxObjPool implements ConnectionManager, ConnectionEventListener {
+
+	static final long serialVersionUID = -4273846573655733548L;
+
+	private UUIDManagedConnectionFactory m_factory;
+	private Subject m_auth;
+	private static Logger logger = 
+				Logger.getLogger(UUIDConnectionManager.class.getName());
+
+	public UUIDConnectionManager(UUIDManagedConnectionFactory factory) throws PoolException {
+		super(new HashSet(), false);
+		
+		m_factory = factory;
+		
+		//init the pool
+		Properties p = new Properties(); // Use class defaults
+		//p.setProperty("pool.maxSize","10");
+		
+		init(p,factory,m_auth,new UUIDConnectionSpec());
+
+	}
+
+	/**
+	 * This method allocates the connection
+	 */
+	public Object allocateConnection(
+		ManagedConnectionFactory managedConnectionFactory,
+		ConnectionRequestInfo info)
+		throws ResourceException {
+			
+		if ( managedConnectionFactory != m_factory ) {
+			throw new UUIDResourceException(logger,"UUID_MANAGED_FACTORY",null);
+		}
+		
+		// get a managed connection from the pool
+		ManagedConnection mc;
+		try {
+			addSupportedType(info);
+			mc = (ManagedConnection) checkout(managedConnectionFactory,m_auth,info);
+		} catch (PoolException e) {
+			throw new UUIDResourceException(logger,"UUID_POOL_EXCEPTION",null,e);
+		}
+		
+       	// get connection
+        return mc.getConnection(null, info);
+	}
+	
+	/**
+	 * @see org.apache.ode.pool.MinMaxObjPool#getUserIdentifiedObject(Object, Object, Object)
+	 */
+	protected ObjPoolObject getUserIdentifiedObject(
+		Object factory,
+		Object auth,
+		Object objSpec)
+		throws PoolException {
+			
+		Object ret = null;
+		
+		validateArgs(factory,auth,objSpec);
+		
+		try {
+			ret = ((UUIDManagedConnectionFactory)factory).matchManagedConnections((HashSet)pool,(Subject)auth,(ConnectionRequestInfo)objSpec);
+			
+			// if a matching object is found in the pool
+			if ( ret != null ) {
+				if ( !(ret instanceof ObjPoolObject) || !(ret instanceof UUIDManagedConnection)) {
+					PoolException pe = new PoolException("UUID_UNKOWN_OBJECT",null);
+					pe.log(logger,Level.SEVERE);
+					throw pe;
+				}
+				
+				// Register myself to receive connection events
+				((UUIDManagedConnection)ret).addConnectionEventListener(this); 
+			}
+			
+		} catch (ResourceException e) {
+			PoolException pe = new PoolException("UUID_RESOURCE_EXCEPTION",null,e);
+			pe.log(logger,Level.SEVERE);
+			throw pe;
+		}
+		
+				
+		return (ObjPoolObject)ret;
+	}
+
+	/**
+	 * @see org.apache.ode.pool.SimpleObjPool#checkinPoolObject(ObjPoolObject)
+	 */
+	protected void checkinPoolObject(ObjPoolObject o) throws PoolException {
+		pool.add(o);
+	}
+
+	/**
+	 * @see org.apache.ode.pool.SimpleObjPool#checkoutPoolObject(ObjPoolObject)
+	 */
+	protected void checkoutPoolObject(ObjPoolObject o) throws PoolException {
+		pool.remove(o);
+	}
+
+	/**
+	 * @see org.apache.ode.pool.SimpleObjPool#createObjPoolObject(Object, Object, Object)
+	 */
+	protected ObjPoolObject createObjPoolObject(
+		Object factory,
+		Object auth,
+		Object objectSpec)
+		throws PoolException {
+			
+		Object ret = null;
+		
+		validateArgs(factory,auth,objectSpec);
+			
+		try {
+			ret = ((UUIDManagedConnectionFactory)factory).createManagedConnection((Subject)auth,(ConnectionRequestInfo)objectSpec);
+		} catch (ResourceException e) {
+			PoolException pe = new PoolException("UUID_RESOURCE_EXCEPTION",null,e);
+			pe.log(logger,Level.SEVERE);
+			throw pe;
+		}
+		
+		return (ObjPoolObject)ret;
+	}
+
+	/**
+	 * @see javax.resource.spi.ConnectionEventListener#connectionClosed(javax.resource.spi.ConnectionEvent)
+	 */
+	public void connectionClosed(ConnectionEvent arg0) {
+		ManagedConnection mc = (ManagedConnection)arg0.getSource();
+		mc.removeConnectionEventListener(this);
+		try {
+			checkin((ObjPoolObject)mc);
+		} catch (PoolException e) {}
+	}
+
+	/**
+	 * @see javax.resource.spi.ConnectionEventListener#localTransactionStarted(javax.resource.spi.ConnectionEvent)
+	 */
+	public void localTransactionStarted(ConnectionEvent arg0) {
+	}
+
+	/**
+	 * @see javax.resource.spi.ConnectionEventListener#localTransactionCommitted(javax.resource.spi.ConnectionEvent)
+	 */
+	public void localTransactionCommitted(ConnectionEvent arg0) {
+	}
+
+	/**
+	 * @see javax.resource.spi.ConnectionEventListener#localTransactionRolledback(javax.resource.spi.ConnectionEvent)
+	 */
+	public void localTransactionRolledback(ConnectionEvent arg0) {
+	}
+
+	/**
+	 * @see javax.resource.spi.ConnectionEventListener#connectionErrorOccurred(javax.resource.spi.ConnectionEvent)
+	 */
+	public void connectionErrorOccurred(ConnectionEvent arg0) {
+	}
+	      
+	private void validateArgs(Object factory, Object auth, Object objectSpec) throws PoolException {
+		if ( (factory != null) && !(factory instanceof UUIDManagedConnectionFactory )) {
+			PoolException pe = new PoolException("UUID_CAST_EXCEPTION",new Object[] {"pool factory","UUIDManagedConnectionFactory"});
+			pe.log(logger,Level.SEVERE);
+			throw pe;
+		}
+		if ( (auth != null) && !(auth instanceof Subject)) {
+			PoolException pe = new PoolException("UUID_CAST_EXCEPTION",new Object[] {"pool auth","Subject"});
+			pe.log(logger,Level.SEVERE);
+			throw pe;
+		}
+		if ( (objectSpec != null) && !(objectSpec instanceof ConnectionRequestInfo)) {
+			PoolException pe = new PoolException("UUID_CAST_EXCEPTION",new Object[] {"pool objectSpec","ConnectionRequestInfo"}); 
+			pe.log(logger,Level.SEVERE);
+			throw pe;
+		}			
+	}
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDConnectionMetadata.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDConnectionMetadata.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDConnectionMetadata.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDConnectionMetadata.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2006 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.ode.uuid.connector;
+
+import javax.resource.ResourceException;
+import javax.resource.cci.ConnectionMetaData;
+
+
+/**
+ * 
+ * This is metadata is very static and I don't think anyone really cares about
+ * the type of UUID implementation.
+ * <BR>
+ * If someone really really wants to know what the implementation looks like
+ * we can go back and add in some code that gets the name of the UUID 
+ * implementation from the UUIDManagedConnection.
+ * 
+ * @author waterman
+ *
+ */
+public class UUIDConnectionMetadata implements ConnectionMetaData {
+	
+	public UUIDConnectionMetadata() {
+	}
+
+	/**
+	 * Not really that interesting
+	 */
+	public String getEISProductName() throws ResourceException {
+        return "UUID Service";
+	}
+
+	/**
+	 * Not really that interesting 
+	 */
+	public String getEISProductVersion() throws ResourceException {
+		return "Version 1.0";
+	}
+
+	/**
+	 * No user name defined 
+	 */
+	public String getUserName() throws ResourceException {
+		return "";
+	}
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDConnectionSpec.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDConnectionSpec.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDConnectionSpec.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDConnectionSpec.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2006 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.ode.uuid.connector;
+
+
+import javax.resource.cci.ConnectionSpec;
+import javax.resource.spi.ConnectionRequestInfo;
+
+/**
+ * There isn't any connection information needed. Clients should not be concerned
+ * with acquiring a specific connection.
+ * 
+ * @author waterman
+ *
+ */
+public class UUIDConnectionSpec
+	implements ConnectionRequestInfo, ConnectionSpec {
+
+	public UUIDConnectionSpec() {
+	}
+
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDEventListener.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDEventListener.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDEventListener.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDEventListener.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2006 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.
+*/
+/*
+ * Created on Apr 24, 2003
+ *
+ */
+package org.apache.ode.uuid.connector;
+
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.resource.spi.ConnectionEvent;
+import javax.resource.spi.ConnectionEventListener;
+import javax.resource.spi.ManagedConnection;
+
+	/**
+	 * This is a helper class to the UUIDManagedConnection
+	 *
+	 * The connector architecture provides an event callback mechanism that
+	 * enables an application server to receive notifications from a
+	 * ManagedConnection instance.
+	 *
+	 * @author Lance Waterman
+	 */
+
+public class UUIDEventListener  {
+
+		private Vector listeners;
+		private ManagedConnection mc;
+
+		UUIDEventListener(ManagedConnection mc) {
+			listeners = new Vector();
+			this.mc = mc;
+		}
+
+		void sendEvent(int eventType, Exception ex,
+									  Object connectionHandle) {
+			// The vector is cloned because the act of sending an event (i.e. close )
+			// to the ConnectionManager may cause the ConnectionManager to ask to
+			// be removed from the list and thus cause a failsafe error on the listener
+			// iterator.
+			
+			Vector list = new Vector(listeners);
+			ConnectionEvent ce = null;
+			if (ex == null) {
+				ce = new ConnectionEvent(mc, eventType);
+			} else {
+				ce = new ConnectionEvent(mc, eventType, ex);
+			}
+			if (connectionHandle != null) {
+				ce.setConnectionHandle(connectionHandle);
+			}
+
+			Iterator iter = list.iterator();
+			while (iter.hasNext()) {
+			
+				ConnectionEventListener l = (ConnectionEventListener) iter.next();
+
+				switch (eventType) {
+				case ConnectionEvent.CONNECTION_CLOSED:
+					l.connectionClosed(ce);
+					break;
+				case ConnectionEvent.LOCAL_TRANSACTION_STARTED:
+					l.localTransactionStarted(ce);
+					break;
+				case ConnectionEvent.LOCAL_TRANSACTION_COMMITTED:
+					l.localTransactionCommitted(ce);
+					break;
+				case ConnectionEvent.LOCAL_TRANSACTION_ROLLEDBACK:
+					l.localTransactionRolledback(ce);
+					break;
+				case ConnectionEvent.CONNECTION_ERROR_OCCURRED:
+					l.connectionErrorOccurred(ce);
+					break;
+				default:
+					throw new IllegalArgumentException("Illegal eventType: " +
+													   eventType);
+				}
+			}
+		}
+
+
+		void addConnectorListener(ConnectionEventListener l) {
+			if (listeners.contains(l) == false) {
+			   listeners.addElement(l);
+			}
+		}
+
+		void removeConnectorListener(ConnectionEventListener l) {
+			listeners.removeElement(l);
+		}
+	}
+
+

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDManagedConnection.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDManagedConnection.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDManagedConnection.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDManagedConnection.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,196 @@
+/*
+ * Copyright 2006 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.ode.uuid.connector;
+
+import java.io.PrintWriter;
+import java.util.logging.Logger;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionEventListener;
+import javax.resource.spi.ConnectionRequestInfo;
+import javax.resource.spi.LocalTransaction;
+import javax.resource.spi.ManagedConnection;
+import javax.resource.spi.ManagedConnectionMetaData;
+import javax.security.auth.Subject;
+import javax.transaction.xa.XAResource;
+
+import org.apache.ode.pool.ObjPoolObject;
+import org.apache.ode.util.BPEProperties;
+import org.apache.ode.uuid.UUIDService;
+import org.apache.ode.uuid.connector.service.UUIDServiceFactory;
+
+/**
+ * @author waterman
+ *
+ */
+public class UUIDManagedConnection implements ManagedConnection, ObjPoolObject {
+	
+	public UUIDManagedConnection(	Subject subject,
+									ConnectionRequestInfo info,
+									BPEProperties props) {
+//		this.subject = subject;
+//		this.info = info;
+//		this.props = props;
+		this.listener = new UUIDEventListener(this);
+		
+		try {
+			service = UUIDServiceFactory.createUUIDService(props);
+		} catch (UUIDResourceException e) {
+			// do nothing
+		}
+	}
+	
+	/**
+	 * This method creates a UUIDConnection
+	 */
+	public Object getConnection(Subject subject, ConnectionRequestInfo connectionRequestInfo)
+		throws ResourceException {
+			return new UUIDConnection(this);
+	}
+
+	/**
+	 * This method destroys all the contents
+	 */
+	public void destroy() throws ResourceException {
+			destroyed = true;
+	}
+
+	/**
+	 * This method cleans up the contents
+	 */
+	public void cleanup() throws ResourceException {
+
+	}
+
+	/**
+	 * Associate Connection is not supported
+	 */
+	public void associateConnection(Object connection) throws ResourceException {
+		throw new UUIDNotSupportedException(logger,"UUID_NOT_SUPPORTED",new Object[] {"associateConnection"});
+	}
+
+	/**
+	 * No connection event listener is defined
+	 */
+	public void addConnectionEventListener(ConnectionEventListener eventListener) {		
+		listener.addConnectorListener(eventListener);
+	}
+
+	/**
+	 * No connection event listener is defined
+	 */
+	public void removeConnectionEventListener(ConnectionEventListener eventListener) {		
+		listener.removeConnectorListener(eventListener);
+	}
+
+	/**
+	 * XSResource is not supported
+	 */
+	public XAResource getXAResource() throws ResourceException {
+		throw new UUIDNotSupportedException(logger,"UUID_NOT_SUPPORTED",new Object[] {"getXAResource()"});
+	}
+
+	/**
+	 * Local Transaction is not supported
+	 */
+	public LocalTransaction getLocalTransaction() throws ResourceException {
+		throw new UUIDNotSupportedException(logger,"UUID_NOT_SUPPORTED",new Object[] {"getLocalTransaction()"});	}
+
+	/**
+	 * This method gets the managed connection metadata
+	 */
+	public ManagedConnectionMetaData getMetaData() throws ResourceException {
+		if (destroyed == true) {
+			// already destroyed, throw exception
+			throw new IllegalStateException();
+		}
+		return new UUIDManagedConnectionMetadata();
+	}
+
+	/**
+	 * This method records the log writer
+	 */
+	public void setLogWriter(PrintWriter out) throws ResourceException {
+		if (destroyed == true) {
+			// already destroyed, throw exception
+			throw new IllegalStateException();
+		}
+		logWriter = out;
+	}
+
+	/**
+	 * This method returns the recorded log writer
+	 */
+	public PrintWriter getLogWriter() throws ResourceException {
+		if (destroyed == true) {
+			// already destroyed, throw exception
+			throw new IllegalStateException();
+		}
+		return logWriter;
+	}
+
+	void sendEvent(int eventType, Exception ex, Object connectionHandle) {
+		listener.sendEvent(eventType,ex,connectionHandle);
+	}
+	
+	String getUUID() throws ResourceException {
+		//if ( service == null ) {
+		//	service = UUIDServiceFactory.createUUIDService(props);
+		//}
+		
+		return service.getUUID();
+	}
+
+	//****** Methods for ObjPoolObject are implemented for a non-managed enviornment	
+	
+	/**
+	 * @see org.apache.ode.pool.ObjPoolObject#afterObjPoolObjectCheckin()
+	 */
+	public void afterObjPoolObjectCheckin() {
+	}
+
+	/**
+	 * @see org.apache.ode.pool.ObjPoolObject#beforeObjPoolObjectCheckout()
+	 */
+	public void beforeObjPoolObjectCheckout() {
+	}
+
+	/**
+	 * @see org.apache.ode.pool.ObjPoolObject#deleteObjPoolObject()
+	 */
+	public void deleteObjPoolObject() {
+	}
+
+	/**
+	 * @see org.apache.ode.pool.ObjPoolObject#isObjPoolObjectValid()
+	 */
+	public boolean isObjPoolObjectValid() {
+		return true;
+	}
+
+	
+	private UUIDEventListener listener;
+	private PrintWriter logWriter;
+	private boolean destroyed = false;
+//	private ConnectionRequestInfo info;
+//	private Subject subject;
+//	private BPEProperties props;
+	private UUIDService service;
+	
+	private static Logger logger = 
+				Logger.getLogger(UUIDManagedConnection.class.getName());
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDManagedConnectionFactory.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDManagedConnectionFactory.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDManagedConnectionFactory.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDManagedConnectionFactory.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,140 @@
+/*
+ * Copyright 2006 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.ode.uuid.connector;
+
+import java.io.PrintWriter;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.logging.Logger;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionManager;
+import javax.resource.spi.ConnectionRequestInfo;
+import javax.resource.spi.ManagedConnection;
+import javax.resource.spi.ManagedConnectionFactory;
+import javax.security.auth.Subject;
+
+import org.apache.ode.pool.PoolException;
+import org.apache.ode.util.BPEProperties;
+
+/**
+ * Creates a managed connection.
+ * 
+ * @author waterman
+ *
+ */
+public class UUIDManagedConnectionFactory
+	implements ManagedConnectionFactory {
+	
+	static final long serialVersionUID = 8493648046931230724L;
+
+	/**
+	 * This method creates a managed connection connection factory
+	 */
+	public Object createConnectionFactory(ConnectionManager connectionManager)
+		throws ResourceException {
+		return new UUIDConnectionFactory(this, connectionManager);
+	}
+
+	/**
+	 * This method creates an unmanaged connection factory
+	 */
+	public Object createConnectionFactory() throws ResourceException {
+		UUIDConnectionManager uuidCM = null;
+		
+		// Initialize the pool with a default connection spec and we are not using authorization credentials
+		try {
+			uuidCM = new UUIDConnectionManager(this);
+		} catch (PoolException e) {
+			throw new UUIDResourceException(logger,"UUID_POOL_EXCEPTION",null,e);
+		}
+		
+		return new UUIDConnectionFactory(this, uuidCM);
+	}
+
+	/**
+	 * This method creats the managed connection
+	 */
+	public ManagedConnection createManagedConnection(
+		Subject subject,
+		ConnectionRequestInfo info)
+		throws ResourceException {
+		return new UUIDManagedConnection(subject, info, props);
+	}
+
+	/**
+	 * This method checks for matched managed connection
+	 */
+	public ManagedConnection matchManagedConnections(
+		Set connections,
+		Subject subject,
+		ConnectionRequestInfo info)
+		throws ResourceException {
+		ManagedConnection retValue = null;
+		Iterator iter = connections.iterator();
+        while (iter.hasNext()) {
+            Object obj = iter.next();
+            if (obj instanceof UUIDManagedConnection) {
+       			retValue = (ManagedConnection)(obj);
+       			break;
+            }
+        }
+        return retValue;
+	}
+
+	/**
+	 * This method records the log writer
+	 */
+	public void setLogWriter(PrintWriter out) throws ResourceException {
+		logWriter = out;
+	}
+
+	/**
+	 * This method returns the recorded log writer
+	 */
+	public PrintWriter getLogWriter() throws ResourceException {
+		return logWriter;
+	}
+	
+	/**
+	 * Called by the appserver if found in the RAR deploy descriptor. In
+	 * an unmanaged enviorn the client is required to set this property.
+	 */
+	public void setUUIDImplClass(String impl) {
+		props.setUUIDServiceClass(impl);
+	}
+	public String getUUIDImplClass() {
+		return props.getUUIDServiceClass();
+	}
+
+	/**
+	 * Called by the appserver if found in the RAR deploy descriptor.  In
+	 * an unmanaged enviorn the client is required to set this property.
+	 */
+	public void setUUIDCacheSize(Integer size) {
+		props.setUUIDCacheSize(size.intValue());
+	}
+	public Integer getUUIDCacheSize() {
+		return new Integer(props.getUUIDCacheSize());
+	}
+	
+	private PrintWriter logWriter = null;
+	private BPEProperties props = new BPEProperties();
+
+	private static Logger logger = 
+				Logger.getLogger(UUIDManagedConnectionFactory.class.getName());	
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDManagedConnectionMetadata.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDManagedConnectionMetadata.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDManagedConnectionMetadata.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDManagedConnectionMetadata.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2006 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.ode.uuid.connector;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ManagedConnectionMetaData;
+
+/**
+ * @author waterman
+ *
+ */
+public class UUIDManagedConnectionMetadata
+	implements ManagedConnectionMetaData {
+		
+	public UUIDManagedConnectionMetadata() {
+	}
+
+	/**
+	 * Not really that interesting
+	 */
+	public String getEISProductName() throws ResourceException {
+		return "UUID Service";
+	}
+
+	/**
+	 * Not really that interesting
+	 */
+	public String getEISProductVersion() throws ResourceException {
+		return "Version 1.0";
+	}
+
+	/**
+	 * No max connections defined
+	 */
+	public int getMaxConnections() throws ResourceException {
+		return 0;
+	}
+
+	/**
+	 * No user name defined for metadata
+	 */
+	public String getUserName() throws ResourceException {
+		return "";
+	}
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDNotSupportedException.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDNotSupportedException.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDNotSupportedException.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDNotSupportedException.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2006 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.
+*/
+/*
+ * Created on Apr 25, 2003
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.apache.ode.uuid.connector;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.resource.NotSupportedException;
+
+import org.apache.ode.lang.ResourceGetter;
+
+/**
+ * @author waterman
+ *
+ */
+public class UUIDNotSupportedException extends NotSupportedException {
+
+	static final long serialVersionUID = 8801184414027429794L;
+
+	/**
+	 * @param arg0
+	 * @param arg1
+	 */
+	public UUIDNotSupportedException(String arg0, String arg1) {
+		super(ResourceGetter.getFormatted(arg0, null), arg1);
+	}
+
+	/**
+	 * @param arg0
+	 */
+	public UUIDNotSupportedException(String arg0) {
+		super(ResourceGetter.getFormatted(arg0, null));
+	}
+	
+	public UUIDNotSupportedException(Logger logger, String arg0, Object[] msgParams) {
+		super(ResourceGetter.getFormatted(arg0, msgParams));
+		logger.log(Level.SEVERE,getMessage(),this);
+	}
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDResourceException.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDResourceException.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDResourceException.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/UUIDResourceException.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2006 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.
+*/
+/*
+ * Created on Apr 25, 2003
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.apache.ode.uuid.connector;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.resource.ResourceException;
+
+import org.apache.ode.lang.ResourceGetter;
+
+/**
+ * @author waterman
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class UUIDResourceException extends ResourceException {
+
+	static final long serialVersionUID = -3370056251816748202L;
+	/**
+	 * @param arg0
+	 * @param arg1
+	 */
+	public UUIDResourceException(String arg0, String arg1) {
+		super(ResourceGetter.getFormatted(arg0, null), arg1);
+	}
+
+	/**
+	 * @param arg0
+	 */
+	public UUIDResourceException(String arg0) {
+		super(ResourceGetter.getFormatted(arg0, null));
+	}
+
+	public UUIDResourceException(Logger logger, String arg0, Object[] msgParams) {
+		super(ResourceGetter.getFormatted(arg0, msgParams));
+		logger.log(Level.SEVERE,getMessage(),this);
+	}
+	
+	public UUIDResourceException(Logger logger, String arg0, Object[] msgParams, Exception e) {
+		super(ResourceGetter.getFormatted(arg0, msgParams));
+		logger.log(Level.SEVERE,getMessage(),this);
+	}
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/service/GenUUIDService.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/service/GenUUIDService.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/service/GenUUIDService.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/service/GenUUIDService.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2006 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.ode.uuid.connector.service;
+
+
+//import java.util.logging.Logger;
+
+// removed jug.jar import org.doomdark.uuid.UUIDGenerator;
+
+import org.apache.ode.util.BPEProperties;
+import org.apache.ode.uuid.UUIDService;
+/**
+ * @author charper
+ *
+ * Uses the native Linux implementation of uuidgen.
+ * 
+ */
+public class GenUUIDService implements UUIDService {
+	
+//	private static Logger logger = 
+//			Logger.getLogger(GenUUIDService.class.getName());
+		
+// removed jug.jar	private static UUIDGenerator g = UUIDGenerator.getInstance();
+	
+	private int UUID_CACHE_SIZE;
+	private int cacheCount = 0;
+	
+	private String[] uuidCache;
+
+	public GenUUIDService() {
+		
+	}
+	
+	public void init(BPEProperties props) {
+		UUID_CACHE_SIZE = props.getUUIDCacheSize();
+		uuidCache = uuidgen(UUID_CACHE_SIZE);
+		cacheCount = UUID_CACHE_SIZE;
+	}
+
+	/**
+	 * @see org.apache.ode.uuid.UUIDService#getUUID()
+	 */
+	public synchronized String getUUID() {
+		
+		cacheCount--;
+		
+		if ( cacheCount < 0 ) {
+			uuidCache = uuidgen(UUID_CACHE_SIZE);
+			cacheCount = UUID_CACHE_SIZE-1;
+		}
+		
+		return uuidCache[cacheCount];
+		
+	}
+	
+	private String[] uuidgen(int nmbr)
+  {
+	String[] uuids = new String[nmbr];
+
+	   for (int i = 0; i < nmbr; ++i) {
+		// TODO: Cory - add a service property to set the ethernet address
+		// we are using a random one right now
+// removed jug.jar		 uuids[i] = g.generateTimeBasedUUID(g.getDummyAddress()).toString();
+	}
+	return uuids;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.uuid.UUIDService#close()
+	 */
+	public void close() {
+	}
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/service/LinUUIDService.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/service/LinUUIDService.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/service/LinUUIDService.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/service/LinUUIDService.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2006 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.ode.uuid.connector.service;
+
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.ode.util.BPEProperties;
+import org.apache.ode.uuid.UUIDService;
+/**
+ * @author charper
+ *
+ * Uses the native Linux implementation of uuidgen.
+ * 
+ */
+public class LinUUIDService implements UUIDService {
+	
+private static Logger logger = 
+		Logger.getLogger(LinUUIDService.class.getName());
+	
+	private int UUID_CACHE_SIZE;
+	private int cacheCount = 0;
+	
+	private String[] uuidCache;
+
+	public LinUUIDService() {
+		
+	}
+	
+	public void init(BPEProperties props) {
+		UUID_CACHE_SIZE = props.getUUIDCacheSize();
+		uuidCache = uuidgen(UUID_CACHE_SIZE);
+		cacheCount = UUID_CACHE_SIZE;
+	}
+
+	/**
+	 * @see org.apache.ode.uuid.UUIDService#getUUID()
+	 */
+	public String getUUID() {
+		
+		cacheCount--;
+		
+		if ( cacheCount < 0 ) {
+			uuidCache = uuidgen(UUID_CACHE_SIZE);
+			cacheCount = UUID_CACHE_SIZE-1;
+		}
+		
+		return uuidCache[cacheCount];
+		
+	}
+	
+	private String[] uuidgen(int nmbr)
+  {
+	String[] uuids = new String[nmbr];
+
+	try
+	{
+	  Runtime r = Runtime.getRuntime();
+
+	   for (int i = 0; i < nmbr; ++i) {
+		  Process p = r.exec("uuidgen -t");
+		  BufferedReader x = new BufferedReader(new InputStreamReader(p.getInputStream()));
+		  uuids[i] = x.readLine();
+	}
+	} catch (IOException ex)
+	{
+	  logger.log(Level.SEVERE,"",ex);
+	  throw new RuntimeException(ex.getMessage());
+	}
+
+	return uuids;
+  }
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.uuid.UUIDService#close()
+	 */
+	public void close() {
+	}
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/service/UUIDServiceFactory.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/service/UUIDServiceFactory.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/service/UUIDServiceFactory.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/service/UUIDServiceFactory.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2006 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.ode.uuid.connector.service;
+
+import java.util.logging.Logger;
+
+import org.apache.ode.util.BPEProperties;
+import org.apache.ode.uuid.UUIDService;
+import org.apache.ode.uuid.connector.UUIDResourceException;
+
+/**
+ * @author waterman
+ *
+ * Instantiates an implementation of UUIDService
+ *
+ */
+public class UUIDServiceFactory {
+
+private static Logger logger =
+		Logger.getLogger(UUIDServiceFactory.class.getName());
+
+	public static UUIDService createUUIDService(BPEProperties p)
+		throws UUIDResourceException {
+
+		UUIDService uuidService = null;
+		Class uuidClass = null;
+		try {
+			// load the UUIDGen implementation
+			uuidClass = Thread.currentThread().getContextClassLoader().loadClass( p.getUUIDServiceClass() );
+			// try to instantiate the UUIDGen subclass
+			uuidService = (UUIDService) uuidClass.newInstance();
+			uuidService.init(p);
+
+		} catch (ClassNotFoundException e) {
+			throw new UUIDResourceException(logger,"UUID_CLASS_NOT_FOUND",new Object [] {p.getUUIDServiceClass()},e);
+		} catch (Exception e) {
+			throw new UUIDResourceException(logger,"UUID_UNKNOWN_EXCEPTION",null,e);
+		}
+
+		return uuidService;
+	}
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/service/WinUUIDService.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/service/WinUUIDService.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/service/WinUUIDService.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/uuid/connector/service/WinUUIDService.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2006 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.ode.uuid.connector.service;
+
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.ode.util.BPEProperties;
+import org.apache.ode.uuid.UUIDService;
+/**
+ * @author waterman
+ *
+ * Uses the native Win implementation of uuidgen.
+ * 
+ */
+public class WinUUIDService implements UUIDService {
+	
+private static Logger logger = 
+		Logger.getLogger(WinUUIDService.class.getName());
+	
+	private int UUID_CACHE_SIZE;
+	private int cacheCount = 0;
+	
+	private String[] uuidCache;
+
+	public WinUUIDService() {
+		
+	}
+	
+	public void init(BPEProperties props) {
+		UUID_CACHE_SIZE = props.getUUIDCacheSize();
+		uuidCache = uuidgen(UUID_CACHE_SIZE);
+		cacheCount = UUID_CACHE_SIZE;
+	}
+
+	/**
+	 * @see org.apache.ode.uuid.UUIDService#getUUID()
+	 */
+	public String getUUID() {
+		
+		cacheCount--;
+		
+		if ( cacheCount < 0 ) {
+			uuidCache = uuidgen(UUID_CACHE_SIZE);
+			cacheCount = UUID_CACHE_SIZE-1;
+		}
+		
+		return uuidCache[cacheCount];
+		
+	}
+	
+	private String[] uuidgen(int nmbr)
+  {
+	String[] uuids = new String[nmbr];
+
+	try
+	{
+	  Runtime r = Runtime.getRuntime();
+	  Process p = r.exec("uuidgen -n" + nmbr);
+	  BufferedReader x = new BufferedReader(new InputStreamReader(p.getInputStream()));
+
+	  for (int i = 0; i < nmbr; ++i)
+		uuids[i] = x.readLine();
+	}
+	catch (IOException ex)
+	{
+	  logger.log(Level.SEVERE,"",ex);
+	  throw new RuntimeException(ex.getMessage());
+	}
+
+	return uuids;
+  }
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.uuid.UUIDService#close()
+	 */
+	public void close() {
+	}
+
+}