1/*2 * Licensed to the Apache Software Foundation (ASF) under one3 * or more contributor license agreements. See the NOTICE file4 * distributed with this work for additional information5 * regarding copyright ownership. The ASF licenses this file6 * to you under the Apache License, Version 2.0 (the7 * "License"); you may not use this file except in compliance8 * with the License. You may obtain a copy of the License at9 *10 * http://www.apache.org/licenses/LICENSE-2.011 *12 * Unless required by applicable law or agreed to in writing, software13 * distributed under the License is distributed on an "AS IS" BASIS,14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.15 * See the License for the specific language governing permissions and16 * limitations under the License.17 */18package org.apache.hadoop.chukwa.datacollection.adaptor;
1920import org.apache.hadoop.chukwa.datacollection.ChunkReceiver;
21import org.apache.hadoop.chukwa.datacollection.agent.AdaptorManager;
2223publicabstractclassAbstractAdaptorimplementsAdaptor {
242526protected String type;
27protectedChunkReceiver dest;
28protected String adaptorID;
29protectedAdaptorManager control;
3031 @Override
32publicfinal String getType() {
33return type;
34 }
3536 @Override
37publicfinalvoid start(String adaptorID, String type, long offset,
38ChunkReceiver dest) throws AdaptorException {
39this.adaptorID = adaptorID;
40this.type = type;
41this.dest=dest;
42 start(offset);
43 }
4445publicabstractvoid start(long offset) throws AdaptorException;
46publicabstract String parseArgs(String s);
4748publicvoid deregisterAndStop() {
49 control.stopAdaptor(adaptorID, AdaptorShutdownPolicy.HARD_STOP);
50 }
5152public String parseArgs(String d, String s, AdaptorManager c) {
53 control = c;
54return parseArgs(s);
55 }
56575859 @Deprecated
60publicvoid hardStop() throws AdaptorException {
61 shutdown(AdaptorShutdownPolicy.HARD_STOP);
62 }
6364 @Deprecated
65publiclong shutdown() throws AdaptorException {
66return shutdown(AdaptorShutdownPolicy.GRACEFULLY);
67 }
6869 }