You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@river.apache.org by ni...@apache.org on 2008/12/10 06:20:55 UTC
svn commit: r724992 [3/5] - in /incubator/river/jtsk/skunk/niclas1/core-api:
./ src/ src/main/ src/main/java/ src/main/java/com/ src/main/java/com/sun/
src/main/java/com/sun/jini/ src/main/java/com/sun/jini/constants/
src/main/java/net/ src/main/java/n...
Added: incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/constraint/ServerAuthentication.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/constraint/ServerAuthentication.java?rev=724992&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/constraint/ServerAuthentication.java (added)
+++ incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/constraint/ServerAuthentication.java Tue Dec 9 21:20:53 2008
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.jini.core.constraint;
+
+import java.io.Serializable;
+
+/**
+ * Represents a constraint on authentication of the server to the client.
+ * <p>
+ * Network authentication by a server (to a client) is implementation-specific,
+ * but typically is also scoped and controlled by a <code>Subject</code>. The
+ * server subject normally is contained in the
+ * {@link net.jini.export.Exporter} used to export that remote
+ * object and is taken from the current thread when the exporter is
+ * constructed. However, a server might use one subject to control its local
+ * execution and a different subject to control its network authentication.
+ * A server generally must have permission (such as
+ * {@link net.jini.security.AuthenticationPermission}) to authenticate itself
+ * to clients.
+ * <p>
+ * It is important to understand that specifying
+ * <code>ServerAuthentication.YES</code> as a requirement <i>does not</i>
+ * ensure that a server is to be trusted; it <i>does</i> ensure that the
+ * server authenticates itself as someone, but it does not ensure that the
+ * server authenticates itself as anyone in particular. Without knowing who
+ * the server authenticated itself as, there is no basis for actually
+ * trusting the server. The client generally needs to specify a
+ * {@link ServerMinPrincipal} requirement in addition, or else verify
+ * that the server has specified a satisfactory
+ * <code>ServerMinPrincipal</code> requirement for each of the methods that
+ * the client cares about.
+ * <p>
+ * Serialization for this class is guaranteed to produce instances that are
+ * comparable with <code>==</code>.
+ *
+ * @author Sun Microsystems, Inc.
+ * @see ServerMinPrincipal
+ * @see net.jini.security.AuthenticationPermission
+ * @since 2.0
+ */
+public final class ServerAuthentication
+ implements InvocationConstraint, Serializable
+{
+ private static final long serialVersionUID = 2837982503744131014L;
+
+ /**
+ * Authenticate the server to the client. The mechanisms and credentials
+ * used to authenticate the server are not specified by this constraint.
+ */
+ public static final ServerAuthentication YES =
+ new ServerAuthentication( true );
+ /**
+ * Do not authenticate the server to the client, so that the server
+ * remains anonymous.
+ */
+ public static final ServerAuthentication NO =
+ new ServerAuthentication( false );
+
+ /**
+ * <code>true</code> for <code>YES</code>, <code>false</code> for
+ * <code>NO</code>
+ *
+ * @serial
+ */
+ private final boolean val;
+
+ /**
+ * Simple constructor.
+ *
+ * @param val <code>true</code> for <code>YES</code>, <code>false</code>
+ * for <code>NO</code>
+ */
+ private ServerAuthentication( boolean val )
+ {
+ this.val = val;
+ }
+
+ /**
+ * Returns a string representation of this object.
+ */
+ public String toString()
+ {
+ return val ? "ServerAuthentication.YES" : "ServerAuthentication.NO";
+ }
+
+ /**
+ * Canonicalize so that <code>==</code> can be used.
+ */
+ private Object readResolve()
+ {
+ return val ? YES : NO;
+ }
+}
Added: incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/constraint/ServerMinPrincipal.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/constraint/ServerMinPrincipal.java?rev=724992&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/constraint/ServerMinPrincipal.java (added)
+++ incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/constraint/ServerMinPrincipal.java Tue Dec 9 21:20:53 2008
@@ -0,0 +1,188 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.jini.core.constraint;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectStreamField;
+import java.io.Serializable;
+import java.security.Principal;
+import java.util.Collection;
+import java.util.Set;
+
+/**
+ * Represents a constraint on the server, such that if the server
+ * authenticates itself, then it must authenticate itself as at least all of
+ * the specified principals. The mechanisms and credentials used to
+ * authenticate the server as those principals are not specified by this
+ * constraint.
+ * <p>
+ * The use of an instance of this class does not imply directly a
+ * {@link ServerAuthentication#YES} constraint; that must be specified
+ * separately to ensure that the server actually authenticates itself.
+ * Because this constraint is conditional on server authentication, it does
+ * not conflict with {@link ServerAuthentication#NO}.
+ * <p>
+ * It is important to understand that specifying
+ * <code>ServerAuthentication.YES</code> as a requirement <i>does not</i>
+ * ensure that a server is to be trusted; it <i>does</i> ensure that the
+ * server authenticates itself as someone, but it does not ensure that the
+ * server authenticates itself as anyone in particular. Without knowing who
+ * the server authenticated itself as, there is no basis for actually
+ * trusting the server. The client generally needs to specify a
+ * <code>ServerMinPrincipal</code> requirement in addition, or else verify
+ * that the server has specified a satisfactory
+ * <code>ServerMinPrincipal</code> requirement for each of the methods that
+ * the client cares about.
+ *
+ * @author Sun Microsystems, Inc.
+ * @see ServerAuthentication
+ * @see net.jini.security.AuthenticationPermission
+ * @since 2.0
+ */
+public final class ServerMinPrincipal
+ implements InvocationConstraint, Serializable
+{
+ private static final long serialVersionUID = 6082629466615675811L;
+
+ /**
+ * @serialField principals Principal[] The principals.
+ */
+ private static final ObjectStreamField[] serialPersistentFields = {
+ new ObjectStreamField( "principals", Principal[].class, true )
+ };
+
+ /**
+ * The principals.
+ */
+ private final Principal[] principals;
+
+ /**
+ * Creates a constraint containing the specified principal. This
+ * constructor is equivalent to calling a constructor with a
+ * single-element array containing the specified principal.
+ *
+ * @param p the principal
+ * @throws NullPointerException if the argument is <code>null</code>
+ */
+ public ServerMinPrincipal( Principal p )
+ {
+ if( p == null )
+ {
+ throw new NullPointerException( "principal cannot be null" );
+ }
+ principals = new Principal[]{ p };
+ }
+
+ /**
+ * Creates a constraint containing the specified principals, with
+ * duplicates removed. The argument passed to the constructor is neither
+ * modified nor retained; subsequent changes to that argument have no
+ * effect on the instance created.
+ *
+ * @param principals the principals
+ * @throws NullPointerException if the argument is <code>null</code> or
+ * any element is <code>null</code>
+ * @throws IllegalArgumentException if the argument is empty
+ */
+ public ServerMinPrincipal( Principal[] principals )
+ {
+ this.principals = Constraint.reduce( principals );
+ }
+
+ /**
+ * Creates a constraint containing the specified principals, with
+ * duplicates removed. The argument passed to the constructor is neither
+ * modified nor retained; subsequent changes to that argument have no
+ * effect on the instance created.
+ *
+ * @param c the principals
+ * @throws NullPointerException if the argument is <code>null</code> or
+ * any element is <code>null</code>
+ * @throws IllegalArgumentException if the argument is empty or the
+ * elements do not all implement the <code>Principal</code> interface
+ */
+ public ServerMinPrincipal( Collection c )
+ {
+ principals = Constraint.reduce( c );
+ }
+
+ /**
+ * Returns an immutable set of all of the principals. Any attempt to modify
+ * the set results in an {@link UnsupportedOperationException} being
+ * thrown.
+ *
+ * @return an immutable set of all of the principals
+ */
+ public Set elements()
+ {
+ return new ArraySet( principals );
+ }
+
+ /**
+ * Returns the principals, without copying.
+ */
+ Principal[] getPrincipals()
+ {
+ return principals;
+ }
+
+ /**
+ * Returns a hash code value for this object.
+ */
+ public int hashCode()
+ {
+ return ( ServerMinPrincipal.class.hashCode() +
+ Constraint.hash( principals ) );
+ }
+
+ /**
+ * Two instances of this class are equal if they have the same principals
+ * (ignoring order).
+ */
+ public boolean equals( Object obj )
+ {
+ return ( obj instanceof ServerMinPrincipal &&
+ Constraint.equal( principals,
+ ( (ServerMinPrincipal) obj ).principals ) );
+ }
+
+ /**
+ * Returns a string representation of this object.
+ */
+ public String toString()
+ {
+ return "ServerMinPrincipal" + Constraint.toString( principals );
+ }
+
+ /**
+ * Verifies that there is at least one principal, that none of the
+ * principals is <code>null</code>, and that there are no duplicates.
+ *
+ * @throws java.io.InvalidObjectException if there are no principals,
+ * or any principal is <code>null</code>, or if there are duplicate
+ * principals
+ */
+ private void readObject( ObjectInputStream s )
+ throws IOException, ClassNotFoundException
+ {
+ s.defaultReadObject();
+ Constraint.verify( principals );
+ }
+}
Added: incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/constraint/package.html
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/constraint/package.html?rev=724992&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/constraint/package.html (added)
+++ incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/constraint/package.html Tue Dec 9 21:20:53 2008
@@ -0,0 +1,215 @@
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements. See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership. The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License. You may obtain a copy of the License at
+ !
+ ! http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing, software
+ ! distributed under the License is distributed on an "AS IS" BASIS,
+ ! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ! See the License for the specific language governing permissions and
+ ! limitations under the License.
+ !-->
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+
+
+</head>
+<body bgcolor="white">
+
+Defines constraints and collections of constraints that can be used to control
+method invocation, and an interface that proxies implement to allow clients
+to specify constraints for remote method calls. Clients control remote calls
+using <a href="#constraints">constraints</a>. The client attaches the
+constraints to a proxy by calling a method on the
+<a href="#remote_control"><code>RemoteMethodControl</code> interface</a>
+implemented by the proxy. At each remote call through a proxy, the proxy
+implementation is responsible for using communication mechanisms that satisfy
+the client's constraints. If the constraints cannot be satisfied, the proxy
+throws a {@link java.rmi.ConnectIOException}.
+
+<a name="constraints"></a>
+
+<h2>Invocation Constraints</h2>
+
+All constraint classes implement the
+{@link net.jini.core.constraint.InvocationConstraint} interface.
+The constraint mechanism is designed to be extensible; the constraint classes
+defined in this package should be adequate for many applications, but
+additional constraint classes, either generic in nature or specific to a
+particular mechanism or service, can be defined as necessary. By design, the
+constraints defined in this package express <i>what</i> control is desired,
+not <i>how</i> that control should be achieved; the constraints are not tied
+to specific algorithms, mechanisms, or protocols. Although most of the
+constraints defined in this package are related to trust mechanisms, it is
+intended and expected that a wide variety of constraints will be defined,
+particularly in the area of quality of service.
+<p>
+ The basic trust-related constraints are very simple:
+<ul>
+ <li>{@link net.jini.core.constraint.Integrity} - to make sure
+ that the messages and objects (not just data, but also downloaded code) sent
+ over the network are not tampered with by third parties
+ <li>{@link net.jini.core.constraint.ServerAuthentication} - to
+ prove to the client that the server is executing on behalf of some subject, so
+ that the call can be terminated if the subject is not trusted by the client.
+ The flip side of this is anonymity: to allow a server to remain anonymous when
+ it wants to be.
+ <li>{@link net.jini.core.constraint.ClientAuthentication} - to
+ prove to the server that the client is executing on behalf of some subject, so
+ that the server can perform only those tasks for which the subject is
+ authorized. The flip side of this is anonymity: to allow a client to remain
+ anonymous when it wants to be.
+ <li><a name="delegation"</a>
+ {@link net.jini.core.constraint.Delegation} - to allow the
+ server to authenticate as the client in remote calls made and received by the
+ server, to allow the server to act on a client's behalf when dealing with third
+ parties, in cases where the identity of the client (not the server) is what
+ matters to those parties.
+</ul>
+<p>
+ There are also constraints to control which principals of a client or server
+ subject must be authenticated, and which principals of a client are permitted
+ to be authenticated:
+<ul>
+ <li>{@link net.jini.core.constraint.ClientMinPrincipal} - to
+ require a client to authenticate as at least some specific principals
+ <li>{@link net.jini.core.constraint.ClientMaxPrincipal} - to
+ require a client to authenticate as at most some specific principals
+ <li>{@link net.jini.core.constraint.ClientMinPrincipalType} - to
+ require a client to authenticate as at least some specific types of principals
+ <li>{@link net.jini.core.constraint.ClientMaxPrincipalType} - to
+ require a client to authenticate as at most some specific types of principals
+ <li>{@link net.jini.core.constraint.ServerMinPrincipal} - to
+ require a server to authenticate as at least some specific principals
+</ul>
+<p>
+ (There is no <code>ServerMaxPrincipal</code> constraint; a client
+ should not need to impose such a maximum, and a server can impose a maximum
+ by limiting the contents of the subject it uses for network authentication.)
+
+<p>
+ There are also constraints to control the time during which a server is
+ permitted to exercise delegation:
+<ul>
+ <li>{@link net.jini.core.constraint.DelegationAbsoluteTime} - to
+ specify a range of absolute times
+ <li>{@link net.jini.core.constraint.DelegationRelativeTime} - to
+ specify a range of times relative to the start of the remote call
+</ul>
+Other constraints defined in this package are:
+<ul>
+ <li>{@link net.jini.core.constraint.ConnectionRelativeTime} -
+ to control the maximum amount of time to wait for a network connection to be
+ established
+ <li>{@link net.jini.core.constraint.ConnectionAbsoluteTime} -
+ to control the maximum absolute time by which a network connection must be
+ established
+ <li>{@link net.jini.core.constraint.Confidentiality} - to make
+ sure that the data sent over the network cannot be interpreted by third parties
+</ul>
+<p>
+ There are no explicit <i>don't care</i> constraints; a <i>don't care</i>
+ condition is expressed by the <i>absence</i> of constraints.
+
+<p>
+ Constraints can be combined using
+ {@link net.jini.core.constraint.ConstraintAlternatives} to
+ express alternatives, such that at least one of the individual constraints
+ must be satisfied (but not all have to be satisfied) for the aggregate
+ constraint to be satisfied.
+
+<p>
+ {@link net.jini.core.constraint.InvocationConstraints}
+ aggregates constraints into a set of requirements and a set of preferences. A
+ requirement is a mandatory constraint that must be satisfied. A preference is
+ a desired constraint, to be satisfied if possible, but it will not be
+ satisfied if it conflicts with a requirement. If two preferences conflict,
+ it is arbitrary as to which one will be satisfied. If a constraint is not
+ understood, due to lack of knowledge of the type of the constraint or the
+ contents of the constraint, then the constraint cannot be satisfied.
+
+<p>
+ Finally, {@link net.jini.core.constraint.MethodConstraints}
+ defines a mapping from {@link java.lang.reflect.Method} to
+ <code>InvocationConstraints</code>, allowing different constraints to be
+ specified for different methods. For example, a client might require client
+ authentication for write operations but not for read operations, or a client
+ might care about the confidentiality of some remote calls but not others.
+
+<p>
+ Although the emphasis in this discussion has been on how clients use
+ constraints, constraints typically are also used by servers to specify their
+ minimum requirements for remote calls. When a remote object is exported, the
+ server's constraints normally are copied from the exporter into the returned
+ proxy, so that the proxy knows the minimum constraints required to communicate
+ with the server. Note that constraints are not used to specify server-side
+ authorization (access control) policy.
+
+ <a name="remote_control"></a>
+
+<h2><code>RemoteMethodControl</code> interface</h2>
+
+Proxies implement the
+{@link net.jini.core.constraint.RemoteMethodControl} interface
+to allow clients to impose constraints on remote calls. If a proxy implements
+this interface, then the semantics of this interface apply to all calls
+through all remote methods defined by the proxy; there is no mechanism to
+exempt remote methods or remote interfaces from these semantics.
+<p>
+ Constraints for a remote call come from two sources:
+<ul>
+ <li>Client constraints placed on a proxy
+ <li>Constraints imposed by the server (including any minimum constraints
+ imposed by the communication mechanism used between the proxy and server)
+</ul>
+The client constraints placed on a proxy are specified with a
+<code>MethodConstraints</code> instance, so the client can specify different
+constraints for each remote method. Client constraints placed directly on a
+proxy apply to all remote calls made through that particular proxy by any
+thread. The server constraints are controlled by the proxy implementation;
+they are not exposed to the client, and might vary in ways unknown to the
+client (for example, vary by method or over time). The client should set the
+constraints it wants rather than assuming that the server imposes particular
+constraints.
+<p>
+ A remote call will be performed only if the combined requirements (from both
+ sources) can be satisfied. If the requirements cannot be satisfied, the proxy
+ throws a {@link java.rmi.ConnectIOException}, typically containing (but not
+ required to contain) a nested
+ {@link net.jini.io.UnsupportedConstraintException}. In addition
+ to the requirements, both client and server preferences will be satisfied, to
+ the extent possible. Note that it is possible to specify conflicting
+ constraints, meaning they cannot be simultaneously satisfied. Preferences that
+ conflict with requirements are ignored, and if preferences conflict with each
+ other it is arbitrary as to which (if any) are satisfied, but if there are
+ conflicting requirements the remote call will not be made.
+
+ @since 2.0
+ @version 2.0
+
+ <!--
+ <h2>Package Specification</h2>
+
+ ##### FILL IN ANY SPECS NEEDED BY JAVA COMPATIBILITY KIT #####
+ <ul>
+ <li><a href="">##### REFER TO ANY FRAMEMAKER SPECIFICATION HERE #####</a>
+ </ul>
+
+ <h2>Related Documentation</h2>
+
+ For overviews, tutorials, examples, guides, and tool documentation, please see:
+ <ul>
+ <li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a>
+ </ul>
+ -->
+
+</body>
+</html>
Added: incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/entry/Entry.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/entry/Entry.java?rev=724992&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/entry/Entry.java (added)
+++ incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/entry/Entry.java Tue Dec 9 21:20:53 2008
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.jini.core.entry;
+
+/**
+ * This class is the supertype of all entries that can be stored in a
+ * Jini Lookup service.
+ * <p>
+ * Each field of an entry must be a public reference (object) type.
+ * You cannot store primitive types in fields of an
+ * <code>Entry</code>. An <code>Entry</code> may have any number of
+ * methods or constructors. Each field is serialized separately, so
+ * references between two fields of an entry will not be reconstituted
+ * to be shared references, but instead to separate copies of the
+ * original object.
+ *
+ * @author Sun Microsystems, Inc.
+ * @see net.jini.core.lookup.ServiceRegistrar
+ * @since 1.0
+ */
+public interface Entry extends java.io.Serializable
+{
+}
Added: incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/entry/UnusableEntryException.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/entry/UnusableEntryException.java?rev=724992&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/entry/UnusableEntryException.java (added)
+++ incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/entry/UnusableEntryException.java Tue Dec 9 21:20:53 2008
@@ -0,0 +1,324 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.jini.core.entry;
+
+import java.io.IOException;
+import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+
+/**
+ * Thrown when one tries to get an <code>Entry</code> from a service,
+ * but the entry is unusable (due to serialization or other errors).
+ * Normally <code>partialEntry</code> points to an entry with as many
+ * fields as possible filled in, with the array <code>unusableFields</code>
+ * naming the fields that could not be deserialized and the array
+ * <code>nestedExceptions</code> having the corresponding exception.
+ * <p>
+ * If the serialized <code>Entry</code> was corrupt enough that no
+ * attempt could even be made to deserialize its fields,
+ * <code>partialEntry</code> and <code>unusableFields</code> will be
+ * <code>null</code>, and <code>nestedExceptions</code> will be an
+ * array with one element that is the offending exception. This will
+ * typically be because one or more of the classes of the <code>Entry</code>
+ * type itself cannot be loaded.
+ * <p>
+ * The names in <code>unusableFields</code> can be used together with
+ * the reflection mechanisms of <code>java.lang.reflect</code> to
+ * examine the full state of the object.
+ *
+ * @author Sun Microsystems, Inc.
+ * @since 1.0
+ */
+public class UnusableEntryException extends Exception
+{
+ static final long serialVersionUID = -2199083666668626172L;
+
+ /**
+ * The partial entry. Fields that could not be deserialized
+ * will be <code>null</code>.
+ *
+ * @serial
+ */
+ public Entry partialEntry;
+
+ /**
+ * The names of the unusable fields. If the entry was entirely
+ * unusable, <code>unusableFields</code> will be <code>null</code>.
+ *
+ * @serial
+ */
+ public String[] unusableFields;
+
+ /**
+ * The exception that caused the failure for the corresponding
+ * field named in unusableFields. If the entry was entirely
+ * unusable, <code>nestedExceptions</code> will be an array with
+ * the one exception that prevented its use.
+ *
+ * @serial
+ */
+ public Throwable[] nestedExceptions;
+
+ /**
+ * Create an exception for the given partial entry and vectors of
+ * bad field names/nested exception pairs.
+ *
+ * @param partial the Entry object on which the exception occurred
+ * @param badFields a String array containing the bad field names
+ * @param exceptions an array of Throwable objects associated with the
+ * bad field names
+ * @throws IllegalArgumentException if <code>partial</code> is
+ * <code>null</code> and <code>badFields</code> is not
+ * <code>null</code> or <code>exceptions</code> does not have
+ * exactly one element or if <code>partial</code> is
+ * non-<code>null</code> and <code>badFields</code> and
+ * <code>exceptions</code> are not the same length
+ * @throws NullPointerException if <code>partial</code> is
+ * non-<code>null</code> and <code>badFields</code> or any
+ * element of <code>badFields</code> is <code>null</code>, or
+ * if <code>exceptions</code> or any element of
+ * <code>exceptions</code> is <code>null</code>
+ */
+ public UnusableEntryException( Entry partial, String[] badFields,
+ Throwable[] exceptions )
+ {
+ super();
+
+ if( partial == null )
+ {
+ if( exceptions.length != 1 )
+ {
+ throw new IllegalArgumentException( "If partial is null " +
+ "exceptions must have one element" );
+ }
+
+ if( badFields != null )
+ {
+ throw new IllegalArgumentException( "If partial is null " +
+ "badFields must be null" );
+ }
+ }
+ else
+ {
+ if( badFields.length != exceptions.length )
+ {
+ throw new IllegalArgumentException( "If partial is non-null " +
+ "badFields and exceptions must have same length" );
+ }
+ }
+
+ if( badFields != null )
+ {
+ for( int i = 0; i < badFields.length; i++ )
+ {
+ if( badFields[ i ] == null )
+ {
+ throw new NullPointerException( "badFields has a null element" );
+ }
+ }
+ }
+
+ for( int i = 0; i < exceptions.length; i++ )
+ {
+ if( exceptions[ i ] == null )
+ {
+ throw new NullPointerException( "exceptions has a null element" );
+ }
+ }
+
+ partialEntry = partial;
+ unusableFields = badFields;
+ nestedExceptions = exceptions;
+ }
+
+ /**
+ * Create an exception for a nested exception that prevented even an
+ * attempt to build an entry.
+ *
+ * @param e a Throwable representing the nested exception
+ * @throws NullPointerException if <code>e</code> is <code>null</code>
+ */
+ public UnusableEntryException( Throwable e )
+ {
+ if( e == null )
+ {
+ throw new NullPointerException( "e must be non-null" );
+ }
+
+ partialEntry = null;
+ unusableFields = null;
+ nestedExceptions = new Throwable[]{ e };
+ }
+
+ /**
+ * @throws InvalidObjectException if:
+ * <ul>
+ * <li> <code>partialEntry</code> is <code>null</code> and
+ * <code>unusableFields</code> is not <code>null</code> or
+ * <code>nestedExceptions</code> does not have exactly one
+ * element,
+ * <li> if <code>partialEntry</code> is non-<code>null</code> and
+ * <code>unusableFields</code> and
+ * <code>nestedExceptions</code> are not the same length,
+ * <li> if <code>partialEntry</code> is non-<code>null</code> and
+ * <code>unusableFields</code> is <code>null</code> or
+ * any element of <code>unusableFields</code> is
+ * <code>null</code>, or
+ * <li> if <code>nestedExceptions</code> or any element of
+ * <code>nestedExceptions</code> is <code>null</code>
+ * </ul>
+ */
+ private void readObject( ObjectInputStream in )
+ throws IOException, ClassNotFoundException
+ {
+ in.defaultReadObject();
+
+ if( partialEntry == null )
+ {
+ if( nestedExceptions.length != 1 )
+ {
+ throw new InvalidObjectException( "If partialEntry is null " +
+ "nestedExceptions must have one element" );
+ }
+
+ if( unusableFields != null )
+ {
+ throw new InvalidObjectException( "If partialEntry is null " +
+ "unusableFields must be null" );
+ }
+ }
+ else
+ {
+ if( unusableFields == null )
+ {
+ throw new InvalidObjectException( "unusableFields is null" );
+ }
+
+ if( nestedExceptions == null )
+ {
+ throw new InvalidObjectException( "nestedExceptions is null" );
+ }
+
+ if( unusableFields.length != nestedExceptions.length )
+ {
+ throw new InvalidObjectException( "If partialEntry is non-null " +
+ "unusableFields and nestedExceptions must have same length" );
+ }
+ }
+
+ if( unusableFields != null )
+ {
+ for( int i = 0; i < unusableFields.length; i++ )
+ {
+ if( unusableFields[ i ] == null )
+ {
+ throw new InvalidObjectException( "unusableFields has a " +
+ "null element" );
+ }
+ }
+ }
+
+ for( int i = 0; i < nestedExceptions.length; i++ )
+ {
+ if( nestedExceptions[ i ] == null )
+ {
+ throw new InvalidObjectException( "nestedExceptions has a null " +
+ "element" );
+ }
+ }
+ }
+
+ /**
+ * @throws InvalidObjectException if called
+ */
+ private void readObjectNoData() throws InvalidObjectException
+ {
+ throw new InvalidObjectException(
+ "UnusableEntryExceptions should always have data" );
+ }
+
+ /**
+ * Calls {@link #printStackTrace(PrintStream) printStackTrace(System.err)}.
+ */
+ public void printStackTrace()
+ {
+ printStackTrace( System.err );
+ }
+
+ /**
+ * Calls {@link Exception#printStackTrace(PrintStream)
+ * super.printStackTrace(s)} and then calls {@link
+ * Throwable#printStackTrace(PrintStream) printStackTrace(s)} on
+ * each exception in <code>nestedExceptions</code>.
+ */
+ public void printStackTrace( PrintStream s )
+ {
+ synchronized( s )
+ {
+ super.printStackTrace( s );
+
+ if( unusableFields == null )
+ {
+ s.println( "Total unmarshalling failure, cause was:" );
+ nestedExceptions[ 0 ].printStackTrace( s );
+ }
+ else
+ {
+ s.println( "Partial unmarshalling failure" );
+ for( int i = 0; i < nestedExceptions.length; i++ )
+ {
+ s.println( unusableFields[ i ] +
+ " field could not be unmarshalled because of:" );
+ nestedExceptions[ i ].printStackTrace( s );
+ }
+ }
+ }
+ }
+
+ /**
+ * Calls {@link Exception#printStackTrace(PrintWriter)
+ * super.printStackTrace(s)} and then calls {@link
+ * Throwable#printStackTrace(PrintWriter) printStackTrace(s)} on
+ * each exception in <code>nestedExceptions</code>.
+ */
+ public void printStackTrace( PrintWriter s )
+ {
+ synchronized( s )
+ {
+ super.printStackTrace( s );
+
+ if( unusableFields == null )
+ {
+ s.println( "Total unmarshalling failure, cause was:" );
+ nestedExceptions[ 0 ].printStackTrace( s );
+ }
+ else
+ {
+ s.println( "Partial unmarshalling failure" );
+ for( int i = 0; i < nestedExceptions.length; i++ )
+ {
+ s.println( unusableFields[ i ] +
+ " field could not be unmarshalled because of:" );
+ nestedExceptions[ i ].printStackTrace( s );
+ }
+ }
+ }
+ }
+}
Added: incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/entry/package.html
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/entry/package.html?rev=724992&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/entry/package.html (added)
+++ incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/entry/package.html Tue Dec 9 21:20:53 2008
@@ -0,0 +1,33 @@
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements. See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership. The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License. You may obtain a copy of the License at
+ !
+ ! http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing, software
+ ! distributed under the License is distributed on an "AS IS" BASIS,
+ ! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ! See the License for the specific language governing permissions and
+ ! limitations under the License.
+ !-->
+
+<HTML>
+<BODY BGCOLOR="white">
+
+The <CODE>Entry</CODE> interface and its associated
+<CODE>UnusableEntryException</CODE> are used by the lookup service
+to represent service-specific attributes and by the <CODE>JavaSpace</CODE>
+interface to mark entries.
+
+@see net.jini.core.lookup.ServiceRegistrar
+@see net.jini.space.JavaSpace
+
+@see "<i>Jini Entry Specification</i>"
+
+</BODY>
+</HTML>
Added: incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/event/EventRegistration.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/event/EventRegistration.java?rev=724992&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/event/EventRegistration.java (added)
+++ incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/event/EventRegistration.java Tue Dec 9 21:20:53 2008
@@ -0,0 +1,143 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.jini.core.event;
+
+import net.jini.core.lease.Lease;
+
+/**
+ * A utility class for use as a return value for event-interest registration
+ * methods. Objects of this class are meant to encapsulate the information
+ * needed by a client to identify a notification as a response to a
+ * registration request and to maintain that registration request. It is
+ * not mandatory for an event-interest registration method to use this class.
+ * <p>
+ * A registration of interest in some kind of event that occurs within the
+ * scope of a transaction is leased in the same way as other event interest
+ * registrations. However, the duration of the registration is the minimum
+ * of the length of the lease and the duration of the transaction. Simply
+ * put, when the transaction ends (either because of a commit or an abort)
+ * the interest registration also ends. This is true even if the lease for
+ * the event registration has not expired and no call has been made to
+ * cancel the lease.
+ *
+ * @author Sun Microsystems, Inc.
+ * @since 1.0
+ */
+public class EventRegistration implements java.io.Serializable
+{
+
+ private static final long serialVersionUID = 4055207527458053347L;
+
+ /**
+ * The event identifier.
+ *
+ * @serial
+ */
+ protected long eventID;
+
+ /**
+ * The event source.
+ *
+ * @serial
+ */
+ protected Object source;
+
+ /**
+ * The registration lease.
+ *
+ * @serial
+ */
+ protected Lease lease;
+
+ /**
+ * The current sequence number.
+ *
+ * @serial
+ */
+ protected long seqNum;
+
+ /**
+ * Constructs an <tt>EventRegistration</tt> object.
+ *
+ * @param eventID a <tt>long</tt> representing the event identifier
+ * @param source an <tt>Object</tt> representing the event source
+ * @param lease the registration <tt>Lease</tt> object
+ * @param seqNum a <tt>long</tt> representing the current
+ * sequence number
+ */
+ public EventRegistration( long eventID, Object source,
+ Lease lease, long seqNum )
+ {
+ this.eventID = eventID;
+ this.source = source;
+ this.lease = lease;
+ this.seqNum = seqNum;
+ }
+
+ /**
+ * Returns the identifier that will be used in all RemoteEvents generated
+ * for this interest registration.
+ *
+ * @return a long used to identify all RemoteEvents that are generated
+ * for this interest registration.
+ * @see RemoteEvent#getID
+ */
+ public long getID()
+ {
+ return eventID;
+ }
+
+ /**
+ * Returns the source that will be used in all RemoteEvents generated
+ * for this interest registration.
+ *
+ * @return an Object that represents the source of all RemoteEvents
+ * for this interest registration
+ * @see java.util.EventObject#getSource
+ */
+ public Object getSource()
+ {
+ return source;
+ }
+
+ /**
+ * Returns the Lease object for this registration.
+ *
+ * @return the Lease object for this registration.
+ */
+ public Lease getLease()
+ {
+ return lease;
+ }
+
+ /**
+ * Returns the value of the sequence number on the event kind that was
+ * current when the registration was granted, allowing comparison with
+ * the sequence number in any subsequent notifications.
+ *
+ * @return a long representing the value of the sequence number on the
+ * event type that was current when the registration was
+ * granted, allowing comparison with the sequence number in any
+ * subsequent notifications.
+ */
+ public long getSequenceNumber()
+ {
+ return seqNum;
+ }
+}
Added: incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/event/RemoteEvent.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/event/RemoteEvent.java?rev=724992&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/event/RemoteEvent.java (added)
+++ incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/event/RemoteEvent.java Tue Dec 9 21:20:53 2008
@@ -0,0 +1,183 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.jini.core.event;
+
+import java.rmi.MarshalledObject;
+
+/**
+ * The base class or superclass for remote events.
+ * <p>
+ * The abstract state contained in a RemoteEvent object includes a reference
+ * to the object in which the event occurred, a long which identifies the
+ * kind of event relative to the object in which the event occurred, a long
+ * which indicates the sequence number of this instance of the event kind,
+ * and a MarshalledObject that is to be handed back when the notification
+ * occurs. The combination of the event identifier and the object reference
+ * obtained from the RemoteEvent object should uniquely identify the event
+ * type.
+ * <p>
+ * The sequence number obtained from the RemoteEvent object is an increasing
+ * value that can act as a hint to the number of occurrences of this event
+ * relative to some earlier sequence number. Any object that generates a
+ * RemoteEvent is required to insure that for any two RemoteEvent objects
+ * with the same event identifier, the sequence number of those events differ
+ * if and only if the RemoteEvent objects are a response to different events.
+ * This guarantee is required to allow notification calls to be idempotent.
+ * A further guarantee is that if two RemoteEvents, x and y, come from the
+ * same source and have the same event identifier, then x occurred before y
+ * if and only if the sequence number of x is lower than the sequence number
+ * of y.
+ * <p>
+ * A stronger guarantee is possible for those generators of RemoteEvents
+ * that can support it. This guarantee states that not only do sequence
+ * numbers increase, but they are not skipped. In such a case, if
+ * RemoteEvent x and y have the same source and the same event identifier,
+ * and x has sequence number m and y has sequence number n, then if m < n
+ * there were exactly n-m-1 events of the same event type between the event
+ * that triggered x and the event that triggered y. Such sequence numbers
+ * are said to be "fully ordered".
+ * <p>
+ * An event registration that occurs within a transaction is considered to be
+ * scoped by that transaction. This means that any occurrence of the kind of
+ * event of interest that happens as part of the transaction will cause a
+ * notification to be sent to the recipients indicated by the registration
+ * that occurred in the transaction. Such events must have a separate event
+ * identifier to allow third-party store and forward entities to distinguish
+ * between an event that happens within a transaction and those that happen
+ * outside of the transaction. Notifications of these events will not be
+ * sent to entities that registered interest in this kind of event outside
+ * the scope of the transaction until and unless the transaction is committed.
+ * <p>
+ * Because of this, notifications sent from inside a transaction will have a
+ * different sequence number than the notifications of the same events would
+ * have outside of the transaction. Within a transaction, all RemoteEvent
+ * objects for a given kind of event are given a sequence number relative to
+ * the transaction. This is true even if the event that triggered the
+ * RemoteEvent object being sent occurs outside of the scope of the
+ * transaction (but is visible within the transaction).
+ *
+ * @author Sun Microsystems, Inc.
+ * @since 1.0
+ */
+public class RemoteEvent extends java.util.EventObject
+{
+
+ private static final long serialVersionUID = 1777278867291906446L;
+
+ /**
+ * The event source.
+ *
+ * @serial
+ */
+ protected Object source;
+
+ /**
+ * The event identifier.
+ *
+ * @serial
+ */
+ protected long eventID;
+
+ /**
+ * The event sequence number.
+ *
+ * @serial
+ */
+ protected long seqNum;
+
+ /**
+ * The handback object.
+ *
+ * @serial
+ */
+ protected MarshalledObject handback;
+
+ /**
+ * Constructs a RemoteEvent object.
+ * <p>
+ * The abstract state contained in a RemoteEvent object includes a
+ * reference to the object in which the event occurred, a long which
+ * identifies the kind of event relative to the object in which the
+ * event occurred, a long which indicates the sequence number of this
+ * instance of the event kind, and a MarshalledObject that is to be
+ * handed back when the notification occurs. The combination of the
+ * event identifier and the object reference obtained from the
+ * RemoteEvent object should uniquely identify the event type.
+ *
+ * @param source an <tt>Object</tt> representing the event source
+ * @param eventID a <tt>long</tt> containing the event identifier
+ * @param seqNum a <tt>long</tt> containing the event sequence number
+ * @param handback a <tt>MarshalledObject</tt> that was passed in
+ * as part of the original event registration.
+ */
+ public RemoteEvent( Object source, long eventID, long seqNum,
+ MarshalledObject handback )
+ {
+ super( source );
+ this.source = source;
+ this.eventID = eventID;
+ this.seqNum = seqNum;
+ this.handback = handback;
+ }
+
+ /**
+ * Returns the event identifier, used to identify the kind of event
+ * relative to the object in which the event occurred.
+ *
+ * @return a long representing the event identifier relative to the
+ * object in which the event occurred.
+ * @see EventRegistration#getID
+ */
+ public long getID()
+ {
+ return eventID;
+ }
+
+ /**
+ * Returns the sequence number of this event.
+ *
+ * @return a long representing the sequence number of this event.
+ */
+ public long getSequenceNumber()
+ {
+ return seqNum;
+ }
+
+ /**
+ * Returns the handback object that was provided as a parameter to
+ * the event interest registration method, if any.
+ *
+ * @return the MarshalledObject that was provided as a parameter to
+ * the event interest registration method, if any.
+ */
+ public MarshalledObject getRegistrationObject()
+ {
+ return handback;
+ }
+
+ /**
+ * Serialization support
+ */
+ private void readObject( java.io.ObjectInputStream stream )
+ throws java.io.IOException, ClassNotFoundException
+ {
+ stream.defaultReadObject();
+ super.source = source;
+ }
+}
Added: incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/event/RemoteEventListener.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/event/RemoteEventListener.java?rev=724992&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/event/RemoteEventListener.java (added)
+++ incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/event/RemoteEventListener.java Tue Dec 9 21:20:53 2008
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.jini.core.event;
+
+/**
+ * The RemoteEventListener interface needs to be implemented by any object
+ * that wants to receive a notification of a remote event from some other
+ * object.
+ * <p>
+ * The object implementing this interface does not need to be the object
+ * that originally registered interest in the occurrence of an event. To
+ * allow the notification of an event's occurrence to be sent to an entity
+ * other than the one that made the interest registration, the registration
+ * call needs to accept a destination parameter, which indicates the object
+ * to which the notification should be sent. This parameter must be an
+ * object which supports the RemoteEventListener interface.
+ *
+ * @author Sun Microsystems, Inc.
+ * @since 1.0
+ */
+public interface RemoteEventListener
+ extends java.rmi.Remote, java.util.EventListener
+{
+
+ /**
+ * Notify the listener about an event.
+ * <p>
+ * The call to notify is synchronous to allow the party making the call
+ * to know if the call succeeded. However, it is not part of the
+ * semantics of the call that the notification return can be delayed
+ * while the recipient of the call reacts to the occurrence of the event.
+ * Simply put, the best strategy on the part of the recipient is to note
+ * the occurrence in some way and then return from the notify method as
+ * quickly as possible.
+ * <p>
+ * UnknownEventException is thrown when the recipient does not recognize
+ * the combination of the event identifier and the event source as
+ * something in which it is interested. Throwing this exception has the
+ * effect of asking the sender to not send further notifications of
+ * this kind of event from this source in the future.
+ *
+ * @param theEvent the remote event that occurred
+ * @throws UnknownEventException the recipient does not recognize the
+ * combination of event identifier and event source
+ * @throws java.rmi.RemoteException
+ */
+ void notify( RemoteEvent theEvent )
+ throws UnknownEventException, java.rmi.RemoteException;
+}
Added: incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/event/UnknownEventException.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/event/UnknownEventException.java?rev=724992&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/event/UnknownEventException.java (added)
+++ incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/event/UnknownEventException.java Tue Dec 9 21:20:53 2008
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.jini.core.event;
+
+/**
+ * An exception thrown when the recipient of a RemoteEvent does not recognize
+ * the combination of the event identifier and the event source as something
+ * in which it is interested. Throwing this exception has the effect of
+ * asking the sender to not send further notifications of this kind of event
+ * from this source in the future.
+ *
+ * @author Sun Microsystems, Inc.
+ * @since 1.0
+ */
+
+public class UnknownEventException extends Exception
+{
+ private static final long serialVersionUID = 5563758083292687048L;
+
+ /**
+ * Constructs an UnknownEventException with the specified detail message.
+ *
+ * @param reason a <tt>String</tt> containing a detail message
+ */
+ public UnknownEventException( String reason )
+ {
+ super( reason );
+ }
+
+ /**
+ * Constructs an UnknownEventException with no detail message.
+ */
+ public UnknownEventException()
+ {
+ super();
+ }
+}
Added: incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/event/package.html
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/event/package.html?rev=724992&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/event/package.html (added)
+++ incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/event/package.html Tue Dec 9 21:20:53 2008
@@ -0,0 +1,27 @@
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements. See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership. The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License. You may obtain a copy of the License at
+ !
+ ! http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing, software
+ ! distributed under the License is distributed on an "AS IS" BASIS,
+ ! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ! See the License for the specific language governing permissions and
+ ! limitations under the License.
+ !-->
+
+<HTML>
+<BODY BGCOLOR="white">
+
+The <CODE>RemoteEventListener</CODE> interface and related standard classes.
+
+@see "<i>Jini Distributed Event Specification</i>"
+
+</BODY>
+</HTML>
Added: incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/lease/Lease.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/lease/Lease.java?rev=724992&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/lease/Lease.java (added)
+++ incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/lease/Lease.java Tue Dec 9 21:20:53 2008
@@ -0,0 +1,153 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.jini.core.lease;
+
+import java.rmi.RemoteException;
+
+/**
+ * The Lease interface defines a type of object that is returned to the
+ * lease holder and issued by the lease grantor. Particular instances of
+ * the Lease type will be created by the grantors of a lease, and returned
+ * to the holder of the lease as part of the return value from a call that
+ * allocates a leased resource. The call that requests a leased resource
+ * will typically include a requested duration for the lease. If the request
+ * is for a particular duration, the lease grantor is required to grant a
+ * lease of no more than the requested period of time. A lease may be granted
+ * for a period of time shorter than that requested.
+ *
+ * @author Sun Microsystems, Inc.
+ * @since 1.0
+ */
+public interface Lease
+{
+
+ /**
+ * Used to request a lease that never expires.
+ */
+ long FOREVER = Long.MAX_VALUE;
+
+ /**
+ * Used by the requestor to indicate that there is no particular lease
+ * time desired, and that the grantor of the lease should supply a time
+ * that is most convenient for the grantor.
+ */
+ long ANY = -1;
+
+ /**
+ * The serialized form of the lease will convert the time of lease
+ * expiration into a duration (in milliseconds) from the time of
+ * serialization. This form is best used when transmitting a Lease
+ * object from one address space to another (via an RMI call) where
+ * it cannot be assumed that the address spaces have synchronized clocks.
+ */
+ int DURATION = 1;
+
+ /**
+ * The serialized form of the lease will contain the time of expiration
+ * stored as an absolute time, represented in terms of milliseconds since
+ * the beginning of the epoch.
+ */
+ int ABSOLUTE = 2;
+
+ /**
+ * Returns a <code>long</code> that indicates the time that the
+ * lease will expire. This time is represented as
+ * milliseconds from the beginning of the epoch, relative to the local
+ * clock.
+ *
+ * @return a <code>long</code> that indicates the time that the
+ * lease will expire
+ */
+ long getExpiration();
+
+ /**
+ * Used by the lease holder to indicate that it is no longer interested
+ * in the resource or information held by the lease. If the leased
+ * information or resource could cause a callback to the lease holder
+ * (or some other object on behalf of the lease holder), the lease
+ * grantor should not issue such a callback after the lease has been
+ * cancelled. The overall effect of a cancel call is the same as
+ * lease expiration, but instead of happening at the end of a pre-agreed
+ * duration it happens immediately.
+ *
+ * @throws UnknownLeaseException the lease being cancelled is unknown
+ * to the lease grantor
+ * @throws RemoteException
+ */
+ void cancel() throws UnknownLeaseException, RemoteException;
+
+ /**
+ * Used to renew a lease for an additional period of time, specified in
+ * milliseconds. This duration is not added to the original lease, but
+ * is used to determine a new expiration time for the existing lease.
+ * If the renewal is granted this is reflected in value returned by
+ * getExpiration. If the renewal fails, the lease is left intact for
+ * the same duration that was in force prior to the call to renew.
+ *
+ * @param duration the requested duration in milliseconds
+ * @throws LeaseDeniedException the lease grantor is unable or
+ * unwilling to renew the lease
+ * @throws UnknownLeaseException the lease being renewed is unknown
+ * to the lease grantor
+ * @throws RemoteException
+ */
+ void renew( long duration )
+ throws LeaseDeniedException, UnknownLeaseException, RemoteException;
+
+ /**
+ * Sets the format to use when serializing the lease.
+ *
+ * @param format DURATION or ABSOLUTE
+ * @see #getSerialFormat
+ */
+ void setSerialFormat( int format );
+
+ /**
+ * Returns the format that will be used to serialize the lease.
+ *
+ * @return an <tt>int</tt> representing the serial format value
+ * @see #setSerialFormat
+ */
+ int getSerialFormat();
+
+ /**
+ * Creates a Map object that can contain leases whose renewal or
+ * cancellation can be batched, and adds the current lease to that map.
+ * The current lease is put in the map with the duration value given
+ * by the parameter.
+ *
+ * @param duration the duration to put into a Long and use as the
+ * value for the current lease in the created LeaseMap
+ * @return the created <tt>LeaseMap</tt> object
+ */
+ LeaseMap createLeaseMap( long duration );
+
+ /**
+ * Returns a boolean indicating whether or not the lease given as a
+ * parameter can be batched (placed in the same LeaseMap) with the
+ * current lease. Whether or not two Lease objects can be batched
+ * is an implementation detail determined by the objects.
+ *
+ * @param lease the <tt>Lease</tt> to be evaluated
+ * @return a boolean indicating whether or not the lease given as a
+ * parameter can be batched (placed in the same LeaseMap) with
+ * the current lease
+ */
+ boolean canBatch( Lease lease );
+}
Added: incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/lease/LeaseDeniedException.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/lease/LeaseDeniedException.java?rev=724992&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/lease/LeaseDeniedException.java (added)
+++ incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/lease/LeaseDeniedException.java Tue Dec 9 21:20:53 2008
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.jini.core.lease;
+
+/**
+ * An exception generated when a lease request or renewal is denied.
+ *
+ * @author Sun Microsystems, Inc.
+ * @since 1.0
+ */
+public class LeaseDeniedException extends LeaseException
+{
+
+ private static final long serialVersionUID = 5704943735577343495L;
+
+ /**
+ * Constructs an LeaseDeniedException with no detail message.
+ */
+ public LeaseDeniedException()
+ {
+ super();
+ }
+
+ /**
+ * Constructs an LeaseDeniedException with the specified detail message.
+ *
+ * @param reason a <tt>String</tt> containing the reason why the lease
+ * was denied
+ */
+ public LeaseDeniedException( String reason )
+ {
+ super( reason );
+ }
+}
Added: incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/lease/LeaseException.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/lease/LeaseException.java?rev=724992&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/lease/LeaseException.java (added)
+++ incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/lease/LeaseException.java Tue Dec 9 21:20:53 2008
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.jini.core.lease;
+
+/**
+ * Generic superclass for specific lease exceptions.
+ *
+ * @author Sun Microsystems, Inc.
+ * @since 1.0
+ */
+public class LeaseException extends Exception
+{
+
+ private static final long serialVersionUID = -7902272546257490469L;
+
+ /**
+ * Constructs an LeaseException with no detail message.
+ */
+ public LeaseException()
+ {
+ super();
+ }
+
+ /**
+ * Constructs an LeaseException with the specified detail message.
+ *
+ * @param reason a <tt>String</tt> containing the reason why the
+ * exception was thrown
+ */
+ public LeaseException( String reason )
+ {
+ super( reason );
+ }
+}
Added: incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/lease/LeaseMap.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/lease/LeaseMap.java?rev=724992&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/lease/LeaseMap.java (added)
+++ incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/lease/LeaseMap.java Tue Dec 9 21:20:53 2008
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.jini.core.lease;
+
+import java.rmi.RemoteException;
+
+/**
+ * An unsynchronized Map from Lease to Long (the duration to use when
+ * renewing the lease). For all methods of LeaseMap except canContainKey,
+ * an IllegalArgumentException is thrown if a key is not a Lease or a value
+ * is not a Long. Null keys and values are not supported.
+ *
+ * @author Sun Microsystems, Inc.
+ * @since 1.0
+ */
+public interface LeaseMap extends java.util.Map
+{
+ /**
+ * Returns true if the given object is a Lease which can be renewed
+ * and cancelled in a batch with other leases in the map. Whether
+ * or not two Lease objects can be batched is an implementation
+ * detail determined by the objects.
+ *
+ * @param key an object that should be a lease
+ * @return true if the lease can be renewed and cancelled in a
+ * a batch with other leases
+ * @see Lease#canBatch
+ */
+ boolean canContainKey( Object key );
+
+ /**
+ * Renews all leases in the LeaseMap, using their current values as
+ * the renewal durations. If all renewals are successful, returns
+ * normally. Otherwise, removes all leases that failed to renew
+ * from the LeaseMap, and throws LeaseMapException.
+ *
+ * @throws LeaseMapException
+ * @throws java.rmi.RemoteException
+ */
+ void renewAll() throws LeaseMapException, RemoteException;
+
+ /**
+ * Cancels all leases in the LeaseMap. If all cancels are successful,
+ * returns normally (leaving all leases in the map). Otherwise,
+ * removes all leases that failed to cancel from the LeaseMap, and
+ * throws LeaseMapException.
+ *
+ * @throws LeaseMapException
+ * @throws java.rmi.RemoteException
+ */
+ void cancelAll() throws LeaseMapException, RemoteException;
+}
Added: incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/lease/LeaseMapException.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/lease/LeaseMapException.java?rev=724992&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/lease/LeaseMapException.java (added)
+++ incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/lease/LeaseMapException.java Tue Dec 9 21:20:53 2008
@@ -0,0 +1,148 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.jini.core.lease;
+
+import java.io.IOException;
+import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+/**
+ * An exception generated when a LeaseMap renewAll or cancelAll call
+ * generates exceptions on one or more leases in the map.
+ *
+ * @author Sun Microsystems, Inc.
+ * @since 1.0
+ */
+public class LeaseMapException extends LeaseException
+{
+
+ private static final long serialVersionUID = -4854893779678486122L;
+
+ /**
+ * A Map from Lease to Exception, containing each lease that failed to
+ * renew or cancel, and the exception that resulted from that lease's
+ * renewal or cancel attempt.
+ *
+ * @serial
+ */
+ public Map exceptionMap;
+
+ /**
+ * Constructs a LeaseMapException for the specified map with a
+ * detail message.
+ *
+ * @param s the detail message
+ * @param exceptionMap the <tt>Map</tt> object on which the exception
+ * occurred
+ * @throws NullPointerException if <code>exceptionMap</code> is
+ * <code>null</code> or contains a <code>null</code> key
+ * or a <code>null</code> value
+ * @throws IllegalArgumentException if <code>exceptionMap</code>
+ * contains any key which is not an instance of
+ * {@link Lease}, or any value which is not an instance of
+ * <code>Throwable</code>
+ */
+ public LeaseMapException( String s, Map exceptionMap )
+ {
+ super( s );
+
+ final Set mapEntries = exceptionMap.entrySet();
+ for( Iterator i = mapEntries.iterator(); i.hasNext(); )
+ {
+ final Map.Entry entry = (Entry) i.next();
+ final Object key = entry.getKey();
+ final Object value = entry.getValue();
+
+ if( key == null )
+ {
+ throw new NullPointerException( "exceptionMap contains a null key" );
+ }
+
+ if( !( key instanceof Lease ) )
+ {
+ throw new IllegalArgumentException( "exceptionMap contains an " +
+ "a key which is not a Lease:" + key );
+ }
+
+ if( value == null )
+ {
+ throw
+ new NullPointerException( "exceptionMap contains a null value" );
+ }
+
+ if( !( value instanceof Throwable ) )
+ {
+ throw new IllegalArgumentException( "exceptionMap contains an " +
+ "a value which is not a Throwable:" + value );
+ }
+ }
+
+ this.exceptionMap = exceptionMap;
+ }
+
+ /**
+ * @throws InvalidObjectException if <code>exceptionMap</code> is
+ * <code>null</code>, contains any key which is not an instance of
+ * {@link Lease}, or contains any value which in not an instance of
+ * <code>Throwable</code>
+ */
+ private void readObject( ObjectInputStream in )
+ throws IOException, ClassNotFoundException
+ {
+ in.defaultReadObject();
+
+ if( exceptionMap == null )
+ {
+ throw new InvalidObjectException( "exceptionMap is null" );
+ }
+
+ final Set mapEntries = exceptionMap.entrySet();
+ for( Iterator i = mapEntries.iterator(); i.hasNext(); )
+ {
+ final Map.Entry entry = (Entry) i.next();
+ final Object key = entry.getKey();
+ final Object value = entry.getValue();
+
+ if( !( key instanceof Lease ) )
+ {
+ throw new InvalidObjectException( "exceptionMap contains an " +
+ "a key which is not a Lease:" + key );
+ }
+
+ if( !( value instanceof Throwable ) )
+ {
+ throw new InvalidObjectException( "exceptionMap contains an " +
+ "a value which is not a Throwable:" + value );
+ }
+ }
+ }
+
+ /**
+ * @throws InvalidObjectException if called
+ */
+ private void readObjectNoData() throws InvalidObjectException
+ {
+ throw new InvalidObjectException(
+ "LeaseMapException should always have data" );
+ }
+}
Added: incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/lease/UnknownLeaseException.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/lease/UnknownLeaseException.java?rev=724992&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/lease/UnknownLeaseException.java (added)
+++ incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/lease/UnknownLeaseException.java Tue Dec 9 21:20:53 2008
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.jini.core.lease;
+
+/**
+ * An exception used to indicate that a lease is not known to the grantor
+ * of the lease. This can occur when a lease expires or has been cancelled.
+ *
+ * @author Sun Microsystems, Inc.
+ * @since 1.0
+ */
+public class UnknownLeaseException extends LeaseException
+{
+
+ private static final long serialVersionUID = -2921099330511429288L;
+
+ /**
+ * Constructs an UnknownLeaseException with no detail message.
+ */
+ public UnknownLeaseException()
+ {
+ super();
+ }
+
+ /**
+ * Constructs an UnknownLeaseException with the specified detail message.
+ *
+ * @param reason a detail message
+ */
+ public UnknownLeaseException( String reason )
+ {
+ super( reason );
+ }
+}
Added: incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/lease/package.html
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/lease/package.html?rev=724992&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/lease/package.html (added)
+++ incubator/river/jtsk/skunk/niclas1/core-api/src/main/java/net/jini/core/lease/package.html Tue Dec 9 21:20:53 2008
@@ -0,0 +1,35 @@
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements. See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership. The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License. You may obtain a copy of the License at
+ !
+ ! http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing, software
+ ! distributed under the License is distributed on an "AS IS" BASIS,
+ ! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ! See the License for the specific language governing permissions and
+ ! limitations under the License.
+ !-->
+
+<HTML>
+<BODY BGCOLOR="white">
+
+These are distributed leasing interfaces and classes. A <CODE>Lease</CODE> represents
+an agreement between lease holder and lease grantor over how long the grantor
+will keep a resource available. The grantor pledges to keep the resource
+available for at least as long as the remaining time of the lease. The
+holder typically requests a lease for a given time frame, and the grantor
+returns a <CODE>Lease</CODE> object that represents the pledge it is actually
+willing to make (which may be different from the requested time). The
+grantor may allow the holder to renew the lease, thereby extending the pledge
+to a later time.
+
+@see "<i>Jini Distributed Leasing Specification</i>"
+
+</BODY>
+</HTML>