Modified: river/jtsk/modules/modularize/apache-river/river-services/norm/norm-service/src/main/java/org/apache/river/norm/PersistentStore.java URL: http://svn.apache.org/viewvc/river/jtsk/modules/modularize/apache-river/river-services/norm/norm-service/src/main/java/org/apache/river/norm/PersistentStore.java?rev=1879521&r1=1879520&r2=1879521&view=diff ============================================================================== --- river/jtsk/modules/modularize/apache-river/river-services/norm/norm-service/src/main/java/org/apache/river/norm/PersistentStore.java (original) +++ river/jtsk/modules/modularize/apache-river/river-services/norm/norm-service/src/main/java/org/apache/river/norm/PersistentStore.java Sun Jul 5 11:41:39 2020 @@ -1,301 +1,306 @@ -/* - * 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.norm; - -import java.io.File; -import java.io.IOException; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; - -import net.jini.config.ConfigurationException; - -import org.apache.river.norm.lookup.SubStore; -import org.apache.river.reliableLog.LogHandler; -import org.apache.river.reliableLog.ReliableLog; -import org.apache.river.system.FileSystem; -import org.apache.river.thread.ReadersWriter; - -/** - * Class that actually stores a Norm server's state to disk. Basically - * a wrapper around ReliableLog with the addition of lock management. - * - * @author Sun Microsystems, Inc. - */ -class PersistentStore { - /** Logger for logging messages for this class */ - private static final Logger logger = Logger.getLogger("org.apache.river.norm"); - - /** - * Object we use to reliably and persistently log updates to our - * state, or null if not persistent. - */ - private ReliableLog log; - - /** - * No mutation of persistent state can occur during a snapshot, - * however, we can have multiple mutators, use - * <code>ReadersWriter</code> object to manage this invariant. Note - * as far as the lock is concerned the mutators are the readers and - * snapshot thread the writer since for us mutation is the - * non-exclusive operation. - */ - final private ReadersWriter mutatorLock = new ReadersWriter(); - - /** - * Thread local that tracks if (and how many times) the current thread - * has acquired a non-exclusive mutator lock. - */ - final static private ThreadLocal lockState = new ThreadLocal(); - - /** Cache a <code>Long</code> object with a zero value */ - final static private Long zero = Long.valueOf(0); - - /** Location of the persistent store, or null if not persistent */ - final private File storeLocation; - - /** Object that handles the recovery of logs, or null if not persistent */ - final private LogHandler logHandler; - - /** The NormServer we are part of */ - private NormServerBaseImpl server; - - /** Number of updates since last snapshot */ - private int updateCount; - - /** A list of all of the sub-stores */ - private List subStores = new LinkedList(); - - /** - * Construct a store that will persist its data to the specified - * directory. - * - * @param logDir directory where the store should persist its data, - * which must exist, unless it is <code>null</code>, in which case - * there is no persistence - * @param logHandler object that will process the log and last - * snapshot to recover the server's state - * @param server the server is called back after an update so it can - * decide whether or not to do a snapshot - * @throws StoreException if there is a problem setting up the store - */ - PersistentStore(String logDir, LogHandler logHandler, - NormServerBaseImpl server) - throws StoreException - { - this.logHandler = logHandler; - this.server = server; - if (logDir == null) { - storeLocation = null; - } else { - storeLocation = new File(logDir); - try { - log = new ReliableLog( - storeLocation.getCanonicalPath(), logHandler); - } catch (IOException e) { - throw new CorruptedStoreException( - "Failure creating reliable log", e); - } - - try { - log.recover(); - } catch (IOException e) { - throw new CorruptedStoreException( - "Failure recovering reliable log", e); - } - } - } - - /** - * Can only be called once after construction. - * @param server - */ - void setServer(NormServerBaseImpl server){ - synchronized (this){ - if (this.server == null) this.server = server; - } - } - - /** - * Destroy the store. - * - * @throws IOException if it has difficulty removing the log files - */ - void destroy() throws IOException { - // Prep all the sub-stores to be destroyed - synchronized (subStores){ - for (Iterator i = subStores.iterator(); i.hasNext(); ) { - SubStore subStore = (SubStore) i.next(); - subStore.prepareDestroy(); - } - } - if (log != null) { - log.deletePersistentStore(); - FileSystem.destroy(storeLocation, true); - } - } - - /** - * Inform the store of a sub-store - */ - void addSubStore(SubStore subStore) throws StoreException { - try { - if (log == null) { - subStore.setDirectory(null); - } else { - final String subDir = subStore.subDirectory(); - - if (subDir == null) { - subStore.setDirectory(storeLocation); - } else { - subStore.setDirectory(new File(storeLocation, subDir)); - } - } - synchronized (subStores){ - subStores.add(subStore); - } - } catch (IOException e) { - throw new StoreException("Failure adding substore " + subStore, - e); - } catch (ConfigurationException e) { - throw new StoreException("Failure adding substore " + subStore, - e); - } - } - - - ///////////////////////////////////////////////////////////////// - // Methods for obtaining and releasing the locks on the store - - /** - * Block until we can acquire a non-exclusive mutator lock on the - * server's persistent state. This lock should be acquired in a - * <code>try</code> block and a <code>releaseMutatorLock</code> call - * should be placed in a <code>finally</code> block. - */ - void acquireMutatorLock() { - // Do we already hold a lock? - - Long lockStateVal = (Long) lockState.get(); - if (lockStateVal == null) - lockStateVal = zero; - - final long longVal = lockStateVal.longValue(); - - if (longVal == 0) { - // No, this thread currently does not hold a lock, - // grab non-exclusive lock (which for mutatorLock is a - // read lock) - mutatorLock.readLock(); - } - - // Either way, bump the lock count and update our thread state - lockState.set(Long.valueOf(longVal + 1)); - } - - /** - * Release one level of mutator locks if this thread holds at least one. - */ - void releaseMutatorLock() { - Long lockStateVal = (Long) lockState.get(); - if (lockStateVal == null) - lockStateVal = zero; - - final long longVal = lockStateVal.longValue(); - - if (longVal == 0) { - // No lock to release, return - return; - } - - if (longVal == 1) { - // Last one on stack release lock - // Using read lock because we want a non-exclusive lock - mutatorLock.readUnlock(); - lockStateVal = zero; - } else { - lockStateVal = Long.valueOf(longVal - 1); - } - - lockState.set(lockStateVal); - } - - ////////////////////////////////////////////////////////////////// - // Methods for writing records to the log and taking and - // coordinating snapshots - - /** - * Log an update. Will flush to disk before returning. - * - * @throws IllegalStateException if the current thread does not hold - * a non-exclusive mutator lock - * @throws IOException - * @see ReliableLog#update - */ - void update(Object o) { - if (log == null) { - return; - } - final Long lockStateVal = (Long) lockState.get(); - if (lockStateVal == null || lockStateVal.longValue() == 0) { - throw new IllegalStateException("PersistentStore.update:" + - "Must acquire mutator lock before calling update()"); - } - - synchronized (this) { - try { - log.update(o, true); - updateCount++; - server.updatePerformed(updateCount); - } catch (IOException e) { - // $$$ should probably be propagating this exception - logger.log(Level.WARNING, "IOException while updating log", e); - } - } - } - - /** - * Generate a snapshot, will perform the necessary locking to ensure no - * threads are mutating the state of the server before creating the - * snapshot. - * - * @throws IOException - * @see ReliableLog#snapshot - */ - void snapshot() throws IOException { - if (log == null) { - return; - } - try { - // Using write lock because we want an exclusive lock - mutatorLock.writeLock(); - synchronized (this){ - updateCount = 0; - } - - // Don't need to sync on this because - // mutatorLock.writeLock() gives us an exclusive lock - log.snapshot(); - } finally { - // Using write lock because we want an exclusive lock - mutatorLock.writeUnlock(); - } - } -} +/* + * 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.norm; + +import java.io.File; +import java.io.IOException; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; + +import net.jini.config.ConfigurationException; + +import org.apache.river.norm.lookup.SubStore; +import org.apache.river.reliableLog.LogHandler; +import org.apache.river.reliableLog.ReliableLog; +import org.apache.river.system.FileSystem; +import org.apache.river.thread.ReadersWriter; + +import org.apache.river.norm.proxy.CorruptedStoreException; +import org.apache.river.norm.proxy.StoreException; + +import org.apache.river.start.lifecycle.LifeCycle; + +/** + * Class that actually stores a Norm server's state to disk. Basically + * a wrapper around ReliableLog with the addition of lock management. + * + * @author Sun Microsystems, Inc. + */ +class PersistentStore { + /** Logger for logging messages for this class */ + private static final Logger logger = Logger.getLogger("org.apache.river.norm"); + + /** + * Object we use to reliably and persistently log updates to our + * state, or null if not persistent. + */ + private ReliableLog log; + + /** + * No mutation of persistent state can occur during a snapshot, + * however, we can have multiple mutators, use + * <code>ReadersWriter</code> object to manage this invariant. Note + * as far as the lock is concerned the mutators are the readers and + * snapshot thread the writer since for us mutation is the + * non-exclusive operation. + */ + final private ReadersWriter mutatorLock = new ReadersWriter(); + + /** + * Thread local that tracks if (and how many times) the current thread + * has acquired a non-exclusive mutator lock. + */ + final static private ThreadLocal lockState = new ThreadLocal(); + + /** Cache a <code>Long</code> object with a zero value */ + final static private Long zero = Long.valueOf(0); + + /** Location of the persistent store, or null if not persistent */ + final private File storeLocation; + + /** Object that handles the recovery of logs, or null if not persistent */ + final private LogHandler logHandler; + + /** The NormServer we are part of */ + private NormServerBaseImpl server; + + /** Number of updates since last snapshot */ + private int updateCount; + + /** A list of all of the sub-stores */ + private List subStores = new LinkedList(); + + /** + * Construct a store that will persist its data to the specified + * directory. + * + * @param logDir directory where the store should persist its data, + * which must exist, unless it is <code>null</code>, in which case + * there is no persistence + * @param logHandler object that will process the log and last + * snapshot to recover the server's state + * @param server the server is called back after an update so it can + * decide whether or not to do a snapshot + * @throws StoreException if there is a problem setting up the store + */ + PersistentStore(String logDir, LogHandler logHandler, + NormServerBaseImpl server) + throws StoreException + { + this.logHandler = logHandler; + this.server = server; + if (logDir == null) { + storeLocation = null; + } else { + storeLocation = new File(logDir); + try { + log = new ReliableLog( + storeLocation.getCanonicalPath(), logHandler); + } catch (IOException e) { + throw new CorruptedStoreException( + "Failure creating reliable log", e); + } + + try { + log.recover(); + } catch (IOException e) { + throw new CorruptedStoreException( + "Failure recovering reliable log", e); + } + } + } + + /** + * Can only be called once after construction. + * @param server + */ + void setServer(NormServerBaseImpl server){ + synchronized (this){ + if (this.server == null) this.server = server; + } + } + + /** + * Destroy the store. + * + * @throws IOException if it has difficulty removing the log files + */ + void destroy() throws IOException { + // Prep all the sub-stores to be destroyed + synchronized (subStores){ + for (Iterator i = subStores.iterator(); i.hasNext(); ) { + SubStore subStore = (SubStore) i.next(); + subStore.prepareDestroy(); + } + } + if (log != null) { + log.deletePersistentStore(); + FileSystem.destroy(storeLocation, true); + } + } + + /** + * Inform the store of a sub-store + */ + void addSubStore(SubStore subStore) throws StoreException { + try { + if (log == null) { + subStore.setDirectory(null); + } else { + final String subDir = subStore.subDirectory(); + + if (subDir == null) { + subStore.setDirectory(storeLocation); + } else { + subStore.setDirectory(new File(storeLocation, subDir)); + } + } + synchronized (subStores){ + subStores.add(subStore); + } + } catch (IOException e) { + throw new StoreException("Failure adding substore " + subStore, + e); + } catch (ConfigurationException e) { + throw new StoreException("Failure adding substore " + subStore, + e); + } + } + + + ///////////////////////////////////////////////////////////////// + // Methods for obtaining and releasing the locks on the store + + /** + * Block until we can acquire a non-exclusive mutator lock on the + * server's persistent state. This lock should be acquired in a + * <code>try</code> block and a <code>releaseMutatorLock</code> call + * should be placed in a <code>finally</code> block. + */ + void acquireMutatorLock() { + // Do we already hold a lock? + + Long lockStateVal = (Long) lockState.get(); + if (lockStateVal == null) + lockStateVal = zero; + + final long longVal = lockStateVal.longValue(); + + if (longVal == 0) { + // No, this thread currently does not hold a lock, + // grab non-exclusive lock (which for mutatorLock is a + // read lock) + mutatorLock.readLock(); + } + + // Either way, bump the lock count and update our thread state + lockState.set(Long.valueOf(longVal + 1)); + } + + /** + * Release one level of mutator locks if this thread holds at least one. + */ + void releaseMutatorLock() { + Long lockStateVal = (Long) lockState.get(); + if (lockStateVal == null) + lockStateVal = zero; + + final long longVal = lockStateVal.longValue(); + + if (longVal == 0) { + // No lock to release, return + return; + } + + if (longVal == 1) { + // Last one on stack release lock + // Using read lock because we want a non-exclusive lock + mutatorLock.readUnlock(); + lockStateVal = zero; + } else { + lockStateVal = Long.valueOf(longVal - 1); + } + + lockState.set(lockStateVal); + } + + ////////////////////////////////////////////////////////////////// + // Methods for writing records to the log and taking and + // coordinating snapshots + + /** + * Log an update. Will flush to disk before returning. + * + * @throws IllegalStateException if the current thread does not hold + * a non-exclusive mutator lock + * @throws IOException + * @see ReliableLog#update + */ + void update(Object o) { + if (log == null) { + return; + } + final Long lockStateVal = (Long) lockState.get(); + if (lockStateVal == null || lockStateVal.longValue() == 0) { + throw new IllegalStateException("PersistentStore.update:" + + "Must acquire mutator lock before calling update()"); + } + + synchronized (this) { + try { + log.update(o, true); + updateCount++; + server.updatePerformed(updateCount); + } catch (IOException e) { + // $$$ should probably be propagating this exception + logger.log(Level.WARNING, "IOException while updating log", e); + } + } + } + + /** + * Generate a snapshot, will perform the necessary locking to ensure no + * threads are mutating the state of the server before creating the + * snapshot. + * + * @throws IOException + * @see ReliableLog#snapshot + */ + void snapshot() throws IOException { + if (log == null) { + return; + } + try { + // Using write lock because we want an exclusive lock + mutatorLock.writeLock(); + synchronized (this){ + updateCount = 0; + } + + // Don't need to sync on this because + // mutatorLock.writeLock() gives us an exclusive lock + log.snapshot(); + } finally { + // Using write lock because we want an exclusive lock + mutatorLock.writeUnlock(); + } + } +}
Modified: river/jtsk/modules/modularize/apache-river/river-services/norm/norm-service/src/main/java/org/apache/river/norm/TransientNormServerImpl.java URL: http://svn.apache.org/viewvc/river/jtsk/modules/modularize/apache-river/river-services/norm/norm-service/src/main/java/org/apache/river/norm/TransientNormServerImpl.java?rev=1879521&r1=1879520&r2=1879521&view=diff ============================================================================== --- river/jtsk/modules/modularize/apache-river/river-services/norm/norm-service/src/main/java/org/apache/river/norm/TransientNormServerImpl.java (original) +++ river/jtsk/modules/modularize/apache-river/river-services/norm/norm-service/src/main/java/org/apache/river/norm/TransientNormServerImpl.java Sun Jul 5 11:41:39 2020 @@ -1,46 +1,47 @@ -/* - * 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.norm; - -import org.apache.river.start.LifeCycle; -import org.apache.river.start.ServiceStarter; - -/** - * Provides a transient implementation of NormServer. - * - * @author Sun Microsystems, Inc. - * @since 2.0 - */ -class TransientNormServerImpl extends NormServerBaseImpl { - - /** - * Provides a constructor for a transient implementation of NormServer - * suitable for use with {@link ServiceStarter}. - * - * @param configOptions the arguments to use when creating the - * configuration for the server - * @param lifeCycle object to notify when this service is destroyed, or - * <code>null</code> - * @throws Exception if there is a problem creating the server - */ - TransientNormServerImpl(String[] configOptions, LifeCycle lifeCycle) - throws Exception - { - super(init( configOptions, new NormServerInitializer(false /* persistent */, lifeCycle))); - } -} +/* + * 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.norm; + +import org.apache.river.start.lifecycle.LifeCycle; +import org.apache.river.start.ServiceStarter; + + +/** + * Provides a transient implementation of NormServer. + * + * @author Sun Microsystems, Inc. + * @since 2.0 + */ +class TransientNormServerImpl extends NormServerBaseImpl { + + /** + * Provides a constructor for a transient implementation of NormServer + * suitable for use with {@link ServiceStarter}. + * + * @param configOptions the arguments to use when creating the + * configuration for the server + * @param lifeCycle object to notify when this service is destroyed, or + * <code>null</code> + * @throws Exception if there is a problem creating the server + */ + TransientNormServerImpl(String[] configOptions, LifeCycle lifeCycle) + throws Exception + { + super(init( configOptions, new NormServerInitializer(false /* persistent */, lifeCycle))); + } +} Modified: river/jtsk/modules/modularize/apache-river/river-services/norm/norm-service/src/main/java/org/apache/river/norm/event/EventType.java URL: http://svn.apache.org/viewvc/river/jtsk/modules/modularize/apache-river/river-services/norm/norm-service/src/main/java/org/apache/river/norm/event/EventType.java?rev=1879521&r1=1879520&r2=1879521&view=diff ============================================================================== --- river/jtsk/modules/modularize/apache-river/river-services/norm/norm-service/src/main/java/org/apache/river/norm/event/EventType.java (original) +++ river/jtsk/modules/modularize/apache-river/river-services/norm/norm-service/src/main/java/org/apache/river/norm/event/EventType.java Sun Jul 5 11:41:39 2020 @@ -31,8 +31,8 @@ import net.jini.security.ProxyPreparer; import org.apache.river.constants.ThrowableConstants; import org.apache.river.logging.Levels; -import org.apache.river.thread.RetryTask; -import org.apache.river.thread.WakeupManager; +import org.apache.river.thread.wakeup.RetryTask; +import org.apache.river.thread.wakeup.WakeupManager; import java.util.concurrent.ExecutorService; import net.jini.io.MarshalledInstance; Modified: river/jtsk/modules/modularize/apache-river/river-services/norm/norm-service/src/main/java/org/apache/river/norm/event/EventTypeGenerator.java URL: http://svn.apache.org/viewvc/river/jtsk/modules/modularize/apache-river/river-services/norm/norm-service/src/main/java/org/apache/river/norm/event/EventTypeGenerator.java?rev=1879521&r1=1879520&r2=1879521&view=diff ============================================================================== --- river/jtsk/modules/modularize/apache-river/river-services/norm/norm-service/src/main/java/org/apache/river/norm/event/EventTypeGenerator.java (original) +++ river/jtsk/modules/modularize/apache-river/river-services/norm/norm-service/src/main/java/org/apache/river/norm/event/EventTypeGenerator.java Sun Jul 5 11:41:39 2020 @@ -17,7 +17,7 @@ */ package org.apache.river.norm.event; -import org.apache.river.thread.WakeupManager; +import org.apache.river.thread.wakeup.WakeupManager; import java.io.IOException; import java.io.ObjectInputStream; import java.io.Serializable; Modified: river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/pom.xml URL: http://svn.apache.org/viewvc/river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/pom.xml?rev=1879521&r1=1879520&r2=1879521&view=diff ============================================================================== --- river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/pom.xml (original) +++ river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/pom.xml Sun Jul 5 11:41:39 2020 @@ -1,39 +1,40 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -~ Copyright (C) 2014 the original author or authors. -~ -~ Licensed 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. ---> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.river</groupId> - <artifactId>outrigger</artifactId> - <version>3.0-SNAPSHOT</version> - </parent> - - <groupId>org.apache.river.outrigger</groupId> - <artifactId>outrigger-dl</artifactId> - <url>http://river.apache.org</url> - <name>Module :: Outrigger Service Download classes</name> - - <dependencies> - <dependency> - <groupId>org.apache.river</groupId> - <artifactId>river-dl</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> - -</project> +<?xml version="1.0" encoding="UTF-8"?> +<!-- ~ Copyright (C) 2014 the original author or authors. ~ ~ Licensed 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. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.river</groupId> + <artifactId>outrigger</artifactId> + <version>3.0-SNAPSHOT</version> + </parent> + + <groupId>org.apache.river.outrigger</groupId> + <artifactId>outrigger-dl</artifactId> + <url>http://river.apache.org</url> + <name>Module :: Outrigger Service Download classes</name> + + <dependencies> + + <dependency> + <groupId>org.apache.river</groupId> + <artifactId>river-logging</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>org.apache.river</groupId> + <artifactId>river-dl</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + +</project> Modified: river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/AdminProxy.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/AdminProxy.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/AdminProxy.java (original) +++ river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/AdminProxy.java Sun Jul 5 11:41:39 2020 @@ -1,207 +1,208 @@ -/* - * 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.Serializable; -import java.io.ObjectInputStream; -import java.io.IOException; -import java.io.InvalidObjectException; -import java.rmi.RemoteException; - -import net.jini.core.discovery.LookupLocator; -import net.jini.core.entry.Entry; -import net.jini.core.transaction.Transaction; -import net.jini.core.transaction.TransactionException; - -import net.jini.space.JavaSpace; - -import net.jini.id.Uuid; -import net.jini.id.ReferentUuid; -import net.jini.id.ReferentUuids; - -/** - * <code>AdminProxy</code> objects are connected to particular - * <code>OutriggerServerImpl</code>s to implement the - * <code>JavaSpaceAdmin</code> interface for the server. - * - * @see JavaSpaceAdmin - */ -class AdminProxy implements JavaSpaceAdmin, ReferentUuid, Serializable { - private static final long serialVersionUID = 1L; - - /** Reference to the actual remote admin object. */ - final OutriggerAdmin admin; - - /** The <code>Uuid</code> that identifies the space this proxy is for */ - final Uuid spaceUuid; - - private static final boolean DEBUG = false; - - /** - * Create an <code>AdminProxy</code> for the given remote admin - * objects. - * @param admin reference to remote server for the space. - * @param spaceUuid universal unique ID for the space. - * @throws NullPointerException if <code>admin</code> or - * <code>spaceUuid</code> is <code>null</code>. - */ - AdminProxy(OutriggerAdmin admin, Uuid spaceUuid) { - if (admin == null) - throw new NullPointerException("admin must be non-null"); - if (spaceUuid == null) - throw new NullPointerException("spaceUuid must be non-null"); - this.admin = admin; - this.spaceUuid = spaceUuid; - } - - /** - * Read this object back and validate state. - */ - private void readObject(ObjectInputStream in) - throws IOException, ClassNotFoundException - { - in.defaultReadObject(); - - if (admin == null) - throw new InvalidObjectException("null server reference"); - - if (spaceUuid == null) - throw new InvalidObjectException("null Uuid"); - } - - /** - * We should always have data in the stream, if this method - * gets called there is something wrong. - */ - private void readObjectNoData() throws InvalidObjectException { - throw new - InvalidObjectException("SpaceProxy should always have data"); - } - - // inherit doc comment - public JavaSpace space() throws RemoteException { - return admin.space(); - } - - // inherit doc comment - public AdminIterator contents(Entry tmpl, Transaction tr) - throws TransactionException, RemoteException - { - return contents(tmpl, tr, USE_DEFAULT); - } - - // inherit doc comment - public AdminIterator contents(Entry tmpl, Transaction tr, int fetchSize) - throws TransactionException, RemoteException - { - return new IteratorProxy( - admin.contents(SpaceProxy2.repFor(tmpl), tr), admin, fetchSize); - } - - // inherit doc comment - public void destroy() throws RemoteException { - admin.destroy(); - } - - // JoinAdmin - // -------------------------------------------------- - // inherit doc comment - public Entry[] getLookupAttributes() throws RemoteException { - return admin.getLookupAttributes(); - } - - // inherit doc comment - public void addLookupAttributes(Entry[] attrSets) - throws RemoteException - { - admin.addLookupAttributes(attrSets); - } - - // inherit doc comment - public void modifyLookupAttributes(Entry[] attrSetTemplates, - Entry[] attrSets) - throws RemoteException - { - admin.modifyLookupAttributes(attrSetTemplates, attrSets); - } - - // inherit doc comment - public String[] getLookupGroups() throws RemoteException { - return admin.getLookupGroups(); - } - - // inherit doc comment - public void addLookupGroups(String[] groups) throws RemoteException { - admin.addLookupGroups(groups); - } - - // inherit doc comment - public void removeLookupGroups(String[] groups) - throws RemoteException - { - admin.removeLookupGroups(groups); - } - - // inherit doc comment - public void setLookupGroups(String[] groups) throws RemoteException { - admin.setLookupGroups(groups); - } - - // inherit doc comment - public LookupLocator[] getLookupLocators() throws RemoteException { - return admin.getLookupLocators(); - } - - // inherit doc comment - public void addLookupLocators(LookupLocator[] locators) - throws RemoteException - { - admin.addLookupLocators(locators); - } - - // inherit doc comment - public void removeLookupLocators(LookupLocator[] locators) - throws RemoteException - { - admin.removeLookupLocators(locators); - } - - // inherit doc comment - public void setLookupLocators(LookupLocator[] locators) - throws RemoteException - { - admin.setLookupLocators(locators); - } - - public String toString() { - return getClass().getName() + " for " + spaceUuid + - " (through " + admin + ")"; - } - - public boolean equals(Object other) { - return ReferentUuids.compare(this, other); - } - - public int hashCode() { - return spaceUuid.hashCode(); - } - - public Uuid getReferentUuid() { - return spaceUuid; - } -} +/* + * 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.Serializable; +import java.io.ObjectInputStream; +import java.io.IOException; +import java.io.InvalidObjectException; +import java.rmi.RemoteException; + +import net.jini.core.discovery.LookupLocator; +import net.jini.core.entry.Entry; +import net.jini.core.transaction.Transaction; +import net.jini.core.transaction.TransactionException; + +import net.jini.space.JavaSpace; +import org.apache.river.admin.JavaSpaceAdmin; +import org.apache.river.admin.AdminIterator; +import net.jini.id.Uuid; +import net.jini.id.ReferentUuid; +import net.jini.id.ReferentUuids; + +/** + * <code>AdminProxy</code> objects are connected to particular + * <code>OutriggerServerImpl</code>s to implement the + * <code>JavaSpaceAdmin</code> interface for the server. + * + * @see JavaSpaceAdmin + */ +public class AdminProxy implements JavaSpaceAdmin, ReferentUuid, Serializable { + private static final long serialVersionUID = 1L; + + /** Reference to the actual remote admin object. */ + final OutriggerAdmin admin; + + /** The <code>Uuid</code> that identifies the space this proxy is for */ + final Uuid spaceUuid; + + private static final boolean DEBUG = false; + + /** + * Create an <code>AdminProxy</code> for the given remote admin + * objects. + * @param admin reference to remote server for the space. + * @param spaceUuid universal unique ID for the space. + * @throws NullPointerException if <code>admin</code> or + * <code>spaceUuid</code> is <code>null</code>. + */ + public AdminProxy(OutriggerAdmin admin, Uuid spaceUuid) { + if (admin == null) + throw new NullPointerException("admin must be non-null"); + if (spaceUuid == null) + throw new NullPointerException("spaceUuid must be non-null"); + this.admin = admin; + this.spaceUuid = spaceUuid; + } + + /** + * Read this object back and validate state. + */ + private void readObject(ObjectInputStream in) + throws IOException, ClassNotFoundException + { + in.defaultReadObject(); + + if (admin == null) + throw new InvalidObjectException("null server reference"); + + if (spaceUuid == null) + throw new InvalidObjectException("null Uuid"); + } + + /** + * We should always have data in the stream, if this method + * gets called there is something wrong. + */ + private void readObjectNoData() throws InvalidObjectException { + throw new + InvalidObjectException("SpaceProxy should always have data"); + } + + // inherit doc comment + public JavaSpace space() throws RemoteException { + return admin.space(); + } + + // inherit doc comment + public AdminIterator contents(Entry tmpl, Transaction tr) + throws TransactionException, RemoteException + { + return contents(tmpl, tr, USE_DEFAULT); + } + + // inherit doc comment + public AdminIterator contents(Entry tmpl, Transaction tr, int fetchSize) + throws TransactionException, RemoteException + { + return new IteratorProxy( + admin.contents(SpaceProxy2.repFor(tmpl), tr), admin, fetchSize); + } + + // inherit doc comment + public void destroy() throws RemoteException { + admin.destroy(); + } + + // JoinAdmin + // -------------------------------------------------- + // inherit doc comment + public Entry[] getLookupAttributes() throws RemoteException { + return admin.getLookupAttributes(); + } + + // inherit doc comment + public void addLookupAttributes(Entry[] attrSets) + throws RemoteException + { + admin.addLookupAttributes(attrSets); + } + + // inherit doc comment + public void modifyLookupAttributes(Entry[] attrSetTemplates, + Entry[] attrSets) + throws RemoteException + { + admin.modifyLookupAttributes(attrSetTemplates, attrSets); + } + + // inherit doc comment + public String[] getLookupGroups() throws RemoteException { + return admin.getLookupGroups(); + } + + // inherit doc comment + public void addLookupGroups(String[] groups) throws RemoteException { + admin.addLookupGroups(groups); + } + + // inherit doc comment + public void removeLookupGroups(String[] groups) + throws RemoteException + { + admin.removeLookupGroups(groups); + } + + // inherit doc comment + public void setLookupGroups(String[] groups) throws RemoteException { + admin.setLookupGroups(groups); + } + + // inherit doc comment + public LookupLocator[] getLookupLocators() throws RemoteException { + return admin.getLookupLocators(); + } + + // inherit doc comment + public void addLookupLocators(LookupLocator[] locators) + throws RemoteException + { + admin.addLookupLocators(locators); + } + + // inherit doc comment + public void removeLookupLocators(LookupLocator[] locators) + throws RemoteException + { + admin.removeLookupLocators(locators); + } + + // inherit doc comment + public void setLookupLocators(LookupLocator[] locators) + throws RemoteException + { + admin.setLookupLocators(locators); + } + + public String toString() { + return getClass().getName() + " for " + spaceUuid + + " (through " + admin + ")"; + } + + public boolean equals(Object other) { + return ReferentUuids.compare(this, other); + } + + public int hashCode() { + return spaceUuid.hashCode(); + } + + public Uuid getReferentUuid() { + return spaceUuid; + } +} Modified: river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/ConstrainableAdminProxy.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/ConstrainableAdminProxy.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/ConstrainableAdminProxy.java (original) +++ river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/ConstrainableAdminProxy.java Sun Jul 5 11:41:39 2020 @@ -1,250 +1,253 @@ -/* - * 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.io.InvalidObjectException; -import java.rmi.RemoteException; - -import net.jini.core.entry.Entry; -import net.jini.core.discovery.LookupLocator; -import net.jini.core.transaction.Transaction; -import net.jini.core.transaction.TransactionException; -import net.jini.space.JavaSpace; -import net.jini.admin.JoinAdmin; - -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.admin.DestroyAdmin; - -/** - * Constrainable subclass of <code>AdminProxy</code> - * - * @author Sun Microsystems, Inc. - * @since 2.0 - */ -final class ConstrainableAdminProxy extends AdminProxy - implements RemoteMethodControl, ConstrainableJavaSpaceAdmin -{ - 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>AdminProxy</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(JoinAdmin.class, "getLookupAttributes", - new Class[] {}), - ProxyUtil.getMethod(JoinAdmin.class, "getLookupAttributes", - new Class[] {}), - - - ProxyUtil.getMethod(JoinAdmin.class, "addLookupAttributes", - new Class[] {Entry[].class}), - ProxyUtil.getMethod(JoinAdmin.class, "addLookupAttributes", - new Class[] {Entry[].class}), - - - ProxyUtil.getMethod(JoinAdmin.class, "modifyLookupAttributes", - new Class[] {Entry[].class, Entry[].class}), - ProxyUtil.getMethod(JoinAdmin.class, "modifyLookupAttributes", - new Class[] {Entry[].class, Entry[].class}), - - - ProxyUtil.getMethod(JoinAdmin.class, "getLookupGroups", - new Class[] {}), - ProxyUtil.getMethod(JoinAdmin.class, "getLookupGroups", - new Class[] {}), - - ProxyUtil.getMethod(JoinAdmin.class, "setLookupGroups", - new Class[] {String[].class}), - ProxyUtil.getMethod(JoinAdmin.class, "setLookupGroups", - new Class[] {String[].class}), - - - ProxyUtil.getMethod(JoinAdmin.class, "removeLookupGroups", - new Class[] {String[].class}), - ProxyUtil.getMethod(JoinAdmin.class, "removeLookupGroups", - new Class[] {String[].class}), - - - ProxyUtil.getMethod(JoinAdmin.class, "addLookupGroups", - new Class[] {String[].class}), - ProxyUtil.getMethod(JoinAdmin.class, "addLookupGroups", - new Class[] {String[].class}), - - - ProxyUtil.getMethod(JoinAdmin.class, "getLookupLocators", - new Class[] {}), - ProxyUtil.getMethod(JoinAdmin.class, "getLookupLocators", - new Class[] {}), - - - - ProxyUtil.getMethod(JoinAdmin.class, "setLookupLocators", - new Class[] {LookupLocator[].class} ), - ProxyUtil.getMethod(JoinAdmin.class, "setLookupLocators", - new Class[] {LookupLocator[].class} ), - - - ProxyUtil.getMethod(JoinAdmin.class, "addLookupLocators", - new Class[] {LookupLocator[].class} ), - ProxyUtil.getMethod(JoinAdmin.class, "addLookupLocators", - new Class[] {LookupLocator[].class} ), - - - ProxyUtil.getMethod(JoinAdmin.class, "removeLookupLocators", - new Class[] {LookupLocator[].class} ), - ProxyUtil.getMethod(JoinAdmin.class, "removeLookupLocators", - new Class[] {LookupLocator[].class} ), - - - ProxyUtil.getMethod(DestroyAdmin.class, "destroy", new Class[] {}), - ProxyUtil.getMethod(DestroyAdmin.class, "destroy", new Class[] {}), - - - ProxyUtil.getMethod(JavaSpaceAdmin.class, "space", new Class[] {}), - ProxyUtil.getMethod(OutriggerAdmin.class, "space", new Class[] {}), - - - ProxyUtil.getMethod(ConstrainableJavaSpaceAdmin.class, "contents", - new Class[] {Entry.class, - Transaction.class, - int.class, - MethodConstraints.class}), - ProxyUtil.getMethod(OutriggerAdmin.class, "contents", - new Class[] {EntryRep.class, - Transaction.class} ) - }; // end methodMapArray - - /** - * Client constraints placed on this proxy (may be <code>null</code> - * @serial - */ - private final MethodConstraints methodConstraints; - - /** - * Create a new <code>ConstrainableAdminProxy</code>. - * @param admin reference to remote server for the space. - * @param spaceUuid universal unique ID for the space. - * @param methodConstraints the client method constraints to place on - * this proxy (may be <code>null</code>). - * @throws NullPointerException if <code>admin</code> or - * <code>spaceUuid</code> is <code>null</code>. - * @throws ClassCastException if <code>admin</code> - * does not implement <code>RemoteMethodControl</code>. - */ - ConstrainableAdminProxy(OutriggerAdmin admin, Uuid spaceUuid, - MethodConstraints methodConstraints) - { - super(constrainServer(admin, methodConstraints), spaceUuid); - this.methodConstraints = methodConstraints; - } - - /** - * Returns a copy of the given <code>OutriggerAdmin</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 OutriggerAdmin constrainServer(OutriggerAdmin server, - MethodConstraints constraints) - { - final MethodConstraints serverRefConstraints - = ConstrainableProxyUtil.translateConstraints(constraints, - methodMapArray); - final RemoteMethodControl constrainedServer = - ((RemoteMethodControl)server). - setConstraints(serverRefConstraints); - - return (OutriggerAdmin)constrainedServer; - } - - public RemoteMethodControl setConstraints(MethodConstraints constraints) - { - return new ConstrainableAdminProxy(admin, spaceUuid, 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(admin); - } - - private void readObject(ObjectInputStream s) - throws IOException, ClassNotFoundException - { - s.defaultReadObject(); - - /* basic validation of admin and spaceUuid was performed by - * AdminProxy.readObject(), we just need to verify than space - * implements RemoteMethodControl and that it has appropriate - * constraints. - */ - ConstrainableProxyUtil.verifyConsistentConstraints( - methodConstraints, admin, methodMapArray); - } - - /** - * Override super class to create secure <code>IteratorProxy</code>s - */ - public AdminIterator contents(Entry tmpl, Transaction tr, int fetchSize) - throws TransactionException, RemoteException - { - return contents(tmpl, tr, fetchSize, null); - } - - - public AdminIterator contents(Entry tmpl, Transaction txn, int fetchSize, - MethodConstraints constraints) - throws TransactionException, RemoteException - { - return new ConstrainableIteratorProxy( - admin.contents(SpaceProxy2.repFor(tmpl), txn), admin, fetchSize, - constraints); - } - -} +/* + * 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.io.InvalidObjectException; +import java.rmi.RemoteException; + +import net.jini.core.entry.Entry; +import net.jini.core.discovery.LookupLocator; +import net.jini.core.transaction.Transaction; +import net.jini.core.transaction.TransactionException; +import net.jini.space.JavaSpace; +import net.jini.admin.JoinAdmin; + +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.admin.DestroyAdmin; +import org.apache.river.admin.AdminIterator; +import org.apache.river.admin.JavaSpaceAdmin; + + +/** + * Constrainable subclass of <code>AdminProxy</code> + * + * @author Sun Microsystems, Inc. + * @since 2.0 + */ +public final class ConstrainableAdminProxy extends AdminProxy + implements RemoteMethodControl, ConstrainableJavaSpaceAdmin +{ + 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>AdminProxy</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(JoinAdmin.class, "getLookupAttributes", + new Class[] {}), + ProxyUtil.getMethod(JoinAdmin.class, "getLookupAttributes", + new Class[] {}), + + + ProxyUtil.getMethod(JoinAdmin.class, "addLookupAttributes", + new Class[] {Entry[].class}), + ProxyUtil.getMethod(JoinAdmin.class, "addLookupAttributes", + new Class[] {Entry[].class}), + + + ProxyUtil.getMethod(JoinAdmin.class, "modifyLookupAttributes", + new Class[] {Entry[].class, Entry[].class}), + ProxyUtil.getMethod(JoinAdmin.class, "modifyLookupAttributes", + new Class[] {Entry[].class, Entry[].class}), + + + ProxyUtil.getMethod(JoinAdmin.class, "getLookupGroups", + new Class[] {}), + ProxyUtil.getMethod(JoinAdmin.class, "getLookupGroups", + new Class[] {}), + + ProxyUtil.getMethod(JoinAdmin.class, "setLookupGroups", + new Class[] {String[].class}), + ProxyUtil.getMethod(JoinAdmin.class, "setLookupGroups", + new Class[] {String[].class}), + + + ProxyUtil.getMethod(JoinAdmin.class, "removeLookupGroups", + new Class[] {String[].class}), + ProxyUtil.getMethod(JoinAdmin.class, "removeLookupGroups", + new Class[] {String[].class}), + + + ProxyUtil.getMethod(JoinAdmin.class, "addLookupGroups", + new Class[] {String[].class}), + ProxyUtil.getMethod(JoinAdmin.class, "addLookupGroups", + new Class[] {String[].class}), + + + ProxyUtil.getMethod(JoinAdmin.class, "getLookupLocators", + new Class[] {}), + ProxyUtil.getMethod(JoinAdmin.class, "getLookupLocators", + new Class[] {}), + + + + ProxyUtil.getMethod(JoinAdmin.class, "setLookupLocators", + new Class[] {LookupLocator[].class} ), + ProxyUtil.getMethod(JoinAdmin.class, "setLookupLocators", + new Class[] {LookupLocator[].class} ), + + + ProxyUtil.getMethod(JoinAdmin.class, "addLookupLocators", + new Class[] {LookupLocator[].class} ), + ProxyUtil.getMethod(JoinAdmin.class, "addLookupLocators", + new Class[] {LookupLocator[].class} ), + + + ProxyUtil.getMethod(JoinAdmin.class, "removeLookupLocators", + new Class[] {LookupLocator[].class} ), + ProxyUtil.getMethod(JoinAdmin.class, "removeLookupLocators", + new Class[] {LookupLocator[].class} ), + + + ProxyUtil.getMethod(DestroyAdmin.class, "destroy", new Class[] {}), + ProxyUtil.getMethod(DestroyAdmin.class, "destroy", new Class[] {}), + + + ProxyUtil.getMethod(JavaSpaceAdmin.class, "space", new Class[] {}), + ProxyUtil.getMethod(OutriggerAdmin.class, "space", new Class[] {}), + + + ProxyUtil.getMethod(ConstrainableJavaSpaceAdmin.class, "contents", + new Class[] {Entry.class, + Transaction.class, + int.class, + MethodConstraints.class}), + ProxyUtil.getMethod(OutriggerAdmin.class, "contents", + new Class[] {EntryRep.class, + Transaction.class} ) + }; // end methodMapArray + + /** + * Client constraints placed on this proxy (may be <code>null</code> + * @serial + */ + private final MethodConstraints methodConstraints; + + /** + * Create a new <code>ConstrainableAdminProxy</code>. + * @param admin reference to remote server for the space. + * @param spaceUuid universal unique ID for the space. + * @param methodConstraints the client method constraints to place on + * this proxy (may be <code>null</code>). + * @throws NullPointerException if <code>admin</code> or + * <code>spaceUuid</code> is <code>null</code>. + * @throws ClassCastException if <code>admin</code> + * does not implement <code>RemoteMethodControl</code>. + */ + public ConstrainableAdminProxy(OutriggerAdmin admin, Uuid spaceUuid, + MethodConstraints methodConstraints) + { + super(constrainServer(admin, methodConstraints), spaceUuid); + this.methodConstraints = methodConstraints; + } + + /** + * Returns a copy of the given <code>OutriggerAdmin</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 OutriggerAdmin constrainServer(OutriggerAdmin server, + MethodConstraints constraints) + { + final MethodConstraints serverRefConstraints + = ConstrainableProxyUtil.translateConstraints(constraints, + methodMapArray); + final RemoteMethodControl constrainedServer = + ((RemoteMethodControl)server). + setConstraints(serverRefConstraints); + + return (OutriggerAdmin)constrainedServer; + } + + public RemoteMethodControl setConstraints(MethodConstraints constraints) + { + return new ConstrainableAdminProxy(admin, spaceUuid, 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(admin); + } + + private void readObject(ObjectInputStream s) + throws IOException, ClassNotFoundException + { + s.defaultReadObject(); + + /* basic validation of admin and spaceUuid was performed by + * AdminProxy.readObject(), we just need to verify than space + * implements RemoteMethodControl and that it has appropriate + * constraints. + */ + ConstrainableProxyUtil.verifyConsistentConstraints( + methodConstraints, admin, methodMapArray); + } + + /** + * Override super class to create secure <code>IteratorProxy</code>s + */ + public AdminIterator contents(Entry tmpl, Transaction tr, int fetchSize) + throws TransactionException, RemoteException + { + return contents(tmpl, tr, fetchSize, null); + } + + + public AdminIterator contents(Entry tmpl, Transaction txn, int fetchSize, + MethodConstraints constraints) + throws TransactionException, RemoteException + { + return new ConstrainableIteratorProxy( + admin.contents(SpaceProxy2.repFor(tmpl), txn), admin, fetchSize, + constraints); + } + +} Modified: river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/ConstrainableIteratorProxy.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/ConstrainableIteratorProxy.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/ConstrainableIteratorProxy.java (original) +++ river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/ConstrainableIteratorProxy.java Sun Jul 5 11:41:39 2020 @@ -1,107 +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 org.apache.river.outrigger; - -import java.lang.reflect.Method; -import net.jini.id.Uuid; -import net.jini.core.constraint.MethodConstraints; -import net.jini.core.constraint.RemoteMethodControl; -import org.apache.river.proxy.ConstrainableProxyUtil; - -/** - * Constrainable subclass of <code>IteratorProxy</code> - */ -final class ConstrainableIteratorProxy extends IteratorProxy { - /** - * 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>AdminIterator</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(AdminIterator.class, "next", - new Class[] {}), - ProxyUtil.getMethod(OutriggerAdmin.class, "nextReps", - new Class[] {Uuid.class, - int.class, - Uuid.class}), - - ProxyUtil.getMethod(AdminIterator.class, "delete", - new Class[] {}), - ProxyUtil.getMethod(OutriggerAdmin.class,"delete", - new Class[] {Uuid.class, - Uuid.class}), - - ProxyUtil.getMethod(AdminIterator.class, "close", - new Class[] {}), - ProxyUtil.getMethod(OutriggerAdmin.class,"close", - new Class[] {Uuid.class}) - }; - - /** - * Create a new <code>ConstrainableIteratorProxy</code>. - * @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 - * @param methodConstraints the client method constraints to place on - * this proxy (may be <code>null</code>). - * @throws NullPointerException if <code>server</code> or - * <code>iterationUuid</code> is <code>null</code>. - * @throws ClassCastException if <code>server</code> - * does not implement <code>RemoteMethodControl</code>. - */ - ConstrainableIteratorProxy(Uuid iterationUuid, OutriggerAdmin server, - int fetchSize, MethodConstraints methodConstraints) - { - super(iterationUuid, constrainServer(server, methodConstraints), - fetchSize); - } - - /** - * Returns a copy of the given <code>OutriggerAdmin</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 OutriggerAdmin constrainServer(OutriggerAdmin server, - MethodConstraints constraints) - { - final MethodConstraints serverRefConstraints - = ConstrainableProxyUtil.translateConstraints(constraints, - methodMapArray); - final RemoteMethodControl constrainedServer = - ((RemoteMethodControl)server). - setConstraints(serverRefConstraints); - - return (OutriggerAdmin)constrainedServer; - } -} +/* + * 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 net.jini.id.Uuid; +import net.jini.core.constraint.MethodConstraints; +import net.jini.core.constraint.RemoteMethodControl; +import org.apache.river.proxy.ConstrainableProxyUtil; +import org.apache.river.admin.AdminIterator; + + +/** + * Constrainable subclass of <code>IteratorProxy</code> + */ +final class ConstrainableIteratorProxy extends IteratorProxy { + /** + * 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>AdminIterator</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(AdminIterator.class, "next", + new Class[] {}), + ProxyUtil.getMethod(OutriggerAdmin.class, "nextReps", + new Class[] {Uuid.class, + int.class, + Uuid.class}), + + ProxyUtil.getMethod(AdminIterator.class, "delete", + new Class[] {}), + ProxyUtil.getMethod(OutriggerAdmin.class,"delete", + new Class[] {Uuid.class, + Uuid.class}), + + ProxyUtil.getMethod(AdminIterator.class, "close", + new Class[] {}), + ProxyUtil.getMethod(OutriggerAdmin.class,"close", + new Class[] {Uuid.class}) + }; + + /** + * Create a new <code>ConstrainableIteratorProxy</code>. + * @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 + * @param methodConstraints the client method constraints to place on + * this proxy (may be <code>null</code>). + * @throws NullPointerException if <code>server</code> or + * <code>iterationUuid</code> is <code>null</code>. + * @throws ClassCastException if <code>server</code> + * does not implement <code>RemoteMethodControl</code>. + */ + ConstrainableIteratorProxy(Uuid iterationUuid, OutriggerAdmin server, + int fetchSize, MethodConstraints methodConstraints) + { + super(iterationUuid, constrainServer(server, methodConstraints), + fetchSize); + } + + /** + * Returns a copy of the given <code>OutriggerAdmin</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 OutriggerAdmin constrainServer(OutriggerAdmin server, + MethodConstraints constraints) + { + final MethodConstraints serverRefConstraints + = ConstrainableProxyUtil.translateConstraints(constraints, + methodMapArray); + final RemoteMethodControl constrainedServer = + ((RemoteMethodControl)server). + setConstraints(serverRefConstraints); + + return (OutriggerAdmin)constrainedServer; + } +} Modified: river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/ConstrainableJavaSpaceAdmin.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/ConstrainableJavaSpaceAdmin.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/ConstrainableJavaSpaceAdmin.java (original) +++ river/jtsk/modules/modularize/apache-river/river-services/outrigger/outrigger-dl/src/main/java/org/apache/river/outrigger/proxy/ConstrainableJavaSpaceAdmin.java Sun Jul 5 11:41:39 2020 @@ -1,142 +1,146 @@ -/* - * 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.transaction.Transaction; -import net.jini.core.transaction.TransactionException; -import net.jini.core.constraint.MethodConstraints; -import net.jini.space.JavaSpace05; - -/** - * Sub-interface of <code>JavaSpaceAdmin</code> that - * adds a method that allows iterators to be created with - * a given set of constraints.<p> - * - * @deprecated The {@link JavaSpace05#contents JavaSpace05.contents} - * method can be used to view the space's contents. - * - * @author Sun Microsystems, Inc. - * @since 2.0 - */ -public interface ConstrainableJavaSpaceAdmin extends JavaSpaceAdmin { - /** - * Return an <code>AdminIterator</code> that will iterate over all - * the entries in the space that match the given template and are - * visible under the given transaction. - * <p> - * The interactions between other operations on the space and - * the returned iterator are undefined - * <p> - * Note, because this is a convenience method for - * <code>contents(Entry, Transaction, int, - * MethodConstraints)</code> the constraints associated with - * <code>contents(Entry, Transaction, int, - * MethodConstraints)</code> are used for any calls though this - * method, not the constraints associated with this method. - * - * @param tmpl The iterator should return only entries that match - * tmpl - * @param txn The iterator should return only entries that match - * this transaction - * @throws RemoteException if communications with the - * server is necessary and it can not be completed. - * @throws TransactionException if there is a problem with - * <code>txn</code>. - * @throws SecurityException If the space is performing - * access control and it can not be confirmed - * that the subject making this call has permission - * to create an <code>AdminIterator</code> with - * the specified template and transaction. - */ - AdminIterator contents(Entry tmpl, Transaction txn) - throws TransactionException, RemoteException; - - /** - * Return an <code>AdminIterator</code> that will iterate over all - * the entries in the space that match the given template and are - * visible under the given transaction. - * <p> - * The interactions between other operations on the space and - * the returned iterator are undefined - * <p> - * Note, because this is a convenience method for - * <code>contents(Entry, Transaction, int, - * MethodConstraints)</code> the constraints associated with - * <code>contents(Entry, Transaction, int, - * MethodConstraints)</code> are used for any calls though this - * method, not the constraints associated with this method. - * - * @param tmpl The iterator should return only entries that match - * tmpl - * @param txn The iterator should return only entries that match - * this transaction - * @param fetchSize advice on how many entries to fetch when the iterator - * has to go to the server for more entries. - * @throws RemoteException if communications with the - * server is necessary and it can not be completed. - * @throws TransactionException if there is a problem with - * <code>txn</code>. - * @throws SecurityException If the space is performing - * access control and it can not be confirmed - * that the subject making this call has permission - * to create an <code>AdminIterator</code> with - * the specified template and transaction. - * @throws IllegalArgumentException if fetchSize is - * not postive, or <code>USE_DEFUALT</code>. - */ - AdminIterator contents(Entry tmpl, Transaction txn, int fetchSize) - throws TransactionException, RemoteException; - - /** - * Return an <code>AdminIterator</code> that will iterate over all - * the entries in the space that match the given template and are - * visible under the given transaction. The returned iterator - * will support proxy trust verification and will enforce - * the specified <code>MethodConstraints</code>. - * <p> - * The interactions between other operations on the space and - * the returned iterator are undefined - * <p> - * @param tmpl The iterator should return only entries that match - * tmpl - * @param txn The iterator should return only entries that match - * this transaction - * @param fetchSize advice on how many entries to fetch when the - * iterator has to go to the server for more entries. - * @param constrains the <code>MethodConstraints</code> the - * returned proxy should enforce. - * @return An object that can be used to iterate over entries - * in the space. - * @throws RemoteException if communications with the - * server is necessary and it can not be completed. - * @throws TransactionException if there is a problem with - * <code>txn</code>. - * @throws SecurityException If the space is performing - * access control and it can not be confirmed - * that the subject making this call has permission - * to create an <code>AdminIterator</code> with - * the specified template and transaction. - * @throws IllegalArgumentException if fetchSize is - * not postive, or <code>USE_DEFUALT</code>. - */ - AdminIterator contents(Entry tmpl, Transaction txn, int fetchSize, - MethodConstraints constrains) - throws TransactionException, 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 java.rmi.RemoteException; +import net.jini.core.entry.Entry; +import net.jini.core.transaction.Transaction; +import net.jini.core.transaction.TransactionException; +import net.jini.core.constraint.MethodConstraints; +import net.jini.space.JavaSpace05; +import org.apache.river.admin.AdminIterator; +import org.apache.river.admin.JavaSpaceAdmin; + + + +/** + * Sub-interface of <code>JavaSpaceAdmin</code> that + * adds a method that allows iterators to be created with + * a given set of constraints.<p> + * + * @deprecated The {@link JavaSpace05#contents JavaSpace05.contents} + * method can be used to view the space's contents. + * + * @author Sun Microsystems, Inc. + * @since 2.0 + */ +public interface ConstrainableJavaSpaceAdmin extends JavaSpaceAdmin { + /** + * Return an <code>AdminIterator</code> that will iterate over all + * the entries in the space that match the given template and are + * visible under the given transaction. + * <p> + * The interactions between other operations on the space and + * the returned iterator are undefined + * <p> + * Note, because this is a convenience method for + * <code>contents(Entry, Transaction, int, + * MethodConstraints)</code> the constraints associated with + * <code>contents(Entry, Transaction, int, + * MethodConstraints)</code> are used for any calls though this + * method, not the constraints associated with this method. + * + * @param tmpl The iterator should return only entries that match + * tmpl + * @param txn The iterator should return only entries that match + * this transaction + * @throws RemoteException if communications with the + * server is necessary and it can not be completed. + * @throws TransactionException if there is a problem with + * <code>txn</code>. + * @throws SecurityException If the space is performing + * access control and it can not be confirmed + * that the subject making this call has permission + * to create an <code>AdminIterator</code> with + * the specified template and transaction. + */ + AdminIterator contents(Entry tmpl, Transaction txn) + throws TransactionException, RemoteException; + + /** + * Return an <code>AdminIterator</code> that will iterate over all + * the entries in the space that match the given template and are + * visible under the given transaction. + * <p> + * The interactions between other operations on the space and + * the returned iterator are undefined + * <p> + * Note, because this is a convenience method for + * <code>contents(Entry, Transaction, int, + * MethodConstraints)</code> the constraints associated with + * <code>contents(Entry, Transaction, int, + * MethodConstraints)</code> are used for any calls though this + * method, not the constraints associated with this method. + * + * @param tmpl The iterator should return only entries that match + * tmpl + * @param txn The iterator should return only entries that match + * this transaction + * @param fetchSize advice on how many entries to fetch when the iterator + * has to go to the server for more entries. + * @throws RemoteException if communications with the + * server is necessary and it can not be completed. + * @throws TransactionException if there is a problem with + * <code>txn</code>. + * @throws SecurityException If the space is performing + * access control and it can not be confirmed + * that the subject making this call has permission + * to create an <code>AdminIterator</code> with + * the specified template and transaction. + * @throws IllegalArgumentException if fetchSize is + * not postive, or <code>USE_DEFUALT</code>. + */ + AdminIterator contents(Entry tmpl, Transaction txn, int fetchSize) + throws TransactionException, RemoteException; + + /** + * Return an <code>AdminIterator</code> that will iterate over all + * the entries in the space that match the given template and are + * visible under the given transaction. The returned iterator + * will support proxy trust verification and will enforce + * the specified <code>MethodConstraints</code>. + * <p> + * The interactions between other operations on the space and + * the returned iterator are undefined + * <p> + * @param tmpl The iterator should return only entries that match + * tmpl + * @param txn The iterator should return only entries that match + * this transaction + * @param fetchSize advice on how many entries to fetch when the + * iterator has to go to the server for more entries. + * @param constrains the <code>MethodConstraints</code> the + * returned proxy should enforce. + * @return An object that can be used to iterate over entries + * in the space. + * @throws RemoteException if communications with the + * server is necessary and it can not be completed. + * @throws TransactionException if there is a problem with + * <code>txn</code>. + * @throws SecurityException If the space is performing + * access control and it can not be confirmed + * that the subject making this call has permission + * to create an <code>AdminIterator</code> with + * the specified template and transaction. + * @throws IllegalArgumentException if fetchSize is + * not postive, or <code>USE_DEFUALT</code>. + */ + AdminIterator contents(Entry tmpl, Transaction txn, int fetchSize, + MethodConstraints constrains) + throws TransactionException, RemoteException; +}
