uploadPackFactory = new UploadPackFactory<DaemonClient>() {
public UploadPack create( DaemonClient req,
Repository db )
throws ServiceNotEnabledException,
ServiceNotAuthorizedException {
final UploadPack up = new UploadPack( db );
up.setTimeout( getTimeout() );
final PackConfig config = new PackConfig( db );
config.setCompressionLevel( Deflater.BEST_COMPRESSION );
up.setPackConfig( config );
return up;
}
};
services = new DaemonService[]{ new DaemonService( "upload-pack", "uploadpack" ) {
{
setEnabled( true );
}
@Override
protected void execute( final DaemonClient dc,
final Repository db ) throws IOException,
ServiceNotEnabledException,
ServiceNotAuthorizedException {
UploadPack up = uploadPackFactory.create( dc, db );
InputStream in = dc.getInputStream();
OutputStream out = dc.getOutputStream();
up.upload( in, out, null );
}
} };
}