1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * 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 and 16 * limitations under the License. 17 */ 18 19 package net.jini.lookup; 20 21 import java.rmi.RemoteException; 22 import net.jini.core.event.EventRegistration; 23 import net.jini.core.event.RemoteEventListener; 24 import net.jini.core.lookup.ServiceRegistrar; 25 import net.jini.core.lookup.ServiceTemplate; 26 import net.jini.io.MarshalledInstance; 27 28 /** 29 * ServiceRegistrar that provides safe lookup and notify methods to allow 30 * authentication prior to download and delayed un-marshaling. 31 * 32 * @since 4.0 33 */ 34 public interface SafeServiceRegistrar extends ServiceRegistrar{ 35 /** 36 * Returns an array with a maximum length of maxProxies, containing bootstrap 37 * proxies matching the template with service proxies that are likely to 38 * be compatible with the clients constraints. 39 * Bootstrap proxies returned are instances of RemoteMethodControl, 40 * ServiceProxyAccessor and ServiceAttributesAccessor. The bootstrap proxy 41 * is used as a token to authenticate the service, prior to dynamically 42 * granting permissions, local attribute filtering and ultimately 43 * download of the service proxy codebase and unmarshalling of a service 44 * smart proxy. Only in the case of a smart proxy, will the Bootstrap proxy 45 * implement CodebaseAccessor, which is an optional interface. 46 * 47 * For this method to be secure, the client must use <code> AtomicInputValidation</code>, 48 * <code> ConfidentialityStrength, ConfidentialityStrength#STRONG} </code> and 49 * <code> Integrity </code> 50 * 51 * @param tmpl 52 * @param maxProxies 53 * @return an array of bootstrap proxies, that implement 54 * RemoteMethodControl, ServiceProxyAccessor and ServiceAttributesAccessor 55 * @throws RemoteException 56 * @see net.jini.core.constraint.RemoteMethodControl 57 * @see net.jini.lookup.ServiceProxyAccessor 58 * @see net.jini.lookup.ServiceAttributesAccessor 59 * @see net.jini.export.CodebaseAccessor 60 */ 61 Object [] lookUp(ServiceTemplate tmpl, int maxProxies) throws RemoteException; 62 63 /** 64 * Registers for event notification. The registration is leased; the 65 * lease expiration request is not exact. The registration is persistent 66 * across restarts (crashes) of the lookup service until the lease expires 67 * or is cancelled. The event ID in the returned EventRegistration is 68 * unique at least with respect to all other active event registrations 69 * in this lookup service with different service templates or transitions. 70 * <p> 71 * While the event registration is in effect, a ServiceEvent is sent to 72 * the specified listener whenever a register, lease cancellation or 73 * expiration, or attribute change operation results in an item changing 74 * state in a way that satisfies the template and transition combination. 75 * 76 * @param tmpl template to match 77 * @param transitions bitwise OR of any non-empty set of transition values 78 * @param listener listener to send events to 79 * @param handback object to include in every ServiceEvent generated 80 * @param leaseDuration requested lease duration 81 * @return an EventRegistration object to the entity that registered the 82 * specified remote listener 83 * @throws java.rmi.RemoteException if a connection problem occurs. 84 */ 85 EventRegistration notiFy(ServiceTemplate tmpl, 86 int transitions, 87 RemoteEventListener listener, 88 MarshalledInstance handback, 89 long leaseDuration) throws RemoteException ; 90 }