public boolean match(IContainer containerToMatch) { result = containerToMatch.getAdapter(clazz); return result != null; }
public boolean match(IContainer containerToMatch) { result = containerToMatch.getConnectedID(); return result != null; }
public IContainer removeContainer(IContainer container) { Assert.isNotNull(container); ID containerID = container.getID(); if (containerID == null) return null; return removeContainer(containerID); }
void removeContainerExtensions(IConfigurationElement[] members) { // For each configuration element for (int m = 0; m < members.length; m++) { final IConfigurationElement member = members[m]; // The only required attribute is "factoryName" String factoryName = member.getAttribute(FACTORY_ATTRIBUTE); // Skip over if factory name is invalid if (factoryName == null || "".equals(factoryName)) //$NON-NLS-1$ continue; IContainerManager manager = (IContainerManager) ContainerFactory.getDefault(); IContainer[] containers = manager.getAllContainers(); if (containers == null) continue; for (int i = 0; i < containers.length; i++) { ContainerTypeDescription containerTypeDescription = manager.getContainerTypeDescription(containers[i].getID()); if (containerTypeDescription != null && containerTypeDescription.getName().equals(factoryName)) { // Remove from manager IContainer removedContainer = manager.removeContainer(containers[i]); if (removedContainer != null) { try { containers[i].dispose(); } catch (Exception e) { logException("removeContainerException", "Unexpected exception disposing container id=" + containers[i].getID(), e); //$NON-NLS-1$ //$NON-NLS-2$ } } } } } }
public void dispose() { synchronized (containers) { for (Iterator i = containers.keySet().iterator(); i.hasNext();) { ContainerEntry entry = (ContainerEntry) containers.get(i.next()); if (entry != null) { IContainer c = entry.getContainer(); try { c.dispose(); } catch (Throwable e) { // Log exception ECFPlugin.getDefault().log(new Status(IStatus.ERROR, ECFPlugin.getDefault().getBundle().getSymbolicName(), IStatus.ERROR, "container dispose error", e)); //$NON-NLS-1$ Trace.catching(ECFPlugin.PLUGIN_ID, ECFDebugOptions.EXCEPTIONS_CATCHING, ContainerFactory.class, "doDispose", e); //$NON-NLS-1$ } } } containers.clear(); } containerdescriptions.clear(); managerListeners.clear(); } });
protected void sendBrowseRequest(URI uri, IProgressMonitor monitor) throws CoreException, FileNotFoundException, AuthenticationFailedException, JREHttpClientRequiredException { IContainer container; try { container = ContainerFactory.getDefault().createContainer(); } catch (ContainerCreateException e) { throw RepositoryStatusHelper.fromMessage(Messages.ecf_configuration_error); } IRemoteFileSystemBrowserContainerAdapter adapter = container.getAdapter(IRemoteFileSystemBrowserContainerAdapter.class); if (adapter == null) { throw RepositoryStatusHelper.fromMessage(Messages.ecf_configuration_error); } adapter.setConnectContextForAuthentication(connectContext); this.exception = null; this.theMonitor = monitor; for (int retryCount = 0;; retryCount++) { if (monitor != null && monitor.isCanceled()) throw new OperationCanceledException(); try { IFileID fileID = FileIDFactory.getDefault().createFileID(adapter.getBrowseNamespace(), uri.toString()); browseRequest = adapter.sendBrowseRequest(fileID, this); } catch (RemoteFileSystemException e) { exception = e; } catch (FileCreateException e) { exception = e; } if (checkException(uri, retryCount)) break; } }
public IContainer addContainer(IContainer container, ContainerTypeDescription typeDescription) { Assert.isNotNull(container); Assert.isNotNull(typeDescription); ID containerID = container.getID(); Assert.isNotNull(containerID, "Container ID cannot be null"); //$NON-NLS-1$ ContainerEntry result = null; synchronized (containers) { result = (ContainerEntry) containers.put(containerID, new ContainerEntry(container, typeDescription)); } if (result == null) fireContainerAdded(container); return container; }
protected void sendBrowseRequest(URI uri, IProgressMonitor monitor) throws CoreException, FileNotFoundException, AuthenticationFailedException, JREHttpClientRequiredException { IContainer container; try { container = ContainerFactory.getDefault().createContainer(); } catch (ContainerCreateException e) { throw RepositoryStatusHelper.fromMessage(Messages.ecf_configuration_error); } IRemoteFileSystemBrowserContainerAdapter adapter = container.getAdapter(IRemoteFileSystemBrowserContainerAdapter.class); if (adapter == null) { throw RepositoryStatusHelper.fromMessage(Messages.ecf_configuration_error); } adapter.setConnectContextForAuthentication(connectContext); this.exception = null; this.theMonitor = monitor; for (int retryCount = 0;; retryCount++) { if (monitor != null && monitor.isCanceled()) throw new OperationCanceledException(); try { IFileID fileID = FileIDFactory.getDefault().createFileID(adapter.getBrowseNamespace(), uri.toString()); browseRequest = adapter.sendBrowseRequest(fileID, this); } catch (RemoteFileSystemException e) { exception = e; } catch (FileCreateException e) { exception = e; } if (checkException(uri, retryCount)) break; } }
public IContainer createContainer(ContainerTypeDescription containerTypeDescription, Object[] parameters) throws ContainerCreateException { String method = "createContainer"; //$NON-NLS-1$ Trace.entering(ECFPlugin.PLUGIN_ID, ECFDebugOptions.METHODS_ENTERING, ContainerFactory.class, method, new Object[] {containerTypeDescription, Trace.getArgumentsString(parameters)}); if (containerTypeDescription == null) throwContainerCreateException("ContainerTypeDescription cannot be null", null, method); //$NON-NLS-1$ ContainerTypeDescription cd = getDescription0(containerTypeDescription); if (cd == null) throwContainerCreateException("ContainerTypeDescription '" //$NON-NLS-1$ + containerTypeDescription.getName() + "' not found", null, method); //$NON-NLS-1$ IContainerInstantiator instantiator = null; try { instantiator = cd.getInstantiator(); } catch (Exception e) { throwContainerCreateException("createContainer cannot get IContainerInstantiator for description : " //$NON-NLS-1$ + containerTypeDescription, e, method); } // Ask instantiator to actually create instance IContainer container = instantiator.createInstance(containerTypeDescription, parameters); if (container == null) throwContainerCreateException("Instantiator returned null for '" //$NON-NLS-1$ + cd.getName() + "'", null, method); //$NON-NLS-1$ // Add to containers map if container.getID() provides a valid value. ID containerID = container.getID(); if (containerID != null) addContainer(container, cd); Trace.exiting(ECFPlugin.PLUGIN_ID, ECFDebugOptions.METHODS_EXITING, ContainerFactory.class, method, container); return container; }
protected void sendBrowseRequest(URI uri, IProgressMonitor monitor) throws CoreException, FileNotFoundException, AuthenticationFailedException, JREHttpClientRequiredException { IContainer container; try { container = ContainerFactory.getDefault().createContainer(); } catch (ContainerCreateException e) { throw RepositoryStatusHelper.fromMessage(Messages.ecf_configuration_error); } IRemoteFileSystemBrowserContainerAdapter adapter = container.getAdapter(IRemoteFileSystemBrowserContainerAdapter.class); if (adapter == null) { throw RepositoryStatusHelper.fromMessage(Messages.ecf_configuration_error); } adapter.setConnectContextForAuthentication(connectContext); this.exception = null; this.theMonitor = monitor; for (int retryCount = 0;; retryCount++) { if (monitor != null && monitor.isCanceled()) throw new OperationCanceledException(); try { IFileID fileID = FileIDFactory.getDefault().createFileID(adapter.getBrowseNamespace(), uri.toString()); browseRequest = adapter.sendBrowseRequest(fileID, this); } catch (RemoteFileSystemException e) { exception = e; } catch (FileCreateException e) { exception = e; } if (checkException(uri, retryCount)) break; } }