cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject [14/16] git commit: Make it easier to use a subclass of ServerImpl to create ManagedEndpoints with specific additional functionality
Date Fri, 04 Apr 2014 15:01:50 GMT
Make it easier to use a subclass of ServerImpl to create ManagedEndpoints with specific additional
functionality


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/b1c1b78b
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/b1c1b78b
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/b1c1b78b

Branch: refs/heads/2.7.x-fixes
Commit: b1c1b78ba892c058073f32a2f151bac7367395fd
Parents: 0e41d57
Author: Daniel Kulp <dkulp@apache.org>
Authored: Thu Apr 3 10:41:18 2014 -0400
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Fri Apr 4 10:06:26 2014 -0400

----------------------------------------------------------------------
 .../apache/cxf/endpoint/ManagedEndpoint.java    |  7 ++--
 .../org/apache/cxf/endpoint/ServerImpl.java     | 40 ++++++--------------
 2 files changed, 15 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/b1c1b78b/api/src/main/java/org/apache/cxf/endpoint/ManagedEndpoint.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/cxf/endpoint/ManagedEndpoint.java b/api/src/main/java/org/apache/cxf/endpoint/ManagedEndpoint.java
index de53e8b..cd8fc28 100644
--- a/api/src/main/java/org/apache/cxf/endpoint/ManagedEndpoint.java
+++ b/api/src/main/java/org/apache/cxf/endpoint/ManagedEndpoint.java
@@ -37,9 +37,10 @@ public class ManagedEndpoint implements ManagedComponent, ServerLifeCycleListene
     public static final String ENDPOINT_NAME = "managed.endpoint.name";
     public static final String SERVICE_NAME = "managed.service.name";
 
-    private Bus bus;
-    private Endpoint endpoint;
-    private Server server;
+    protected final Bus bus;
+    protected final Endpoint endpoint;
+    protected final Server server;
+    
     private enum State { CREATED, STARTED, STOPPED };
     private State state = State.CREATED;
     

http://git-wip-us.apache.org/repos/asf/cxf/blob/b1c1b78b/api/src/main/java/org/apache/cxf/endpoint/ServerImpl.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/cxf/endpoint/ServerImpl.java b/api/src/main/java/org/apache/cxf/endpoint/ServerImpl.java
index fa4f4cf..9d4d7b3 100644
--- a/api/src/main/java/org/apache/cxf/endpoint/ServerImpl.java
+++ b/api/src/main/java/org/apache/cxf/endpoint/ServerImpl.java
@@ -39,31 +39,21 @@ import org.apache.cxf.transport.MultipleEndpointObserver;
 
 public class ServerImpl implements Server {
     private static final Logger LOG = LogUtils.getL7dLogger(ServerImpl.class);    
+
+    protected final Endpoint endpoint;
+    protected final Bus bus;
+    protected final BindingFactory bindingFactory;
+
     private Destination destination;
-    private Endpoint endpoint;
     private ServerRegistry serverRegistry;
-    private Bus bus;
     private ServerLifeCycleManager slcMgr;
     private InstrumentationManager iMgr;
-    private BindingFactory bindingFactory;
-    private MessageObserver messageObserver;
     private ManagedEndpoint mep;
     private boolean stopped = true;
 
     public ServerImpl(Bus bus, 
                       Endpoint endpoint, 
                       DestinationFactory destinationFactory, 
-                      MessageObserver observer) throws BusException, IOException {
-        this.endpoint = endpoint;
-        this.bus = bus;
-        this.messageObserver = observer;
-        
-        initDestination(destinationFactory);
-    }
-    
-    public ServerImpl(Bus bus, 
-                      Endpoint endpoint, 
-                      DestinationFactory destinationFactory, 
                       BindingFactory bindingFactory) throws BusException, IOException {
         this.endpoint = endpoint;
         this.bus = bus;
@@ -94,7 +84,7 @@ public class ServerImpl implements Server {
         LOG.info("Setting the server's publish address to be " + ei.getAddress());
         serverRegistry = bus.getExtension(ServerRegistry.class);
         
-        mep = new ManagedEndpoint(bus, endpoint, this);
+        mep = createManagedEndpoint();
         
         slcMgr = bus.getExtension(ServerLifeCycleManager.class);
         if (slcMgr != null) {
@@ -110,6 +100,10 @@ public class ServerImpl implements Server {
             }
         }
     }
+    
+    protected ManagedEndpoint createManagedEndpoint() {
+        return new ManagedEndpoint(bus, endpoint, this);
+    }
 
     public Destination getDestination() {
         return destination;
@@ -125,11 +119,7 @@ public class ServerImpl implements Server {
         }
         LOG.fine("Server is starting.");
         
-        if (messageObserver != null) {
-            destination.setMessageObserver(messageObserver);
-        } else {
-            bindingFactory.addListener(destination, endpoint);
-        }
+        bindingFactory.addListener(destination, endpoint);
         
         // register the active server to run
         if (null != serverRegistry) {
@@ -201,13 +191,5 @@ public class ServerImpl implements Server {
     public Endpoint getEndpoint() {
         return endpoint;
     }
-
-    public MessageObserver getMessageObserver() {
-        return messageObserver;
-    }
-
-    public void setMessageObserver(MessageObserver messageObserver) {
-        this.messageObserver = messageObserver;
-    }
     
 }


Mime
View raw message