Path: blob/master/test/jdk/com/sun/tools/attach/SimpleProvider.java
41153 views
/*1* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24*25*26* Simple ("no-op") AttachProvider used in unit tests for Attach API.27*/28import com.sun.tools.attach.VirtualMachine;29import com.sun.tools.attach.VirtualMachineDescriptor;30import com.sun.tools.attach.AgentLoadException;31import com.sun.tools.attach.AgentInitializationException;32import com.sun.tools.attach.AttachNotSupportedException;33import com.sun.tools.attach.spi.AttachProvider;3435import java.io.IOException;36import java.util.Properties;37import java.util.List;38import java.util.ArrayList;3940/*41* AttachProvider implementation42*/43public class SimpleProvider extends AttachProvider {44public SimpleProvider() {45}4647public String name() {48return "simple";49}5051public String type() {52return "none";53}5455public VirtualMachine attachVirtualMachine(String id)56throws AttachNotSupportedException, IOException57{58if (!id.startsWith("simple:")) {59throw new AttachNotSupportedException("id not recognized");60}61return new SimpleVirtualMachine(this, id);62}6364public List<VirtualMachineDescriptor> listVirtualMachines() {65return new ArrayList<VirtualMachineDescriptor>();66}67}6869class SimpleVirtualMachine extends VirtualMachine {70public SimpleVirtualMachine(AttachProvider provider, String id) {71super(provider, id);72}7374public void detach() throws IOException {75}7677public void loadAgentLibrary(String agentLibrary, String options)78throws IOException, AgentLoadException, AgentInitializationException79{80}8182public void loadAgentPath(String agentLibrary, String options)83throws IOException, AgentLoadException, AgentInitializationException84{85}8687public void loadAgent(String agentLibrary, String options)88throws IOException, AgentLoadException, AgentInitializationException89{90}9192public Properties getSystemProperties() throws IOException {93return new Properties();94}9596public Properties getAgentProperties() throws IOException {97return new Properties();98}99100public void dataDumpRequest() throws IOException {101}102103public String startLocalManagementAgent() {104return null;105}106107public void startManagementAgent(Properties agentProperties) {108}109110}111112113