Modified: river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/ConstrainableParticipantProxy.java URL: http://svn.apache.org/viewvc/river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/ConstrainableParticipantProxy.java?rev=1879521&r1=1879520&r2=1879521&view=diff ============================================================================== --- river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/ConstrainableParticipantProxy.java (original) +++ river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/ConstrainableParticipantProxy.java Sun Jul 5 11:41:39 2020 @@ -1,105 +1,105 @@ -/* - * 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 org.apache.river.outrigger; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.InvalidObjectException; - -import net.jini.core.transaction.server.TransactionParticipant; -import net.jini.core.constraint.MethodConstraints; -import net.jini.core.constraint.RemoteMethodControl; -import net.jini.security.proxytrust.ProxyTrustIterator; -import net.jini.security.proxytrust.SingletonProxyTrustIterator; -import net.jini.id.Uuid; - -/** - * Subclass of <code>ParticipantProxy</code> that implements - * <code>RemoteMethodControl</code> - * - * @author Sun Microsystems, Inc. - */ -final class ConstrainableParticipantProxy extends ParticipantProxy - implements RemoteMethodControl -{ - private static final long serialVersionUID = 1L; - - /** - * Create a new <code>ConstrainableParticipantProxy</code> for the given - * space. - * @param space The an inner proxy that implements - * <code>TransactionParticipant</code> for the - * space. - * @param spaceUuid The universally unique ID for the - * space - * @throws NullPointerException if <code>space</code> or - * <code>spaceUuid</code> is <code>null</code>. - */ - ConstrainableParticipantProxy(TransactionParticipant space, Uuid spaceUuid, - MethodConstraints methodConstraints) - { - super(constrainServer(space, methodConstraints), spaceUuid); - } - - /** - * Returns a copy of the server proxy with the specified client - * constraints and methods mapping. - */ - private static TransactionParticipant constrainServer( - TransactionParticipant participant, - MethodConstraints methodConstraints) - { - return (TransactionParticipant) - ((RemoteMethodControl)participant).setConstraints( - methodConstraints); - } - - public RemoteMethodControl setConstraints(MethodConstraints constraints) { - return new ConstrainableParticipantProxy(space, spaceUuid, - constraints); - } - - public MethodConstraints getConstraints() { - return ((RemoteMethodControl)space).getConstraints(); - } - - /** - * Returns a proxy trust iterator that is used in - * <code>ProxyTrustVerifier</code> to retrieve this object's - * trust verifier. - */ - private ProxyTrustIterator getProxyTrustIterator() { - return new SingletonProxyTrustIterator(space); - } - - private void readObject(ObjectInputStream s) - throws IOException, ClassNotFoundException - { - s.defaultReadObject(); - - /* Basic validation of space and spaceUuid, was performed by - * ParticipantProxy.readObject(), we just need to verify than - * space implements RemoteMethodControl. - */ - - if(!(space instanceof RemoteMethodControl) ) { - throw new InvalidObjectException( - "space does not implement RemoteMethodControl"); - } - } -} +/* + * 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 org.apache.river.outrigger.proxy; + +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.InvalidObjectException; + +import net.jini.core.transaction.server.TransactionParticipant; +import net.jini.core.constraint.MethodConstraints; +import net.jini.core.constraint.RemoteMethodControl; +import net.jini.security.proxytrust.ProxyTrustIterator; +import net.jini.security.proxytrust.SingletonProxyTrustIterator; +import net.jini.id.Uuid; + +/** + * Subclass of <code>ParticipantProxy</code> that implements + * <code>RemoteMethodControl</code> + * + * @author Sun Microsystems, Inc. + */ +public final class ConstrainableParticipantProxy extends ParticipantProxy + implements RemoteMethodControl +{ + private static final long serialVersionUID = 1L; + + /** + * Create a new <code>ConstrainableParticipantProxy</code> for the given + * space. + * @param space The an inner proxy that implements + * <code>TransactionParticipant</code> for the + * space. + * @param spaceUuid The universally unique ID for the + * space + * @throws NullPointerException if <code>space</code> or + * <code>spaceUuid</code> is <code>null</code>. + */ + public ConstrainableParticipantProxy(TransactionParticipant space, Uuid spaceUuid, + MethodConstraints methodConstraints) + { + super(constrainServer(space, methodConstraints), spaceUuid); + } + + /** + * Returns a copy of the server proxy with the specified client + * constraints and methods mapping. + */ + private static TransactionParticipant constrainServer( + TransactionParticipant participant, + MethodConstraints methodConstraints) + { + return (TransactionParticipant) + ((RemoteMethodControl)participant).setConstraints( + methodConstraints); + } + + public RemoteMethodControl setConstraints(MethodConstraints constraints) { + return new ConstrainableParticipantProxy(space, spaceUuid, + constraints); + } + + public MethodConstraints getConstraints() { + return ((RemoteMethodControl)space).getConstraints(); + } + + /** + * Returns a proxy trust iterator that is used in + * <code>ProxyTrustVerifier</code> to retrieve this object's + * trust verifier. + */ + private ProxyTrustIterator getProxyTrustIterator() { + return new SingletonProxyTrustIterator(space); + } + + private void readObject(ObjectInputStream s) + throws IOException, ClassNotFoundException + { + s.defaultReadObject(); + + /* Basic validation of space and spaceUuid, was performed by + * ParticipantProxy.readObject(), we just need to verify than + * space implements RemoteMethodControl. + */ + + if(!(space instanceof RemoteMethodControl) ) { + throw new InvalidObjectException( + "space does not implement RemoteMethodControl"); + } + } +}
Modified: river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/ConstrainableSpaceProxy2.java URL: http://svn.apache.org/viewvc/river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/ConstrainableSpaceProxy2.java?rev=1879521&r1=1879520&r2=1879521&view=diff ============================================================================== --- river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/ConstrainableSpaceProxy2.java (original) +++ river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/ConstrainableSpaceProxy2.java Sun Jul 5 11:41:39 2020 @@ -1,256 +1,256 @@ -/* - * 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 org.apache.river.outrigger; - -import java.lang.reflect.Method; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.rmi.MarshalledObject; -import java.util.Collection; - -import net.jini.core.entry.Entry; -import net.jini.core.event.RemoteEventListener; -import net.jini.core.transaction.Transaction; -import net.jini.core.lease.Lease; -import net.jini.space.JavaSpace; -import net.jini.space.JavaSpace05; -import net.jini.admin.Administrable; - -import net.jini.id.Uuid; -import net.jini.core.constraint.MethodConstraints; -import net.jini.core.constraint.RemoteMethodControl; -import net.jini.security.proxytrust.ProxyTrustIterator; -import net.jini.security.proxytrust.SingletonProxyTrustIterator; -import org.apache.river.proxy.ConstrainableProxyUtil; -import org.apache.river.landlord.ConstrainableLandlordLease; - -/** - * Constrainable subclass of <code>SpaceProxy2</code> - */ -final class ConstrainableSpaceProxy2 extends SpaceProxy2 - implements RemoteMethodControl -{ - static final long serialVersionUID = 1L; - - /** - * Array containing element pairs in which each pair of elements - * represents a mapping between two methods having the following - * characteristics: - * <ul> - * <li> the first element in the pair is one of the public, remote - * method(s) that may be invoked by the client through - * <code>SpaceProxy2</code>. - * <li> the second element in the pair is the method, implemented - * in the backend server class, that is ultimately executed in - * the server's backend when the client invokes the corresponding - * method in this proxy. - * </ul> - */ - private static final Method[] methodMapArray = { - ProxyUtil.getMethod(Administrable.class, "getAdmin", new Class[] {}), - ProxyUtil.getMethod(Administrable.class, "getAdmin", new Class[] {}), - - ProxyUtil.getMethod(JavaSpace.class, "write", - new Class[] {Entry.class, - Transaction.class, - long.class}), - ProxyUtil.getMethod(OutriggerServer.class, "write", - new Class[] {EntryRep.class, - Transaction.class, - long.class}), - - - ProxyUtil.getMethod(JavaSpace.class, "read", - new Class[] {Entry.class, - Transaction.class, - long.class}), - ProxyUtil.getMethod(OutriggerServer.class, "read", - new Class[] {EntryRep.class, - Transaction.class, - long.class, - OutriggerServer.QueryCookie.class}), - - - ProxyUtil.getMethod(JavaSpace.class, "take", - new Class[] {Entry.class, - Transaction.class, - long.class}), - ProxyUtil.getMethod(OutriggerServer.class, "take", - new Class[] {EntryRep.class, - Transaction.class, - long.class, - OutriggerServer.QueryCookie.class}), - - - ProxyUtil.getMethod(JavaSpace.class, "readIfExists", - new Class[] {Entry.class, - Transaction.class, - long.class}), - ProxyUtil.getMethod(OutriggerServer.class, "readIfExists", - new Class[] {EntryRep.class, - Transaction.class, - long.class, - OutriggerServer.QueryCookie.class}), - - - ProxyUtil.getMethod(JavaSpace.class, "takeIfExists", - new Class[] {Entry.class, - Transaction.class, - long.class}), - ProxyUtil.getMethod(OutriggerServer.class, "takeIfExists", - new Class[] {EntryRep.class, - Transaction.class, - long.class, - OutriggerServer.QueryCookie.class}), - - - ProxyUtil.getMethod(JavaSpace.class, "notify", - new Class[] {Entry.class, - Transaction.class, - RemoteEventListener.class, - long.class, - MarshalledObject.class}), - ProxyUtil.getMethod(OutriggerServer.class, "notify", - new Class[] {EntryRep.class, - Transaction.class, - RemoteEventListener.class, - long.class, - MarshalledObject.class}), - - ProxyUtil.getMethod(JavaSpace05.class, "contents", - new Class[] {Collection.class, - Transaction.class, - long.class, - long.class}), - ProxyUtil.getMethod(OutriggerServer.class, "contents", - new Class[] {EntryRep[].class, - Transaction.class, - long.class, - long.class}), - - - // Use the same constants for nextBatch as contents - ProxyUtil.getMethod(JavaSpace05.class, "contents", - new Class[] {Collection.class, - Transaction.class, - long.class, - long.class}), - ProxyUtil.getMethod(OutriggerServer.class, "nextBatch", - new Class[] {Uuid.class, - Uuid.class}) - };//end methodMapArray - - /** - * Client constraints placed on this proxy (may be <code>null</code> - * @serial - */ - private final MethodConstraints methodConstraints; - - /** - * Create a new <code>ConstrainableSpaceProxy2</code>. - * @param space The <code>OutriggerServer</code> for the - * space. - * @param spaceUuid The universally unique ID for the - * space - * @param serverMaxServerQueryTimeout The value this proxy - * should use for the <code>maxServerQueryTimeout</code> - * if no local value is provided. - * @param methodConstraints the client method constraints to place on - * this proxy (may be <code>null</code>). - * @throws NullPointerException if <code>space</code> or - * <code>spaceUuid</code> is <code>null</code>. - * @throws IllegalArgumentException if - * <code>serverMaxServerQueryTimeout</code> is not - * larger than zero. - * @throws ClassCastException if <code>server</code> - * does not implement <code>RemoteMethodControl</code>. - */ - ConstrainableSpaceProxy2(OutriggerServer space, Uuid spaceUuid, - long serverMaxServerQueryTimeout, - MethodConstraints methodConstraints) - { - super(constrainServer(space, methodConstraints), - spaceUuid, serverMaxServerQueryTimeout); - this.methodConstraints = methodConstraints; - } - - /** - * Returns a copy of the given <code>OutriggerServer</code> proxy - * having the client method constraints that result after - * mapping defined by methodMapArray is applied. - * @param server The proxy to attach constrains too. - * @param constraints The source method constraints. - * @throws NullPointerException if <code>server</code> is - * <code>null</code>. - * @throws ClassCastException if <code>server</code> - * does not implement <code>RemoteMethodControl</code>. - */ - private static OutriggerServer constrainServer(OutriggerServer server, - MethodConstraints constraints) - { - final MethodConstraints serverRefConstraints - = ConstrainableProxyUtil.translateConstraints(constraints, - methodMapArray); - final RemoteMethodControl constrainedServer = - ((RemoteMethodControl)server). - setConstraints(serverRefConstraints); - - return (OutriggerServer)constrainedServer; - } - - public RemoteMethodControl setConstraints(MethodConstraints constraints) - { - return new ConstrainableSpaceProxy2(space, spaceUuid, - serverMaxServerQueryTimeout, - constraints); - } - - public MethodConstraints getConstraints() { - return methodConstraints; - } - - /** - * Returns a proxy trust iterator that is used in - * <code>ProxyTrustVerifier</code> to retrieve this object's - * trust verifier. - */ - private ProxyTrustIterator getProxyTrustIterator() { - return new SingletonProxyTrustIterator(space); - } - - private void readObject(ObjectInputStream s) - throws IOException, ClassNotFoundException - { - s.defaultReadObject(); - - /* Basic validation of space, spaceUuid, and - * serverMaxServerQueryTimeout was performed by - * SpaceProxy2.readObject(), we just need to verify than - * space implements RemoteMethodControl and that it has - * appropriate constraints. - */ - ConstrainableProxyUtil.verifyConsistentConstraints( - methodConstraints, space, methodMapArray); - } - - protected Lease constructLease(Uuid uuid, long expiration) { - return new ConstrainableLandlordLease(uuid, space, spaceUuid, - expiration, null); - } -} - +/* + * 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 org.apache.river.outrigger.proxy; + +import java.lang.reflect.Method; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.rmi.MarshalledObject; +import java.util.Collection; + +import net.jini.core.entry.Entry; +import net.jini.core.event.RemoteEventListener; +import net.jini.core.transaction.Transaction; +import net.jini.core.lease.Lease; +import net.jini.space.JavaSpace; +import net.jini.space.JavaSpace05; +import net.jini.admin.Administrable; + +import net.jini.id.Uuid; +import net.jini.core.constraint.MethodConstraints; +import net.jini.core.constraint.RemoteMethodControl; +import net.jini.security.proxytrust.ProxyTrustIterator; +import net.jini.security.proxytrust.SingletonProxyTrustIterator; +import org.apache.river.proxy.ConstrainableProxyUtil; +import org.apache.river.landlord.ConstrainableLandlordLease; + +/** + * Constrainable subclass of <code>SpaceProxy2</code> + */ +public final class ConstrainableSpaceProxy2 extends SpaceProxy2 + implements RemoteMethodControl +{ + static final long serialVersionUID = 1L; + + /** + * Array containing element pairs in which each pair of elements + * represents a mapping between two methods having the following + * characteristics: + * <ul> + * <li> the first element in the pair is one of the public, remote + * method(s) that may be invoked by the client through + * <code>SpaceProxy2</code>. + * <li> the second element in the pair is the method, implemented + * in the backend server class, that is ultimately executed in + * the server's backend when the client invokes the corresponding + * method in this proxy. + * </ul> + */ + private static final Method[] methodMapArray = { + ProxyUtil.getMethod(Administrable.class, "getAdmin", new Class[] {}), + ProxyUtil.getMethod(Administrable.class, "getAdmin", new Class[] {}), + + ProxyUtil.getMethod(JavaSpace.class, "write", + new Class[] {Entry.class, + Transaction.class, + long.class}), + ProxyUtil.getMethod(OutriggerServer.class, "write", + new Class[] {EntryRep.class, + Transaction.class, + long.class}), + + + ProxyUtil.getMethod(JavaSpace.class, "read", + new Class[] {Entry.class, + Transaction.class, + long.class}), + ProxyUtil.getMethod(OutriggerServer.class, "read", + new Class[] {EntryRep.class, + Transaction.class, + long.class, + OutriggerServer.QueryCookie.class}), + + + ProxyUtil.getMethod(JavaSpace.class, "take", + new Class[] {Entry.class, + Transaction.class, + long.class}), + ProxyUtil.getMethod(OutriggerServer.class, "take", + new Class[] {EntryRep.class, + Transaction.class, + long.class, + OutriggerServer.QueryCookie.class}), + + + ProxyUtil.getMethod(JavaSpace.class, "readIfExists", + new Class[] {Entry.class, + Transaction.class, + long.class}), + ProxyUtil.getMethod(OutriggerServer.class, "readIfExists", + new Class[] {EntryRep.class, + Transaction.class, + long.class, + OutriggerServer.QueryCookie.class}), + + + ProxyUtil.getMethod(JavaSpace.class, "takeIfExists", + new Class[] {Entry.class, + Transaction.class, + long.class}), + ProxyUtil.getMethod(OutriggerServer.class, "takeIfExists", + new Class[] {EntryRep.class, + Transaction.class, + long.class, + OutriggerServer.QueryCookie.class}), + + + ProxyUtil.getMethod(JavaSpace.class, "notify", + new Class[] {Entry.class, + Transaction.class, + RemoteEventListener.class, + long.class, + MarshalledObject.class}), + ProxyUtil.getMethod(OutriggerServer.class, "notify", + new Class[] {EntryRep.class, + Transaction.class, + RemoteEventListener.class, + long.class, + MarshalledObject.class}), + + ProxyUtil.getMethod(JavaSpace05.class, "contents", + new Class[] {Collection.class, + Transaction.class, + long.class, + long.class}), + ProxyUtil.getMethod(OutriggerServer.class, "contents", + new Class[] {EntryRep[].class, + Transaction.class, + long.class, + long.class}), + + + // Use the same constants for nextBatch as contents + ProxyUtil.getMethod(JavaSpace05.class, "contents", + new Class[] {Collection.class, + Transaction.class, + long.class, + long.class}), + ProxyUtil.getMethod(OutriggerServer.class, "nextBatch", + new Class[] {Uuid.class, + Uuid.class}) + };//end methodMapArray + + /** + * Client constraints placed on this proxy (may be <code>null</code> + * @serial + */ + private final MethodConstraints methodConstraints; + + /** + * Create a new <code>ConstrainableSpaceProxy2</code>. + * @param space The <code>OutriggerServer</code> for the + * space. + * @param spaceUuid The universally unique ID for the + * space + * @param serverMaxServerQueryTimeout The value this proxy + * should use for the <code>maxServerQueryTimeout</code> + * if no local value is provided. + * @param methodConstraints the client method constraints to place on + * this proxy (may be <code>null</code>). + * @throws NullPointerException if <code>space</code> or + * <code>spaceUuid</code> is <code>null</code>. + * @throws IllegalArgumentException if + * <code>serverMaxServerQueryTimeout</code> is not + * larger than zero. + * @throws ClassCastException if <code>server</code> + * does not implement <code>RemoteMethodControl</code>. + */ + public ConstrainableSpaceProxy2(OutriggerServer space, Uuid spaceUuid, + long serverMaxServerQueryTimeout, + MethodConstraints methodConstraints) + { + super(constrainServer(space, methodConstraints), + spaceUuid, serverMaxServerQueryTimeout); + this.methodConstraints = methodConstraints; + } + + /** + * Returns a copy of the given <code>OutriggerServer</code> proxy + * having the client method constraints that result after + * mapping defined by methodMapArray is applied. + * @param server The proxy to attach constrains too. + * @param constraints The source method constraints. + * @throws NullPointerException if <code>server</code> is + * <code>null</code>. + * @throws ClassCastException if <code>server</code> + * does not implement <code>RemoteMethodControl</code>. + */ + private static OutriggerServer constrainServer(OutriggerServer server, + MethodConstraints constraints) + { + final MethodConstraints serverRefConstraints + = ConstrainableProxyUtil.translateConstraints(constraints, + methodMapArray); + final RemoteMethodControl constrainedServer = + ((RemoteMethodControl)server). + setConstraints(serverRefConstraints); + + return (OutriggerServer)constrainedServer; + } + + public RemoteMethodControl setConstraints(MethodConstraints constraints) + { + return new ConstrainableSpaceProxy2(space, spaceUuid, + serverMaxServerQueryTimeout, + constraints); + } + + public MethodConstraints getConstraints() { + return methodConstraints; + } + + /** + * Returns a proxy trust iterator that is used in + * <code>ProxyTrustVerifier</code> to retrieve this object's + * trust verifier. + */ + private ProxyTrustIterator getProxyTrustIterator() { + return new SingletonProxyTrustIterator(space); + } + + private void readObject(ObjectInputStream s) + throws IOException, ClassNotFoundException + { + s.defaultReadObject(); + + /* Basic validation of space, spaceUuid, and + * serverMaxServerQueryTimeout was performed by + * SpaceProxy2.readObject(), we just need to verify than + * space implements RemoteMethodControl and that it has + * appropriate constraints. + */ + ConstrainableProxyUtil.verifyConsistentConstraints( + methodConstraints, space, methodMapArray); + } + + protected Lease constructLease(Uuid uuid, long expiration) { + return new ConstrainableLandlordLease(uuid, space, spaceUuid, + expiration, null); + } +} + Modified: river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/EntryRep.java URL: http://svn.apache.org/viewvc/river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/EntryRep.java?rev=1879521&r1=1879520&r2=1879521&view=diff ============================================================================== --- river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/EntryRep.java (original) +++ river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/EntryRep.java Sun Jul 5 11:41:39 2020 @@ -15,7 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.river.outrigger; +package org.apache.river.outrigger.proxy; import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; @@ -58,7 +58,7 @@ import org.apache.river.proxy.Marshalled * @see JavaSpace * @see Entry */ -class EntryRep implements StorableResource<EntryRep>, LeasedResource, Serializable { +public class EntryRep implements StorableResource<EntryRep>, LeasedResource, Serializable { static final long serialVersionUID = 3L; // Synchronization isn't used where volatile access would be atomic. @@ -136,7 +136,7 @@ class EntryRep implements StorableResour * Each entry is usable insofar as the codebase under which it was * written is usable. */ - synchronized void shareWith(EntryRep other) { + public synchronized void shareWith(EntryRep other) { className = other.className; superclasses = other.superclasses; hashes = other.hashes; @@ -330,7 +330,7 @@ class EntryRep implements StorableResour } /** Used in recovery */ - EntryRep() { } + public EntryRep() { } /** Used to look up no-arg constructors. */ private final static Class[] noArg = new Class[0]; @@ -363,7 +363,7 @@ class EntryRep implements StorableResour * The <code>EntryRep</code> that marks a ``match any'' request. * This is used to represent a <code>null</code> template. */ - static EntryRep matchAnyEntryRep() { + public static EntryRep matchAnyEntryRep() { return matchAnyRep; } @@ -378,7 +378,7 @@ class EntryRep implements StorableResour /** * Return the class name that is used by the ``match any'' EntryRep */ - static String matchAnyClassName() { + public static String matchAnyClassName() { return matchAnyRep.classFor(); } @@ -393,7 +393,7 @@ class EntryRep implements StorableResour * deserialized, or the class for the entry type * itself cannot be deserialized. */ - Entry entry() throws UnusableEntryException { + public Entry entry() throws UnusableEntryException { ObjectInputStream objIn = null; String className = ""; // set before any exception can be thrown. try { @@ -605,7 +605,7 @@ class EntryRep implements StorableResour /** * Return the ID. */ - Uuid id() { + public Uuid id() { return id; } @@ -614,7 +614,7 @@ class EntryRep implements StorableResour * @throws IllegalStateException if this method has already * been called. */ - void pickID() { + public void pickID() { synchronized (this){ if (id != null) throw new IllegalStateException("pickID called more than once"); @@ -656,14 +656,14 @@ class EntryRep implements StorableResour /** * Return the hash of this entry type. */ - long getHash() { + public long getHash() { return hash; } /** * Return the array of superclass hashes of this entry type. */ - long[] getHashes() { + public long[] getHashes() { return hashes; } @@ -672,7 +672,7 @@ class EntryRep implements StorableResour * represents. (Note that even though "this" is a template, it may * have no wildcards -- a template can have all values.) */ - boolean matches(EntryRep other) { + public boolean matches(EntryRep other) { /* * We use the fact that this is the template in several ways in * the method implementation. For instance, in this next loop, @@ -706,7 +706,7 @@ class EntryRep implements StorableResour * Return <code>true</code> if this entry represents an object that * is at least the type of the <code>otherClass</code>. */ - boolean isAtLeastA(String otherClass) { + public boolean isAtLeastA(String otherClass) { if (otherClass.equals(matchAnyClassName())) // The other is a null template, all entries are at least entry. return true; Modified: river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/IteratorProxy.java URL: http://svn.apache.org/viewvc/river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/IteratorProxy.java?rev=1879521&r1=1879520&r2=1879521&view=diff ============================================================================== --- river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/IteratorProxy.java (original) +++ river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/IteratorProxy.java Sun Jul 5 11:41:39 2020 @@ -1,153 +1,155 @@ -/* - * 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 org.apache.river.outrigger; - -import java.rmi.RemoteException; -import net.jini.core.entry.Entry; -import net.jini.core.entry.UnusableEntryException; -import net.jini.id.Uuid; - -/** - * The iterator that is returned to the client. - * <code>IteratorProxy</code> uses a <code>RemoteIter</code> reference - * to talk to the server. The <code>RemoteIter</code> object is its - * partner on the server side. - * <p> - * Note, because there is no way to duplicate one of these objects, or - * get a new reference to the underlying iteration one (a situation - * that is unlikely to change since part of the iteration is local), we - * don't need to do anything special for equality. The default - * implementations of <code>equals</code> and <code>hashCode</code> - * work fine. - */ -class IteratorProxy implements AdminIterator { - /** - * The <code>Uuid</code> of the iteration this - * proxy is associated with. - */ - private final Uuid iterationUuid; - - /** - * Reference to the server. - * Only assigned by this class. - */ - volatile OutriggerAdmin server; - - /** Last set of reps we got from the server */ - private volatile EntryRep[] reps; - - /** - * Index of the next entry in rep to return. If <code>delete()</code> - * we will call <code>iter.delete()</code> next - 1 - */ - private volatile int next = -1; - - /** - * How many entries to ask for each time we go to the server - */ - private final int fetchSize; - - /** ID of last entry we got from server */ - private volatile Uuid lastId = null; - - /** - * Create client side iterator proxy. - * @param iterationUuid The identity of the iteration this proxy is for. - * @param server reference to remote server for the space. - * @param fetchSize Number of entries to ask for when it goes to the - * server - * @throws NullPointerException if <code>server</code> or - * <code>iterationUuid</code> is <code>null</code>. - */ - IteratorProxy(Uuid iterationUuid, OutriggerAdmin server, int fetchSize) { - if (iterationUuid == null) - throw new NullPointerException("iterationUuid must be non-null"); - - if (server == null) - throw new NullPointerException("server must be non-null"); - - if (fetchSize <= 0 && fetchSize != JavaSpaceAdmin.USE_DEFAULT) - throw new IllegalArgumentException - ("fetchSize must be postive or JavaSpaceAdmin.USE_DEFAULT"); - - this.iterationUuid = iterationUuid; - this.server = server; - this.fetchSize = fetchSize; - } - - // purposefully inherit doc comment from supertype - public Entry next() throws UnusableEntryException, RemoteException { - assertOpen(); - - if (next < 0 || next >= reps.length) { - // Need to get more Entries - reps = server.nextReps(iterationUuid, fetchSize, lastId); - - if (reps == null) { - // Finished - close(); - return null; - } - - lastId = reps[reps.length-1].id(); - - next = 0; - } - - // This may throw UnusableEntryException, but that's - // the right thing - return reps[next++].entry(); - } - - // purposefully inherit doc comment from supertype - public void delete() throws RemoteException { - if (next < 0) - throw new IllegalStateException("AdminIterator:Can't call " + - "delete before calling next()"); - - assertOpen(); - server.delete(iterationUuid, reps[next-1].id()); - } - - // purposefully inherit doc comment from supertype - public void close() throws RemoteException { - if (server != null) { - // always set to null, and then try to use the remote method, - // which is actually optional - OutriggerAdmin it = server; - server = null; - reps = null; - it.close(iterationUuid); - } - } - - /** - * Throw <code>IllegalStateException</code> if this iterator - * has been closed; otherwise just return. - */ - private void assertOpen() throws IllegalStateException { - if (server == null) { - throw new IllegalStateException("closed AdminIterator"); - } - } - - public String toString() { - return getClass().getName() + " for " + iterationUuid + - " (through " + server + ")"; - } -} +/* + * 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 org.apache.river.outrigger.proxy; + +import java.rmi.RemoteException; +import net.jini.core.entry.Entry; +import net.jini.core.entry.UnusableEntryException; +import net.jini.id.Uuid; +import org.apache.river.admin.AdminIterator; +import org.apache.river.admin.JavaSpaceAdmin; + +/** + * The iterator that is returned to the client. + * <code>IteratorProxy</code> uses a <code>RemoteIter</code> reference + * to talk to the server. The <code>RemoteIter</code> object is its + * partner on the server side. + * <p> + * Note, because there is no way to duplicate one of these objects, or + * get a new reference to the underlying iteration one (a situation + * that is unlikely to change since part of the iteration is local), we + * don't need to do anything special for equality. The default + * implementations of <code>equals</code> and <code>hashCode</code> + * work fine. + */ +class IteratorProxy implements AdminIterator { + /** + * The <code>Uuid</code> of the iteration this + * proxy is associated with. + */ + private final Uuid iterationUuid; + + /** + * Reference to the server. + * Only assigned by this class. + */ + volatile OutriggerAdmin server; + + /** Last set of reps we got from the server */ + private volatile EntryRep[] reps; + + /** + * Index of the next entry in rep to return. If <code>delete()</code> + * we will call <code>iter.delete()</code> next - 1 + */ + private volatile int next = -1; + + /** + * How many entries to ask for each time we go to the server + */ + private final int fetchSize; + + /** ID of last entry we got from server */ + private volatile Uuid lastId = null; + + /** + * Create client side iterator proxy. + * @param iterationUuid The identity of the iteration this proxy is for. + * @param server reference to remote server for the space. + * @param fetchSize Number of entries to ask for when it goes to the + * server + * @throws NullPointerException if <code>server</code> or + * <code>iterationUuid</code> is <code>null</code>. + */ + IteratorProxy(Uuid iterationUuid, OutriggerAdmin server, int fetchSize) { + if (iterationUuid == null) + throw new NullPointerException("iterationUuid must be non-null"); + + if (server == null) + throw new NullPointerException("server must be non-null"); + + if (fetchSize <= 0 && fetchSize != JavaSpaceAdmin.USE_DEFAULT) + throw new IllegalArgumentException + ("fetchSize must be postive or JavaSpaceAdmin.USE_DEFAULT"); + + this.iterationUuid = iterationUuid; + this.server = server; + this.fetchSize = fetchSize; + } + + // purposefully inherit doc comment from supertype + public Entry next() throws UnusableEntryException, RemoteException { + assertOpen(); + + if (next < 0 || next >= reps.length) { + // Need to get more Entries + reps = server.nextReps(iterationUuid, fetchSize, lastId); + + if (reps == null) { + // Finished + close(); + return null; + } + + lastId = reps[reps.length-1].id(); + + next = 0; + } + + // This may throw UnusableEntryException, but that's + // the right thing + return reps[next++].entry(); + } + + // purposefully inherit doc comment from supertype + public void delete() throws RemoteException { + if (next < 0) + throw new IllegalStateException("AdminIterator:Can't call " + + "delete before calling next()"); + + assertOpen(); + server.delete(iterationUuid, reps[next-1].id()); + } + + // purposefully inherit doc comment from supertype + public void close() throws RemoteException { + if (server != null) { + // always set to null, and then try to use the remote method, + // which is actually optional + OutriggerAdmin it = server; + server = null; + reps = null; + it.close(iterationUuid); + } + } + + /** + * Throw <code>IllegalStateException</code> if this iterator + * has been closed; otherwise just return. + */ + private void assertOpen() throws IllegalStateException { + if (server == null) { + throw new IllegalStateException("closed AdminIterator"); + } + } + + public String toString() { + return getClass().getName() + " for " + iterationUuid + + " (through " + server + ")"; + } +} Modified: river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/MatchSetData.java URL: http://svn.apache.org/viewvc/river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/MatchSetData.java?rev=1879521&r1=1879520&r2=1879521&view=diff ============================================================================== --- river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/MatchSetData.java (original) +++ river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/MatchSetData.java Sun Jul 5 11:41:39 2020 @@ -1,58 +1,58 @@ -/* - * 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 org.apache.river.outrigger; - -import net.jini.id.Uuid; - -/** - * Simple struct to hold the <code>Uuid</code> for a new - * <code>MatchSet</code> instance and the first batch of - * data. Also holds initial lease time. - */ -class MatchSetData implements java.io.Serializable { - private static final long serialVersionUID = 1L; - - /** - * <code>Uuid</code> for iteration and associated lease. - * <code>null</code> if the entire iteration is in - * <code>reps</code>. - */ - final Uuid uuid; - - /** Intial set of entries */ - final EntryRep[] reps; - - /** - * Initial lease time. Negative if the entire iteration is in - * <code>reps</code>. - */ - final long intialLeaseDuration; - - /** - * Creates a new MatchSetData instance. - * @param uuid value of <code>uuid</code> field. - * @param reps value of <code>reps</code> field. - * @param intialLeaseDuration value of <code>intialLeaseDuration</code> - * field. - */ - MatchSetData(Uuid uuid, EntryRep[] reps, long intialLeaseDuration) { - this.uuid = uuid; - this.reps = reps; - this.intialLeaseDuration = intialLeaseDuration; - } -} +/* + * 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 org.apache.river.outrigger.proxy; + +import net.jini.id.Uuid; + +/** + * Simple struct to hold the <code>Uuid</code> for a new + * <code>MatchSet</code> instance and the first batch of + * data. Also holds initial lease time. + */ +public class MatchSetData implements java.io.Serializable { + private static final long serialVersionUID = 1L; + + /** + * <code>Uuid</code> for iteration and associated lease. + * <code>null</code> if the entire iteration is in + * <code>reps</code>. + */ + final Uuid uuid; + + /** Intial set of entries */ + final EntryRep[] reps; + + /** + * Initial lease time. Negative if the entire iteration is in + * <code>reps</code>. + */ + final long intialLeaseDuration; + + /** + * Creates a new MatchSetData instance. + * @param uuid value of <code>uuid</code> field. + * @param reps value of <code>reps</code> field. + * @param intialLeaseDuration value of <code>intialLeaseDuration</code> + * field. + */ + public MatchSetData(Uuid uuid, EntryRep[] reps, long intialLeaseDuration) { + this.uuid = uuid; + this.reps = reps; + this.intialLeaseDuration = intialLeaseDuration; + } +} Modified: river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/MatchSetProxy.java URL: http://svn.apache.org/viewvc/river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/MatchSetProxy.java?rev=1879521&r1=1879520&r2=1879521&view=diff ============================================================================== --- river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/MatchSetProxy.java (original) +++ river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/MatchSetProxy.java Sun Jul 5 11:41:39 2020 @@ -1,107 +1,107 @@ -/* - * 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 org.apache.river.outrigger; - -import java.rmi.RemoteException; - -import net.jini.core.entry.Entry; -import net.jini.core.entry.UnusableEntryException; -import net.jini.core.lease.Lease; -import net.jini.id.Uuid; -import net.jini.space.MatchSet; - -/** - * Outrigger's implementation of <code>MatchSet</code>. - * Outrigger's implementation of the <code>JavaSpace05.contents</code> - * method returns objects of this type. Created with an initial set of - * entries from the match set and supports pre-fetching whenever it - * needs additional entries. <code>RemoteException</code>s encountered - * when making a remote call to fetch the next batch of entries from - * the space generally do not invalidate the proxy or the match set. - * <p> - * Note, there is no way to serialize or otherwise copy instances of - * this class so the default equals implementation should suffice. - */ -class MatchSetProxy implements MatchSet { - /** The remote server this proxy works with. */ - final private OutriggerServer space; - - /** ID of the associated query (and lease) */ - final private Uuid uuid; - - /** Lease assocated with this query */ - final private Lease lease; - - /** Last batch fetched from server */ - private volatile EntryRep[] reps; - - /** Last rep returned */ - private volatile EntryRep lastRepReturned; - - /** Current index into reps */ - private volatile int i; - - /** True if reps[i] could not be unpacked */ - private volatile boolean unpackFailure = true; - - MatchSetProxy(MatchSetData inital, SpaceProxy2 parent, OutriggerServer space) { - uuid = inital.uuid; - this.space = space; - if (uuid != null) - lease = parent.newLease(uuid, inital.intialLeaseDuration); - else - lease = null; - reps = inital.reps; - - i=0; - } - - public Lease getLease() { - return lease; - } - - public Entry next() throws RemoteException, UnusableEntryException { - if (i >= reps.length) { - // Fetch another batch - i = 0; - reps = space.nextBatch(uuid, lastRepReturned.id()); - } - - if (reps[i] == null) - return null; - - unpackFailure = true; - lastRepReturned = reps[i++]; - final Entry rslt = lastRepReturned.entry(); - unpackFailure = false; - return rslt; - } - - public Entry getSnapshot() { - if (unpackFailure) - throw new IllegalStateException( - "getSnapshot - need successful next call first"); - - return new SnapshotRep(lastRepReturned); - } - - public String toString() { - return getClass().getName() + " for " + uuid + - " (through " + space + ")"; - } -} +/* + * 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 org.apache.river.outrigger.proxy; + +import java.rmi.RemoteException; + +import net.jini.core.entry.Entry; +import net.jini.core.entry.UnusableEntryException; +import net.jini.core.lease.Lease; +import net.jini.id.Uuid; +import net.jini.space.MatchSet; + +/** + * Outrigger's implementation of <code>MatchSet</code>. + * Outrigger's implementation of the <code>JavaSpace05.contents</code> + * method returns objects of this type. Created with an initial set of + * entries from the match set and supports pre-fetching whenever it + * needs additional entries. <code>RemoteException</code>s encountered + * when making a remote call to fetch the next batch of entries from + * the space generally do not invalidate the proxy or the match set. + * <p> + * Note, there is no way to serialize or otherwise copy instances of + * this class so the default equals implementation should suffice. + */ +class MatchSetProxy implements MatchSet { + /** The remote server this proxy works with. */ + final private OutriggerServer space; + + /** ID of the associated query (and lease) */ + final private Uuid uuid; + + /** Lease assocated with this query */ + final private Lease lease; + + /** Last batch fetched from server */ + private volatile EntryRep[] reps; + + /** Last rep returned */ + private volatile EntryRep lastRepReturned; + + /** Current index into reps */ + private volatile int i; + + /** True if reps[i] could not be unpacked */ + private volatile boolean unpackFailure = true; + + MatchSetProxy(MatchSetData inital, SpaceProxy2 parent, OutriggerServer space) { + uuid = inital.uuid; + this.space = space; + if (uuid != null) + lease = parent.newLease(uuid, inital.intialLeaseDuration); + else + lease = null; + reps = inital.reps; + + i=0; + } + + public Lease getLease() { + return lease; + } + + public Entry next() throws RemoteException, UnusableEntryException { + if (i >= reps.length) { + // Fetch another batch + i = 0; + reps = space.nextBatch(uuid, lastRepReturned.id()); + } + + if (reps[i] == null) + return null; + + unpackFailure = true; + lastRepReturned = reps[i++]; + final Entry rslt = lastRepReturned.entry(); + unpackFailure = false; + return rslt; + } + + public Entry getSnapshot() { + if (unpackFailure) + throw new IllegalStateException( + "getSnapshot - need successful next call first"); + + return new SnapshotRep(lastRepReturned); + } + + public String toString() { + return getClass().getName() + " for " + uuid + + " (through " + space + ")"; + } +} Modified: river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/OutriggerAdmin.java URL: http://svn.apache.org/viewvc/river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/OutriggerAdmin.java?rev=1879521&r1=1879520&r2=1879521&view=diff ============================================================================== --- river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/OutriggerAdmin.java (original) +++ river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/OutriggerAdmin.java Sun Jul 5 11:41:39 2020 @@ -1,88 +1,88 @@ -/* - * 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 org.apache.river.outrigger; - -import org.apache.river.admin.DestroyAdmin; -import net.jini.id.Uuid; - -import java.rmi.Remote; -import java.rmi.RemoteException; - -import net.jini.admin.JoinAdmin; -import net.jini.core.transaction.Transaction; -import net.jini.core.transaction.TransactionException; -import net.jini.space.JavaSpace; - -/** - * The interface that is used by the <code>AdminProxy</code> to talk - * to the server. In other words, this is the server's analog to the - * <code>JavaSpaceAdmin</code> interface. - * - * @author Sun Microsystems, Inc. - * - * @see JavaSpaceAdmin - */ -// @see OutriggerServerImpl#AdminProxy -interface OutriggerAdmin extends Remote, DestroyAdmin, JoinAdmin { - /** Return the space administered by this object. */ - JavaSpace space() throws RemoteException; - - /** - * Return the remote iterator object needed by - * <code>JavaSpaceAdmin.contents</code>. - */ - Uuid contents(EntryRep tmpl, Transaction txn) - throws TransactionException, RemoteException; - - /** - * Fetch up to <code>max</code> <code>EntryRep</code> objects from - * the specified iteration. - * - * @param iterationUuid The <code>Uuid</code> of the iteration - * to fetch entries from. - * @param max Advice on the number of entries to return - * @param entryUuid <code>Uuid</code> of the last entry received by the - * caller. If this does not match the ID of the last - * entry sent by the iterator will re-send that last - * batch in place of a new batch. May be - * <code>null</code> in which case a new batch will be - * sent. The first call to <code>next()</code> should - * have <code>id</code> set to <code>null</code> - */ - EntryRep[] nextReps(Uuid iterationUuid, int max, - Uuid entryUuid) - throws RemoteException; - - /** - * Delete the given entry if the given iteration is still - * valid and the entry was retured by the last call to - * <code>nextReps</code>. - * @param iterationUuid The <code>Uuid</code> of a valid - * iteration. - * @param entryUuid the <code>Uuid</code> of the entry - * to be deleted. - */ - void delete(Uuid iterationUuid, Uuid entryUuid) throws RemoteException; - - /** - * Forget about the indicated iteration - * @param iterationUuid The <code>Uuid</code> iteration to close. - */ - void close(Uuid iterationUuid) throws RemoteException; -} - +/* + * 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 org.apache.river.outrigger.proxy; + +import org.apache.river.admin.DestroyAdmin; +import net.jini.id.Uuid; + +import java.rmi.Remote; +import java.rmi.RemoteException; + +import net.jini.admin.JoinAdmin; +import net.jini.core.transaction.Transaction; +import net.jini.core.transaction.TransactionException; +import net.jini.space.JavaSpace; + +/** + * The interface that is used by the <code>AdminProxy</code> to talk + * to the server. In other words, this is the server's analog to the + * <code>JavaSpaceAdmin</code> interface. + * + * @author Sun Microsystems, Inc. + * + * @see JavaSpaceAdmin + */ +// @see OutriggerServerImpl#AdminProxy +interface OutriggerAdmin extends Remote, DestroyAdmin, JoinAdmin { + /** Return the space administered by this object. */ + JavaSpace space() throws RemoteException; + + /** + * Return the remote iterator object needed by + * <code>JavaSpaceAdmin.contents</code>. + */ + Uuid contents(EntryRep tmpl, Transaction txn) + throws TransactionException, RemoteException; + + /** + * Fetch up to <code>max</code> <code>EntryRep</code> objects from + * the specified iteration. + * + * @param iterationUuid The <code>Uuid</code> of the iteration + * to fetch entries from. + * @param max Advice on the number of entries to return + * @param entryUuid <code>Uuid</code> of the last entry received by the + * caller. If this does not match the ID of the last + * entry sent by the iterator will re-send that last + * batch in place of a new batch. May be + * <code>null</code> in which case a new batch will be + * sent. The first call to <code>next()</code> should + * have <code>id</code> set to <code>null</code> + */ + EntryRep[] nextReps(Uuid iterationUuid, int max, + Uuid entryUuid) + throws RemoteException; + + /** + * Delete the given entry if the given iteration is still + * valid and the entry was retured by the last call to + * <code>nextReps</code>. + * @param iterationUuid The <code>Uuid</code> of a valid + * iteration. + * @param entryUuid the <code>Uuid</code> of the entry + * to be deleted. + */ + void delete(Uuid iterationUuid, Uuid entryUuid) throws RemoteException; + + /** + * Forget about the indicated iteration + * @param iterationUuid The <code>Uuid</code> iteration to close. + */ + void close(Uuid iterationUuid) throws RemoteException; +} + Modified: river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/OutriggerAvailabilityEvent.java URL: http://svn.apache.org/viewvc/river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/OutriggerAvailabilityEvent.java?rev=1879521&r1=1879520&r2=1879521&view=diff ============================================================================== --- river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/OutriggerAvailabilityEvent.java (original) +++ river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/OutriggerAvailabilityEvent.java Sun Jul 5 11:41:39 2020 @@ -1,73 +1,73 @@ -/* - * 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 org.apache.river.outrigger; - -import java.io.InvalidObjectException; -import java.rmi.MarshalledObject; -import net.jini.core.entry.Entry; -import net.jini.core.entry.UnusableEntryException; -import net.jini.core.event.RemoteEvent; -import net.jini.space.JavaSpace; -import net.jini.space.AvailabilityEvent; - -/** - * Outrigger's implementation of <code>AvailabilityEvent</code> - */ -class OutriggerAvailabilityEvent extends AvailabilityEvent { - private static final long serialVersionUID = 1L; - - /** The entry that triggered the event */ - final private EntryRep rep; - - /** - * Constructs an OutriggerAvailabilityEvent object. - * - * @param source an <code>Object</code> representing the event source - * @param eventID a <code>long</code> containing the event identifier - * @param seqNum a <code>long</code> containing the event sequence number - * @param handback a <code>MarshalledObject</code> that was passed in - * as part of the original event registration. - * @param visibilityTransition <code>true</code> if this event - * must also signal a transition from - * invisible to visible - * @param rep the entry that triggered the event - */ - OutriggerAvailabilityEvent(JavaSpace source, long eventID, - long seqNum, MarshalledObject handback, boolean visibilityTransition, - EntryRep rep) - { - super(source, eventID, seqNum, handback, visibilityTransition); - this.rep = rep; - } - - /** - * @throws InvalidObjectException if called - */ - private void readObjectNoData() throws InvalidObjectException { - throw new InvalidObjectException( - "OutriggerAvailabilityEvent should always have data"); - } - - public Entry getEntry() throws UnusableEntryException { - return rep.entry(); - } - - public Entry getSnapshot() { - return new SnapshotRep(rep); - } -} +/* + * 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 org.apache.river.outrigger.proxy; + +import java.io.InvalidObjectException; +import java.rmi.MarshalledObject; +import net.jini.core.entry.Entry; +import net.jini.core.entry.UnusableEntryException; +import net.jini.core.event.RemoteEvent; +import net.jini.space.JavaSpace; +import net.jini.space.AvailabilityEvent; + +/** + * Outrigger's implementation of <code>AvailabilityEvent</code> + */ +public class OutriggerAvailabilityEvent extends AvailabilityEvent { + private static final long serialVersionUID = 1L; + + /** The entry that triggered the event */ + final private EntryRep rep; + + /** + * Constructs an OutriggerAvailabilityEvent object. + * + * @param source an <code>Object</code> representing the event source + * @param eventID a <code>long</code> containing the event identifier + * @param seqNum a <code>long</code> containing the event sequence number + * @param handback a <code>MarshalledObject</code> that was passed in + * as part of the original event registration. + * @param visibilityTransition <code>true</code> if this event + * must also signal a transition from + * invisible to visible + * @param rep the entry that triggered the event + */ + public OutriggerAvailabilityEvent(JavaSpace source, long eventID, + long seqNum, MarshalledObject handback, boolean visibilityTransition, + EntryRep rep) + { + super(source, eventID, seqNum, handback, visibilityTransition); + this.rep = rep; + } + + /** + * @throws InvalidObjectException if called + */ + private void readObjectNoData() throws InvalidObjectException { + throw new InvalidObjectException( + "OutriggerAvailabilityEvent should always have data"); + } + + public Entry getEntry() throws UnusableEntryException { + return rep.entry(); + } + + public Entry getSnapshot() { + return new SnapshotRep(rep); + } +} Modified: river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/OutriggerPermission.java URL: http://svn.apache.org/viewvc/river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/OutriggerPermission.java?rev=1879521&r1=1879520&r2=1879521&view=diff ============================================================================== --- river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/OutriggerPermission.java (original) +++ river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/OutriggerPermission.java Sun Jul 5 11:41:39 2020 @@ -1,50 +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 org.apache.river.outrigger; - -import net.jini.security.AccessPermission; -import net.jini.jeri.BasicInvocationDispatcher; -import net.jini.jeri.BasicJeriExporter; - -/** - * Permission that can be used to express the access control policy for an - * instance of an Outrigger server exported with a {@link - * BasicJeriExporter}. This class can be specified to {@link - * BasicInvocationDispatcher}, which will then perform permission checks for - * incoming remote calls using <code>OutriggerPermission</code> instances. - * - * @author Sun Microsystems, Inc. - * @since 2.0 - */ -public class OutriggerPermission extends AccessPermission { - private static final long serialVersionUID = 1; - - /** - * Create a new <code>OutriggerPermission</code> instance. - * See {@link AccessPermission} for details on - * the name parameter. - * @param name the target name - * @throws NullPointerException if the target name is <code>null</code> - * @throws IllegalArgumentException if the target name does not match - * the syntax specified in the comments at the beginning of - * {@link AccessPermission}. - */ - public OutriggerPermission(String name) { - super(name); - } -} +/* + * 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 org.apache.river.outrigger.proxy; + +import net.jini.security.AccessPermission; +import net.jini.jeri.BasicInvocationDispatcher; +import net.jini.jeri.BasicJeriExporter; + +/** + * Permission that can be used to express the access control policy for an + * instance of an Outrigger server exported with a {@link + * BasicJeriExporter}. This class can be specified to {@link + * BasicInvocationDispatcher}, which will then perform permission checks for + * incoming remote calls using <code>OutriggerPermission</code> instances. + * + * @author Sun Microsystems, Inc. + * @since 2.0 + */ +public class OutriggerPermission extends AccessPermission { + private static final long serialVersionUID = 1; + + /** + * Create a new <code>OutriggerPermission</code> instance. + * See {@link AccessPermission} for details on + * the name parameter. + * @param name the target name + * @throws NullPointerException if the target name is <code>null</code> + * @throws IllegalArgumentException if the target name does not match + * the syntax specified in the comments at the beginning of + * {@link AccessPermission}. + */ + public OutriggerPermission(String name) { + super(name); + } +} Modified: river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/OutriggerQueryCookie.java URL: http://svn.apache.org/viewvc/river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/OutriggerQueryCookie.java?rev=1879521&r1=1879520&r2=1879521&view=diff ============================================================================== --- river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/OutriggerQueryCookie.java (original) +++ river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/OutriggerQueryCookie.java Sun Jul 5 11:41:39 2020 @@ -1,46 +1,46 @@ -/* - * 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 org.apache.river.outrigger; - -/** - * Object <code>OutriggerServerImpl</code> uses to pass context between - * related sub-queries. - */ -class OutriggerQueryCookie - implements OutriggerServer.QueryCookie, java.io.Serializable -{ - private static final long serialVersionUID = 1L; - - /** - * The time the first sub-query in a given series was started - */ - final long startTime; - - /** - * Create a new <code>OutriggerQueryCookie</code> with - * the specified value for the <code>startTime</code>. - */ - OutriggerQueryCookie(long startTime) { - this.startTime = startTime; - } - - public String toString() { - return "OutriggerQueryCookie startTime:" + startTime; - } -} - +/* + * 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 org.apache.river.outrigger.proxy; + +/** + * Object <code>OutriggerServerImpl</code> uses to pass context between + * related sub-queries. + */ +public class OutriggerQueryCookie + implements OutriggerServer.QueryCookie, java.io.Serializable +{ + private static final long serialVersionUID = 1L; + + /** + * The time the first sub-query in a given series was started + */ + public final long startTime; + + /** + * Create a new <code>OutriggerQueryCookie</code> with + * the specified value for the <code>startTime</code>. + */ + public OutriggerQueryCookie(long startTime) { + this.startTime = startTime; + } + + public String toString() { + return "OutriggerQueryCookie startTime:" + startTime; + } +} +
