You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2009/03/11 16:38:37 UTC
svn commit: r752477 - in
/servicemix/smx4/nmr/trunk/nmr/core/src/main/java/org/apache/servicemix/nmr/core:
DynamicReference.java FilterMatchingReference.java
PropertyMatchingReference.java
Author: gnodet
Date: Wed Mar 11 15:38:37 2009
New Revision: 752477
URL: http://svn.apache.org/viewvc?rev=752477&view=rev
Log:
SMX4NMR-117: Refactor the InternalReference to allow references to be serializable
Modified:
servicemix/smx4/nmr/trunk/nmr/core/src/main/java/org/apache/servicemix/nmr/core/DynamicReference.java
servicemix/smx4/nmr/trunk/nmr/core/src/main/java/org/apache/servicemix/nmr/core/FilterMatchingReference.java
servicemix/smx4/nmr/trunk/nmr/core/src/main/java/org/apache/servicemix/nmr/core/PropertyMatchingReference.java
Modified: servicemix/smx4/nmr/trunk/nmr/core/src/main/java/org/apache/servicemix/nmr/core/DynamicReference.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/nmr/core/src/main/java/org/apache/servicemix/nmr/core/DynamicReference.java?rev=752477&r1=752476&r2=752477&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/nmr/core/src/main/java/org/apache/servicemix/nmr/core/DynamicReference.java (original)
+++ servicemix/smx4/nmr/trunk/nmr/core/src/main/java/org/apache/servicemix/nmr/core/DynamicReference.java Wed Mar 11 15:38:37 2009
@@ -18,6 +18,7 @@
*/
package org.apache.servicemix.nmr.core;
+import java.util.ArrayList;
import java.util.List;
import org.w3c.dom.Document;
@@ -49,6 +50,7 @@
public synchronized Iterable<InternalEndpoint> choose(EndpointRegistry registry) {
List<InternalEndpoint> result = matches;
if (result == null || this.registry != registry) {
+ result = new ArrayList<InternalEndpoint>();
for (Endpoint ep : registry.query(null)) {
InternalEndpoint iep = (InternalEndpoint) ep;
if (filter.match(iep)) {
Modified: servicemix/smx4/nmr/trunk/nmr/core/src/main/java/org/apache/servicemix/nmr/core/FilterMatchingReference.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/nmr/core/src/main/java/org/apache/servicemix/nmr/core/FilterMatchingReference.java?rev=752477&r1=752476&r2=752477&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/nmr/core/src/main/java/org/apache/servicemix/nmr/core/FilterMatchingReference.java (original)
+++ servicemix/smx4/nmr/trunk/nmr/core/src/main/java/org/apache/servicemix/nmr/core/FilterMatchingReference.java Wed Mar 11 15:38:37 2009
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.servicemix.nmr.core;
import java.util.ArrayList;
@@ -15,11 +31,7 @@
import org.osgi.framework.InvalidSyntaxException;
/**
- * Created by IntelliJ IDEA.
- * User: gnodet
- * Date: Mar 10, 2009
- * Time: 6:07:57 PM
- * To change this template use File | Settings | File Templates.
+ * A Reference using an LDAP filter for matching endpoints
*/
public class FilterMatchingReference implements CacheableReference, Serializable {
Modified: servicemix/smx4/nmr/trunk/nmr/core/src/main/java/org/apache/servicemix/nmr/core/PropertyMatchingReference.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/nmr/core/src/main/java/org/apache/servicemix/nmr/core/PropertyMatchingReference.java?rev=752477&r1=752476&r2=752477&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/nmr/core/src/main/java/org/apache/servicemix/nmr/core/PropertyMatchingReference.java (original)
+++ servicemix/smx4/nmr/trunk/nmr/core/src/main/java/org/apache/servicemix/nmr/core/PropertyMatchingReference.java Wed Mar 11 15:38:37 2009
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.servicemix.nmr.core;
import java.io.Serializable;
@@ -12,11 +28,7 @@
import org.apache.servicemix.nmr.api.internal.InternalEndpoint;
/**
- * Created by IntelliJ IDEA.
- * User: gnodet
- * Date: Mar 10, 2009
- * Time: 5:57:14 PM
- * To change this template use File | Settings | File Templates.
+ * A Reference using an map of properties for matching endpoints
*/
public class PropertyMatchingReference implements CacheableReference, Serializable {
@@ -29,18 +41,19 @@
}
public Iterable<InternalEndpoint> choose(EndpointRegistry registry) {
+ List<InternalEndpoint> result = matches;
if (this.matches == null || this.registry != registry) {
- List<InternalEndpoint> eps = new ArrayList<InternalEndpoint>();
+ result = new ArrayList<InternalEndpoint>();
for (Endpoint ep : registry.query(null)) {
InternalEndpoint iep = (InternalEndpoint) ep;
if (match(registry, iep)) {
- eps.add(iep);
+ result.add(iep);
}
}
this.registry = registry;
- this.matches = eps;
+ this.matches = result;
}
- return matches;
+ return result;
}
protected boolean match(EndpointRegistry registry, InternalEndpoint endpoint) {