[jboss-svn-commits] JBL Code SVN: r31076 - labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/internal.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Jan 13 22:15:46 EST 2010


Author: mark.proctor at jboss.com
Date: 2010-01-13 22:15:45 -0500 (Wed, 13 Jan 2010)
New Revision: 31076

Added:
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/internal/servicedddLocatorImpl.java
Removed:
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/internal/serviceLocatorImpl.java
Log:
JBRULES-2351 OSGi Ready
-renaming class

Deleted: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/internal/serviceLocatorImpl.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/internal/serviceLocatorImpl.java	2010-01-14 03:13:02 UTC (rev 31075)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/internal/serviceLocatorImpl.java	2010-01-14 03:15:45 UTC (rev 31076)
@@ -1,71 +0,0 @@
-/*
- * 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.drools.util.internal;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.drools.KnowledgeBaseProvider;
-import org.drools.builder.KnowledgeBuilderProvider;
-import org.drools.io.ResourceProvider;
-
-/**
- * This is an internal class, not for public consumption.
- *
- */
-public class serviceLocatorImpl {
-    private static serviceLocatorImpl            instance         = new serviceLocatorImpl();
-
-    private Map<String, Callable<Class< ? >>> serviceFactories = new HashMap<String, Callable<Class< ? >>>();
-
-    public static serviceLocatorImpl getInstance() {
-        return serviceLocatorImpl.instance;
-    }
-    
-    public synchronized void registerLocator(String name, Callable<Class< ? >> cal) {
-        this.serviceFactories.put( name, cal );
-    }
-    
-    public synchronized void unregisterLocator(String name) {
-        this.serviceFactories.remove( name );
-    }
-
-    public synchronized <T> T locate(Class<T> cls) {
-
-        Callable<Class< ? >> cal = this.serviceFactories.get( cls.getName() );
-        if ( cal != null ) {
-            try {
-                return cls.cast( cal.call() );
-            } catch ( Exception e ) {
-                throw new IllegalArgumentException( "Unable to instantiate service for Class '" + (cls != null ? cls.getName() : null) + "'",
-                                                    e );
-            }
-        } else {
-            throw new IllegalArgumentException( "Unable to locate a service for Class '" + (cls != null ? cls.getName() : null) + "'" );
-        }
-    }
-
-    private void init() {
-        serviceFactories.put( KnowledgeBuilderProvider.class.getName(),
-                              null );
-        serviceFactories.put( KnowledgeBaseProvider.class.getName(),
-                              null );
-        serviceFactories.put( ResourceProvider.class.getName(),
-                              null );
-    }
-
-}

Copied: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/internal/servicedddLocatorImpl.java (from rev 31075, labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/internal/serviceLocatorImpl.java)
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/internal/servicedddLocatorImpl.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/internal/servicedddLocatorImpl.java	2010-01-14 03:15:45 UTC (rev 31076)
@@ -0,0 +1,71 @@
+/*
+ * 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.drools.util.internal;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.drools.KnowledgeBaseProvider;
+import org.drools.builder.KnowledgeBuilderProvider;
+import org.drools.io.ResourceProvider;
+
+/**
+ * This is an internal class, not for public consumption.
+ *
+ */
+public class serviceLocatorImpl {
+    private static ServiceLocatorImpl            instance         = new ServiceLocatorImpl();
+
+    private Map<String, Callable<Class< ? >>> serviceFactories = new HashMap<String, Callable<Class< ? >>>();
+
+    public static ServiceLocatorImpl getInstance() {
+        return ServiceLocatorImpl.instance;
+    }
+    
+    public synchronized void registerLocator(String name, Callable<Class< ? >> cal) {
+        this.serviceFactories.put( name, cal );
+    }
+    
+    public synchronized void unregisterLocator(String name) {
+        this.serviceFactories.remove( name );
+    }
+
+    public synchronized <T> T locate(Class<T> cls) {
+
+        Callable<Class< ? >> cal = this.serviceFactories.get( cls.getName() );
+        if ( cal != null ) {
+            try {
+                return cls.cast( cal.call() );
+            } catch ( Exception e ) {
+                throw new IllegalArgumentException( "Unable to instantiate service for Class '" + (cls != null ? cls.getName() : null) + "'",
+                                                    e );
+            }
+        } else {
+            throw new IllegalArgumentException( "Unable to locate a service for Class '" + (cls != null ? cls.getName() : null) + "'" );
+        }
+    }
+
+    private void init() {
+        serviceFactories.put( KnowledgeBuilderProvider.class.getName(),
+                              null );
+        serviceFactories.put( KnowledgeBaseProvider.class.getName(),
+                              null );
+        serviceFactories.put( ResourceProvider.class.getName(),
+                              null );
+    }
+
+}



More information about the jboss-svn-commits mailing list