/** * Create a set of new objects to operate on and cache. This method is called only if the * specified object(s) are NOT available in the cache. The specified objects should be created * and returned; if they are not created, it means that the execution cannot proceed, and the * execute() method will not be called. * * @param objectDescriptions is the set of unique identifier of the object. * @return the newly created objects to cache, or null, if any object cannot be created. The * order of the returned objects must correspond to the order of the object descriptinos. */ public Object[] create(ICacheDescription[] objectDescriptions) throws ManifoldCFException { // Turn the object descriptions into the parameters for the ToolInstance requests String[] connectionNames = new String[objectDescriptions.length]; int i = 0; while (i < connectionNames.length) { RepositoryConnectionDescription desc = (RepositoryConnectionDescription) objectDescriptions[i]; connectionNames[i] = desc.getConnectionName(); i++; } return thisManager.getRepositoryConnectionsMultiple(connectionNames); }
/** * Notify the implementing class of the existence of a cached version of the object. The object * is passed to this method so that the execute() method below will have it available to operate * on. This method is also called for all objects that are freshly created as well. * * @param objectDescription is the unique identifier of the object. * @param cachedObject is the cached object. */ public void exists(ICacheDescription objectDescription, Object cachedObject) throws ManifoldCFException { // Cast what came in as what it really is RepositoryConnectionDescription objectDesc = (RepositoryConnectionDescription) objectDescription; RepositoryConnection ci = (RepositoryConnection) cachedObject; // Duplicate it! if (ci != null) ci = ci.duplicate(); // In order to make the indexes line up, we need to use the hashtable built by // the constructor. returnValues[((Integer) returnMap.get(objectDesc.getConnectionName())).intValue()] = ci; }