|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| NonceItem.java | - | 100% | 100% | 100% |
|
||||||||||||||
| 1 | /* | |
| 2 | * Copyright 2005 The Regents of the University of Michigan | |
| 3 | * | |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 5 | * you may not use this file except in compliance with the License. | |
| 6 | * You may obtain a copy of the License at | |
| 7 | * | |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 9 | * | |
| 10 | * Unless required by applicable law or agreed to in writing, software | |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | * See the License for the specific language governing permissions and | |
| 14 | * limitations under the License. | |
| 15 | */ | |
| 16 | ||
| 17 | package org.proteomecommons.tranche.server; | |
| 18 | ||
| 19 | import org.proteomecommons.tranche.remote.RemoteUtil; | |
| 20 | import org.proteomecommons.tranche.remote.Token; | |
| 21 | ||
| 22 | /** | |
| 23 | * The ACK item. This lets remote connections be pooled by serving as a way to ask if a connection is still good or not. | |
| 24 | * | |
| 25 | * @author Jayson Falkner - jfalkner@umich.edu | |
| 26 | * @version %I%, %G% | |
| 27 | * @since 1.0 | |
| 28 | */ | |
| 29 | public class NonceItem extends ServerItem { | |
| 30 | /** | |
| 31 | * @param server the server received | |
| 32 | * @since 1.0 | |
| 33 | */ | |
| 34 | 380 | public NonceItem(Server server) { |
| 35 | 380 | super(Token.GET_NONCE_STRING, server); |
| 36 | } | |
| 37 | ||
| 38 | /** | |
| 39 | * @param in the input stream | |
| 40 | * @param out the output stream | |
| 41 | * @throws Exception if any exception occurs | |
| 42 | * @since 1.0 | |
| 43 | */ | |
| 44 | 2856 | public void doAction(java.io.InputStream in, java.io.OutputStream out) throws Exception { |
| 45 | // get a nonce | |
| 46 | 2856 | byte[] nonce = server.dfs.getNonce(); |
| 47 | ||
| 48 | // Log the transaction | |
| 49 | 2856 | server.submitter.logGetNonce(this.clientIP); |
| 50 | ||
| 51 | // write the data | |
| 52 | 2856 | RemoteUtil.writeData(nonce, out); |
| 53 | } | |
| 54 | } |
|
||||||||||