📄 squawkhost.java
字号:
/* * Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved. * * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is * described in this document. In particular, and without limitation, these intellectual property rights may * include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents * or pending patent applications in the U.S. and in other countries. * * U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. * standard license agreement and applicable provisions of the FAR and its supplements. * * Use is subject to license terms. * * This distribution may include materials developed by third parties. Sun, Sun Microsystems, the Sun logo and * Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries. * * Copyright (c) 2006 Sun Microsystems, Inc. Tous droits r?serv?s. * * Sun Microsystems, Inc. d?tient les droits de propri?t? intellectuels relatifs ? la technologie incorpor?e dans * le produit qui est d?crit dans ce document. En particulier, et ce sans limitation, ces droits de propri?t? * intellectuelle peuvent inclure un ou plus des brevets am?ricains list?s ? l'adresse http://www.sun.com/patents * et un ou les brevets suppl?mentaires ou les applications de brevet en attente aux Etats - Unis et dans les * autres pays. * * L'utilisation est soumise aux termes du contrat de licence. * * Cette distribution peut comprendre des composants d?velopp?s par des tierces parties. * Sun, Sun Microsystems, le logo Sun et Java sont des marques de fabrique ou des marques d?pos?es de Sun * Microsystems, Inc. aux Etats-Unis et dans d'autres pays. */package com.sun.spot.spotworld.participants;//import com.sun.spot.spotworld.gui.RemotePrintHandler;import com.sun.spot.spotworld.virtualobjects.VirtualObject;import java.util.Vector;import org.sunspotworld.remoteprinting.RemotePrintHandler;/** * Proxy for some SquwkVM running out there. Currently only used as a superclass. * * @author taylorr */abstract public class SquawkHost extends VirtualObject { private Vector<RemotePrintHandler> remotePrintHandlers = new Vector<RemotePrintHandler>(); private Vector<String> availableAppsCache; private String address; public String getUniqueID(){ return getAddress(); } /* Available Applications */ public void flushAvailableAppsCache(){ availableAppsCache = null; } public Vector<String> getAvailableApps() { if(availableAppsCache == null){ refillAvailableAppsCache(); } return availableAppsCache; } /* Kind of a hack -- callers of this method should probably not really be * ignoring the package portion of the name */ public Vector<String> getAvailableAppClassNamesOnly() { Vector<String> apps = getAvailableApps(); Vector<String> reply = new Vector<String>(); for(String s : apps){ String[] tokens = s.split("\\."); reply.add(tokens[tokens.length - 1]); } return reply; } /* subclasses must override as appopriate, this is a no-op */ public void refillAvailableAppsCache(){ setAvailableAppsCache(new Vector<String>()); } public void setAvailableAppsCache(Vector<String> v){ availableAppsCache = v; } public String getName(){ return getClass().getSimpleName() + ":" + getAddress(); } abstract public void startApp(String className); public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } /**** access to the remotePrintHandler collection for this device ***/ public void addRemotePrintHandler(RemotePrintHandler rph) { remotePrintHandlers.add(rph); } public void removeRemotePrintHandler(RemotePrintHandler rph) { remotePrintHandlers.remove(rph); } public Vector<RemotePrintHandler> getRemotePrintHandlersCopy(){ return (Vector<RemotePrintHandler>) remotePrintHandlers.clone(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -