Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/sun/rmi/rmic/newrmic/equivalence/NotActivatableServerImpl.java
38867 views
/*1* Copyright (c) 2003, 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// RMI Activation Functional Test2425import java.rmi.*;26import java.rmi.activation.*;27import java.rmi.server.*;28import java.util.*;2930// NotActivatableServerImpl3132public class NotActivatableServerImpl33extends UnicastRemoteObject34implements NotActivatableInterface {3536private static final String PROG_NAME = "NotActivatableServerImpl";37private static final String SERVER_OBJECT = "NotActivatableServer";38private static final String CLASS_NAME = "activation.NotActivatableServerImpl";3940private static final String POLICY_FILE = "policy_file";4142private static final String USER_DIR =43System.getProperty("user.dir").replace('\\', '/');4445private static final String CODE_LOCATION = "file:"+USER_DIR+"/";4647private static final MarshalledObject DATA = null;48private static ActivationDesc ACTIVATION_DESC = null;4950public NotActivatableServerImpl() throws RemoteException {}5152public void ping() throws RemoteException {}5354public void exit() throws RemoteException {55System.exit(0);56}5758private static void setup() {5960try {6162NotActivatableInterface rsi; // Remote server interface6364System.setSecurityManager(new RMISecurityManager());6566rsi = (NotActivatableInterface)Activatable.register(ACTIVATION_DESC);67System.out.println("Got stub for "+SERVER_OBJECT+" implementation");6869Naming.rebind(SERVER_OBJECT, rsi);70System.out.println("Exported "+SERVER_OBJECT+" implementation");7172} catch (Exception e) {73System.err.println("Exception: " + e);74e.printStackTrace();75}76}7778public static void main(String[] args) {7980try {81Properties props = new Properties();82props.setProperty("java.security.policy", POLICY_FILE);8384ActivationGroupDesc agd = new ActivationGroupDesc(props, null);8586ActivationGroupID agid = ActivationGroup.getSystem().registerGroup(agd);8788ACTIVATION_DESC = new ActivationDesc(agid,89CLASS_NAME, CODE_LOCATION, DATA, false);90}91catch (Exception e) {92System.err.println("Exception: " + e);93e.printStackTrace();94}9596setup();97}98}99100101