Changeset 1179
- Timestamp:
- 10/26/11 23:08:07 (20 months ago)
- Location:
- raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua
- Files:
-
- 3 edited
-
server/RunServer.java (modified) (2 diffs)
-
service/impl/MUAProcessImpl.java (modified) (2 diffs)
-
wsinterface/impl/MultiUnitAggregatorImpl.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/server/RunServer.java
r1030 r1179 14 14 * limitations under the License. 15 15 */ 16 16 17 package uk.ac.cardiff.raptormua.server; 17 18 18 import java.io.File;19 19 import java.io.FileInputStream; 20 20 import java.io.FileNotFoundException; 21 21 import java.io.IOException; 22 import java.net.URL;23 import java.security.ProtectionDomain;24 22 import java.util.Properties; 25 23 import java.util.TimeZone; 26 24 27 import javax.xml.ws.Endpoint;28 29 import org.apache.cxf.Bus;30 import org.apache.cxf.BusFactory;31 import org.apache.cxf.transport.servlet.CXFServlet;32 25 import org.mortbay.jetty.Connector; 33 26 import org.mortbay.jetty.Handler; 34 27 import org.mortbay.jetty.Server; 35 import org.mortbay.jetty.bio.SocketConnector;36 import org.mortbay.jetty.handler.ContextHandlerCollection;37 28 import org.mortbay.jetty.handler.DefaultHandler; 38 29 import org.mortbay.jetty.handler.HandlerCollection; 39 import org.mortbay.jetty.nio.SelectChannelConnector;40 30 import org.mortbay.jetty.security.SslSocketConnector; 41 import org.mortbay.jetty.servlet.Context;42 import org.mortbay.jetty.servlet.ServletHolder;43 31 import org.mortbay.jetty.webapp.WebAppContext; 44 import org.mortbay.log.Log;45 32 import org.slf4j.LoggerFactory; 46 import org.springframework.context.support.ClassPathXmlApplicationContext;47 import org.springframework.context.support.FileSystemXmlApplicationContext;48 import org.springframework.web.servlet.DispatcherServlet;49 33 50 34 import ch.qos.logback.classic.LoggerContext; … … 53 37 import ch.qos.logback.core.util.StatusPrinter; 54 38 55 import uk.ac.cardiff.raptor.remoting.server.sei.MultiUnitAggregator;56 import uk.ac.cardiff.raptormua.wsinterface.impl.MultiUnitAggregatorImpl;57 58 39 public class RunServer { 59 40 60 /**61 * Programmatically do the following: 62 * 1. Set the Apache CXF logger to use SLF4J 63 * 2. Configure the logback logger 64 * 3. Start a Jetty Server instance including trust and key stores, and set the web.xml in the configuration directory to initialise the servlet. 65 * 66 * @param args 67 * @throws IOException68 * @throws FileNotFoundException69 * @throws Exception 70 */ 71 public static void main(String args[]) throws FileNotFoundException, IOException { 72 System.setProperty("org.apache.cxf.Logger", "org.apache.cxf.common.logging.Slf4jLogger");73 TimeZone.setDefault(TimeZone.getTimeZone("Etc/UTC")); 74 String configurationFiles =System.getProperty("configurationFiles", System.getProperty("user.dir") + "/target/conf");41 /** 42 * Programmatically do the following: 1. Set the Apache CXF logger to use SLF4J 2. Configure the logback logger 3. 43 * Start a Jetty Server instance including trust and key stores, and set the web.xml in the configuration directory 44 * to initialise the servlet. 45 * 46 * @param args 47 * @throws IOException 48 * @throws FileNotFoundException 49 * @throws Exception 50 */ 51 public static void main(String args[]) throws FileNotFoundException, IOException { 52 System.setProperty("org.apache.cxf.Logger", "org.apache.cxf.common.logging.Slf4jLogger"); 53 TimeZone.setDefault(TimeZone.getTimeZone("Etc/UTC")); 54 String configurationFiles = 55 System.getProperty("configurationFiles", System.getProperty("user.dir") + "/target/conf"); 75 56 76 configureLogger(configurationFiles+"/logging.xml");57 configureLogger(configurationFiles + "/logging.xml"); 77 58 78 Properties props = new Properties();79 props.load(new FileInputStream(configurationFiles + "/server.properties"));59 Properties props = new Properties(); 60 props.load(new FileInputStream(configurationFiles + "/server.properties")); 80 61 81 int portNumber = Integer.parseInt(props.getProperty("jetty.port", "8443"));82 String keyStoreLocaion = props.getProperty("jetty.keyStoreLocation", "");83 String keyStorePassword = props.getProperty("jetty.keyStorePassword", "changeit");84 String trustStoreLocaion = props.getProperty("jetty.trustStoreLocation", "");85 String trustStorePassword = props.getProperty("jetty.trustStorePassword", "changeit");86 String webappContextPath = props.getProperty("jetty.webapp.contextPath", "/MUA");62 int portNumber = Integer.parseInt(props.getProperty("jetty.port", "8443")); 63 String keyStoreLocaion = props.getProperty("jetty.keyStoreLocation", ""); 64 String keyStorePassword = props.getProperty("jetty.keyStorePassword", "changeit"); 65 String trustStoreLocaion = props.getProperty("jetty.trustStoreLocation", ""); 66 String trustStorePassword = props.getProperty("jetty.trustStorePassword", "changeit"); 67 String webappContextPath = props.getProperty("jetty.webapp.contextPath", "/MUA"); 87 68 69 System.out.println("[INFO] Jetty Config: Using Port " + portNumber); 70 System.out.println("[INFO] Servlet and Spring Config: Configuration files at " + configurationFiles); 88 71 89 System.out.println("[INFO] Jetty Config: Using Port " + portNumber); 90 System.out.println("[INFO] Servlet and Spring Config: Configuration files at " + configurationFiles); 72 Server server = new Server(); 91 73 92 Server server = new Server(); 74 SslSocketConnector sslConnector = new SslSocketConnector(); 75 sslConnector.setPort(portNumber); 76 sslConnector.setMaxIdleTime(30000); 77 sslConnector.setKeystore(keyStoreLocaion); 78 sslConnector.setPassword(keyStorePassword); 79 sslConnector.setKeyPassword(keyStorePassword); 80 sslConnector.setTruststore(trustStoreLocaion); 81 sslConnector.setTrustPassword(trustStorePassword); 93 82 94 SslSocketConnector sslConnector = new SslSocketConnector(); 95 sslConnector.setPort(portNumber); 96 sslConnector.setMaxIdleTime(30000); 97 sslConnector.setKeystore(keyStoreLocaion); 98 sslConnector.setPassword(keyStorePassword); 99 sslConnector.setKeyPassword(keyStorePassword); 100 sslConnector.setTruststore(trustStoreLocaion); 101 sslConnector.setTrustPassword(trustStorePassword); 102 103 //SocketConnector connector = new SocketConnector(); 104 //connector.setPort(portNumber); 83 // SocketConnector connector = new SocketConnector(); 84 // connector.setPort(portNumber); 105 85 106 // enable mutual authentication107 //sslConnector.setNeedClientAuth(true);86 // enable mutual authentication 87 sslConnector.setNeedClientAuth(true); 108 88 109 server.setConnectors(new Connector[] { sslConnector});89 server.setConnectors(new Connector[] {sslConnector}); 110 90 111 WebAppContext webappcontext = new WebAppContext();112 webappcontext.setDescriptor(configurationFiles + "/web.xml");113 webappcontext.setContextPath(webappContextPath);114 webappcontext.setWar(configurationFiles);91 WebAppContext webappcontext = new WebAppContext(); 92 webappcontext.setDescriptor(configurationFiles + "/web.xml"); 93 webappcontext.setContextPath(webappContextPath); 94 webappcontext.setWar(configurationFiles); 115 95 116 HandlerCollection handlers = new HandlerCollection();117 handlers.setHandlers(new Handler[] { webappcontext, new DefaultHandler()});96 HandlerCollection handlers = new HandlerCollection(); 97 handlers.setHandlers(new Handler[] {webappcontext, new DefaultHandler()}); 118 98 119 server.setHandler(handlers);99 server.setHandler(handlers); 120 100 121 try {122 server.start();123 server.join();124 } catch (Exception e) {125 e.printStackTrace();126 System.exit(100);127 }101 try { 102 server.start(); 103 server.join(); 104 } catch (Exception e) { 105 e.printStackTrace(); 106 System.exit(100); 107 } 128 108 129 }109 } 130 110 131 private static void configureLogger(String logback) {132 LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();111 private static void configureLogger(String logback) { 112 LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory(); 133 113 134 try {135 JoranConfigurator configurator = new JoranConfigurator();136 configurator.setContext(lc);137 lc.reset();138 configurator.doConfigure(logback);139 } catch (JoranException je) {140 // StatusPrinter will handle thiss141 }142 StatusPrinter.print(lc);114 try { 115 JoranConfigurator configurator = new JoranConfigurator(); 116 configurator.setContext(lc); 117 lc.reset(); 118 configurator.doConfigure(logback); 119 } catch (JoranException je) { 120 // StatusPrinter will handle thiss 121 } 122 StatusPrinter.print(lc); 143 123 144 }124 } 145 125 146 126 } -
raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/service/impl/MUAProcessImpl.java
r1082 r1179 48 48 * All operations should go through this service class, so as to obey locks and synchronisation issues. Locks collisions 49 49 * are thrown use a <code>SoapFault</code> . Fault codes are: Client (if a malformed input e.g. statistic name is wrong) 50 * Server (we use for locks, as server side issue) VersionMismatch MustUnderstand50 * Server (we use if a lock is hit, as a server side issue). 51 51 * 52 52 * @author philsmart … … 91 91 try { 92 92 engine.release(); 93 94 93 } catch (Exception e) { 95 94 log.error("Error trying to release events {}", e.getMessage()); -
raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/wsinterface/impl/MultiUnitAggregatorImpl.java
r1080 r1179 46 46 public class MultiUnitAggregatorImpl implements MultiUnitAggregator { 47 47 48 /** The process service. */48 /** The mua process service. */ 49 49 private MUAProcess processService; 50 50 … … 82 82 */ 83 83 public Capabilities getCapabilities() { 84 // TODO Auto-generated method stub85 84 return processService.getCapabilities(); 86 85 }
Note: See TracChangeset
for help on using the changeset viewer.
