1 package org.apache.maven.surefire.spi; 2 3 /* 4 * Licensed to the Apache Software Foundation (ASF) under one 5 * or more contributor license agreements. See the NOTICE file 6 * distributed with this work for additional information 7 * regarding copyright ownership. The ASF licenses this file 8 * to you under the Apache License, Version 2.0 (the 9 * "License"); you may not use this file except in compliance 10 * with the License. You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, 15 * software distributed under the License is distributed on an 16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 * KIND, either express or implied. See the License for the 18 * specific language governing permissions and limitations 19 * under the License. 20 */ 21 22 import org.apache.maven.surefire.api.booter.MasterProcessChannelDecoder; 23 import org.apache.maven.surefire.api.booter.MasterProcessChannelEncoder; 24 25 import java.io.Closeable; 26 import java.io.IOException; 27 28 /** 29 * The SPI interface, a factory of an encoder and a decoder. 30 */ 31 public interface MasterProcessChannelProcessorFactory extends Closeable 32 { 33 /** 34 * Evaluates the {@code channelConfig}. 35 * 36 * @param channelConfig a connection string used by the fork JVM 37 * @return {@code true} if {@code channelConfig} is applicable and thus this SPI is eligible in the fork 38 */ 39 boolean canUse( String channelConfig ); 40 41 /** 42 * Open a new connection. 43 * 44 * @param channelConfig e.g. "pipe://3" or "tcp://127.0.0.1:65035" 45 * @throws IOException if cannot connect 46 */ 47 void connect( String channelConfig ) throws IOException; 48 49 /** 50 * Decoder factory method. 51 * 52 * @return a new instance of decoder 53 */ 54 MasterProcessChannelDecoder createDecoder() throws IOException; 55 56 /** 57 * Encoder factory method. 58 * 59 * @return a new instance of encoder 60 */ 61 MasterProcessChannelEncoder createEncoder() throws IOException; 62 }