Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoberto E. Escobar2012-03-10 02:26:40 +0000
committerRyan D. Brooks2012-03-10 02:26:40 +0000
commit42197931c795e88880bc33a211f0f3d588100de7 (patch)
tree573b8e4eb81b87330416808dba62028bc96f70d1 /plugins/org.eclipse.osee.framework.resource.management
parent89739af4349c8e0f38b13b6b6fc4c065c8c64161 (diff)
downloadorg.eclipse.osee-42197931c795e88880bc33a211f0f3d588100de7.tar.gz
org.eclipse.osee-42197931c795e88880bc33a211f0f3d588100de7.tar.xz
org.eclipse.osee-42197931c795e88880bc33a211f0f3d588100de7.zip
feature[ats_VVMH0]: Combine ResourceLocatorManager with ResourceManager service
Diffstat (limited to 'plugins/org.eclipse.osee.framework.resource.management')
-rw-r--r--plugins/org.eclipse.osee.framework.resource.management/.project5
-rw-r--r--plugins/org.eclipse.osee.framework.resource.management/META-INF/MANIFEST.MF7
-rw-r--r--plugins/org.eclipse.osee.framework.resource.management/OSGI-INF/resource.locator.consumer.xml13
-rw-r--r--plugins/org.eclipse.osee.framework.resource.management/OSGI-INF/resource.manager.xml20
-rw-r--r--plugins/org.eclipse.osee.framework.resource.management/OSGI-INF/resource.provider.consumer.xml13
-rw-r--r--plugins/org.eclipse.osee.framework.resource.management/src/org/eclipse/osee/framework/resource/management/Activator.java26
-rw-r--r--plugins/org.eclipse.osee.framework.resource.management/src/org/eclipse/osee/framework/resource/management/IResourceLocatorManager.java55
-rw-r--r--plugins/org.eclipse.osee.framework.resource.management/src/org/eclipse/osee/framework/resource/management/IResourceManager.java48
-rw-r--r--plugins/org.eclipse.osee.framework.resource.management/src/org/eclipse/osee/framework/resource/management/internal/ResourceLocatorManager.java83
-rw-r--r--plugins/org.eclipse.osee.framework.resource.management/src/org/eclipse/osee/framework/resource/management/internal/ResourceManager.java56
10 files changed, 110 insertions, 216 deletions
diff --git a/plugins/org.eclipse.osee.framework.resource.management/.project b/plugins/org.eclipse.osee.framework.resource.management/.project
index 50b5a56e69..3da7a97593 100644
--- a/plugins/org.eclipse.osee.framework.resource.management/.project
+++ b/plugins/org.eclipse.osee.framework.resource.management/.project
@@ -20,6 +20,11 @@
<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ds.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
diff --git a/plugins/org.eclipse.osee.framework.resource.management/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.resource.management/META-INF/MANIFEST.MF
index f561e8c7a8..047a639673 100644
--- a/plugins/org.eclipse.osee.framework.resource.management/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.framework.resource.management/META-INF/MANIFEST.MF
@@ -1,10 +1,9 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Management Plug-in (Incubation)
-Bundle-SymbolicName: org.eclipse.osee.framework.resource.management;singleton:=true
+Bundle-SymbolicName: org.eclipse.osee.framework.resource.management
Bundle-Version: 0.9.9.qualifier
Eclipse-ExtensibleAPI: true
-Bundle-Activator: org.eclipse.osee.framework.resource.management.Activator
Import-Package: org.eclipse.core.runtime,
org.eclipse.osee.framework.core.exception,
org.eclipse.osee.framework.jdk.core.type,
@@ -13,10 +12,10 @@ Import-Package: org.eclipse.core.runtime,
org.osgi.framework,
org.osgi.service.log,
org.osgi.util.tracker
-Bundle-ActivationPolicy: lazy
Bundle-Vendor: Eclipse Open System Engineering Environment
-Service-Component: OSGI-INF/resource.provider.consumer.xml, OSGI-INF/resource.locator.consumer.xml
+Service-Component: OSGI-INF/*.xml
Export-Package: org.eclipse.osee.framework.resource.management,
org.eclipse.osee.framework.resource.management.exception,
org.eclipse.osee.framework.resource.management.util
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
diff --git a/plugins/org.eclipse.osee.framework.resource.management/OSGI-INF/resource.locator.consumer.xml b/plugins/org.eclipse.osee.framework.resource.management/OSGI-INF/resource.locator.consumer.xml
deleted file mode 100644
index e8c95a15f8..0000000000
--- a/plugins/org.eclipse.osee.framework.resource.management/OSGI-INF/resource.locator.consumer.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0"?>
-<component name="resource.locator.manager">
- <implementation class="org.eclipse.osee.framework.resource.management.internal.ResourceLocatorManager"/>
- <service>
- <provide interface="org.eclipse.osee.framework.resource.management.IResourceLocatorManager"/>
- </service>
- <reference name="resource.locator"
- interface="org.eclipse.osee.framework.resource.management.IResourceLocatorProvider"
- bind="addResourceLocatorProvider"
- unbind="removeResourceLocatorProvider"
- cardinality="0..n"
- policy="dynamic"/>
-</component> \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.resource.management/OSGI-INF/resource.manager.xml b/plugins/org.eclipse.osee.framework.resource.management/OSGI-INF/resource.manager.xml
new file mode 100644
index 0000000000..4dfecf13c1
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.resource.management/OSGI-INF/resource.manager.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="org.eclipse.osee.framework.resource.management.internal.ResourceManager">
+ <implementation
+ class="org.eclipse.osee.framework.resource.management.internal.ResourceManager" />
+ <service>
+ <provide
+ interface="org.eclipse.osee.framework.resource.management.IResourceManager" />
+ </service>
+
+ <reference name="resource.provider"
+ interface="org.eclipse.osee.framework.resource.management.IResourceProvider"
+ bind="addResourceProvider" unbind="removeResourceProvider"
+ cardinality="0..n" policy="dynamic" />
+
+ <reference name="resource.locator"
+ interface="org.eclipse.osee.framework.resource.management.IResourceLocatorProvider"
+ bind="addResourceLocatorProvider" unbind="removeResourceLocatorProvider"
+ cardinality="0..n" policy="dynamic" />
+
+</scr:component> \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.resource.management/OSGI-INF/resource.provider.consumer.xml b/plugins/org.eclipse.osee.framework.resource.management/OSGI-INF/resource.provider.consumer.xml
deleted file mode 100644
index d2ebdf89de..0000000000
--- a/plugins/org.eclipse.osee.framework.resource.management/OSGI-INF/resource.provider.consumer.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0"?>
-<component name="resource.manager">
- <implementation class="org.eclipse.osee.framework.resource.management.internal.ResourceManager"/>
- <service>
- <provide interface="org.eclipse.osee.framework.resource.management.IResourceManager"/>
- </service>
- <reference name="resource.provider"
- interface="org.eclipse.osee.framework.resource.management.IResourceProvider"
- bind="addResourceProvider"
- unbind="removeResourceProvider"
- cardinality="0..n"
- policy="dynamic"/>
-</component> \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.resource.management/src/org/eclipse/osee/framework/resource/management/Activator.java b/plugins/org.eclipse.osee.framework.resource.management/src/org/eclipse/osee/framework/resource/management/Activator.java
deleted file mode 100644
index 4ab5fb1c57..0000000000
--- a/plugins/org.eclipse.osee.framework.resource.management/src/org/eclipse/osee/framework/resource/management/Activator.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.resource.management;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-public class Activator implements BundleActivator {
-
- @Override
- public void start(BundleContext context) throws Exception {
- }
-
- @Override
- public void stop(BundleContext context) throws Exception {
- }
-
-}
diff --git a/plugins/org.eclipse.osee.framework.resource.management/src/org/eclipse/osee/framework/resource/management/IResourceLocatorManager.java b/plugins/org.eclipse.osee.framework.resource.management/src/org/eclipse/osee/framework/resource/management/IResourceLocatorManager.java
deleted file mode 100644
index 4f71aa071b..0000000000
--- a/plugins/org.eclipse.osee.framework.resource.management/src/org/eclipse/osee/framework/resource/management/IResourceLocatorManager.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.resource.management;
-
-import java.util.Collection;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-
-/**
- * @author Roberto E. Escobar
- */
-public interface IResourceLocatorManager {
-
- /**
- * Generate a resource locator based on protocol, seed and name
- *
- * @return a resource locator
- */
- IResourceLocator generateResourceLocator(String protocol, String seed, String name) throws OseeCoreException;
-
- /**
- * Get resource locator based on protocol and path
- *
- * @return a resource locator
- */
- IResourceLocator getResourceLocator(String path) throws OseeCoreException;
-
- /**
- * Add resource locator provider
- *
- * @return <b>true<b> if the locator was added
- */
- boolean addResourceLocatorProvider(IResourceLocatorProvider resourceLocatorProvider);
-
- /**
- * Remove resource locator provider
- *
- * @return <b>true<b> if the locator was removed
- */
- boolean removeResourceLocatorProvider(IResourceLocatorProvider resourceLocatorProvider);
-
- /**
- * Supported Protocols
- *
- * @return supported protocols
- */
- Collection<String> getProtocols();
-}
diff --git a/plugins/org.eclipse.osee.framework.resource.management/src/org/eclipse/osee/framework/resource/management/IResourceManager.java b/plugins/org.eclipse.osee.framework.resource.management/src/org/eclipse/osee/framework/resource/management/IResourceManager.java
index 879b95f023..7659e05932 100644
--- a/plugins/org.eclipse.osee.framework.resource.management/src/org/eclipse/osee/framework/resource/management/IResourceManager.java
+++ b/plugins/org.eclipse.osee.framework.resource.management/src/org/eclipse/osee/framework/resource/management/IResourceManager.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.osee.framework.resource.management;
+import java.util.Collection;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
@@ -25,26 +26,12 @@ public interface IResourceManager {
/**
* Add listener to list
*/
- public boolean addResourceListener(IResourceListener listener);
+ boolean addResourceListener(IResourceListener listener);
/**
* Remove listener from list
*/
- public boolean removeResourceListener(IResourceListener listener);
-
- /**
- * Add a resource provider
- *
- * @param resourceProvider to add
- */
- public boolean addResourceProvider(IResourceProvider resourceProvider);
-
- /**
- * Remove a resource provider
- *
- * @param resourceProvider to remove
- */
- public boolean removeResourceProvider(IResourceProvider resourceProvider);
+ boolean removeResourceListener(IResourceListener listener);
/**
* Acquire resource specified by resource locator
@@ -53,14 +40,14 @@ public interface IResourceManager {
* @param options operation options
* @return the resource
*/
- public IResource acquire(IResourceLocator locator, PropertyStore options) throws OseeCoreException;
+ IResource acquire(IResourceLocator locator, PropertyStore options) throws OseeCoreException;
/**
* Determines if a resource exists for the given locator.
*
* @param locator location of the data to check
*/
- public boolean exists(IResourceLocator locator) throws OseeCoreException;
+ boolean exists(IResourceLocator locator) throws OseeCoreException;
/**
* Save input to location specified by resource locator
@@ -69,12 +56,33 @@ public interface IResourceManager {
* @param resource to store
* @param options operation options
*/
- public IResourceLocator save(final IResourceLocator locatorHint, final IResource resource, final PropertyStore options) throws OseeCoreException;
+ IResourceLocator save(final IResourceLocator locatorHint, final IResource resource, final PropertyStore options) throws OseeCoreException;
/**
* Delete resource specified by resource locator
*
* @param locator location of the resource to delete
*/
- public int delete(IResourceLocator locator) throws OseeCoreException;
+ int delete(IResourceLocator locator) throws OseeCoreException;
+
+ /**
+ * Generate a resource locator based on protocol, seed and name
+ *
+ * @return a resource locator
+ */
+ IResourceLocator generateResourceLocator(String protocol, String seed, String name) throws OseeCoreException;
+
+ /**
+ * Get resource locator based on protocol and path
+ *
+ * @return a resource locator
+ */
+ IResourceLocator getResourceLocator(String path) throws OseeCoreException;
+
+ /**
+ * Supported Protocols
+ *
+ * @return supported protocols
+ */
+ Collection<String> getProtocols();
}
diff --git a/plugins/org.eclipse.osee.framework.resource.management/src/org/eclipse/osee/framework/resource/management/internal/ResourceLocatorManager.java b/plugins/org.eclipse.osee.framework.resource.management/src/org/eclipse/osee/framework/resource/management/internal/ResourceLocatorManager.java
deleted file mode 100644
index 20243df12e..0000000000
--- a/plugins/org.eclipse.osee.framework.resource.management/src/org/eclipse/osee/framework/resource/management/internal/ResourceLocatorManager.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.resource.management.internal;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.concurrent.CopyOnWriteArraySet;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeStateException;
-import org.eclipse.osee.framework.resource.management.IResourceLocator;
-import org.eclipse.osee.framework.resource.management.IResourceLocatorManager;
-import org.eclipse.osee.framework.resource.management.IResourceLocatorProvider;
-import org.eclipse.osee.framework.resource.management.exception.MalformedLocatorException;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ResourceLocatorManager implements IResourceLocatorManager {
-
- private final Collection<IResourceLocatorProvider> resourceLocatorProviders;
-
- public ResourceLocatorManager() {
- this.resourceLocatorProviders = new CopyOnWriteArraySet<IResourceLocatorProvider>();
- }
-
- @Override
- public Collection<String> getProtocols() {
- Set<String> protocols = new HashSet<String>();
- for (IResourceLocatorProvider provider : resourceLocatorProviders) {
- protocols.add(provider.getSupportedProtocol());
- }
- return protocols;
- }
-
- @Override
- public boolean addResourceLocatorProvider(IResourceLocatorProvider resourceLocatorProvider) {
- return this.resourceLocatorProviders.add(resourceLocatorProvider);
- }
-
- @Override
- public boolean removeResourceLocatorProvider(IResourceLocatorProvider resourceLocatorProvider) {
- return this.resourceLocatorProviders.remove(resourceLocatorProvider);
- }
-
- @Override
- public IResourceLocator generateResourceLocator(String protocol, String seed, String name) throws OseeCoreException {
- IResourceLocatorProvider resourceLocatorProvider = getProvider(protocol);
- return resourceLocatorProvider.generateResourceLocator(seed, name);
- }
-
- @Override
- public IResourceLocator getResourceLocator(String path) throws OseeCoreException {
- IResourceLocatorProvider resourceLocatorProvider = getProvider(path);
- return resourceLocatorProvider.getResourceLocator(path);
- }
-
- private IResourceLocatorProvider getProvider(String protocol) throws OseeCoreException {
- if (resourceLocatorProviders.isEmpty()) {
- throw new OseeStateException("Resource locator providers are not available");
- }
- IResourceLocatorProvider toReturn = null;
- for (IResourceLocatorProvider provider : resourceLocatorProviders) {
- if (provider.isValid(protocol)) {
- toReturn = provider;
- break;
- }
- }
- if (toReturn == null) {
- throw new MalformedLocatorException("Error finding locator for [%s] in [%s]", protocol,
- resourceLocatorProviders);
- }
- return toReturn;
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.resource.management/src/org/eclipse/osee/framework/resource/management/internal/ResourceManager.java b/plugins/org.eclipse.osee.framework.resource.management/src/org/eclipse/osee/framework/resource/management/internal/ResourceManager.java
index 3e365710bb..8d223da84a 100644
--- a/plugins/org.eclipse.osee.framework.resource.management/src/org/eclipse/osee/framework/resource/management/internal/ResourceManager.java
+++ b/plugins/org.eclipse.osee.framework.resource.management/src/org/eclipse/osee/framework/resource/management/internal/ResourceManager.java
@@ -11,15 +11,20 @@
package org.eclipse.osee.framework.resource.management.internal;
import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.exception.OseeNotFoundException;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
import org.eclipse.osee.framework.resource.management.IResource;
import org.eclipse.osee.framework.resource.management.IResourceListener;
import org.eclipse.osee.framework.resource.management.IResourceLocator;
+import org.eclipse.osee.framework.resource.management.IResourceLocatorProvider;
import org.eclipse.osee.framework.resource.management.IResourceManager;
import org.eclipse.osee.framework.resource.management.IResourceProvider;
+import org.eclipse.osee.framework.resource.management.exception.MalformedLocatorException;
/**
* @author Roberto E. Escobar
@@ -28,10 +33,12 @@ public class ResourceManager implements IResourceManager {
private final Collection<IResourceListener> listeners;
private final Collection<IResourceProvider> resourceProviders;
+ private final Collection<IResourceLocatorProvider> resourceLocatorProviders;
public ResourceManager() {
this.listeners = new CopyOnWriteArraySet<IResourceListener>();
this.resourceProviders = new CopyOnWriteArraySet<IResourceProvider>();
+ this.resourceLocatorProviders = new CopyOnWriteArraySet<IResourceLocatorProvider>();
}
@Override
@@ -95,12 +102,10 @@ public class ResourceManager implements IResourceManager {
return toReturn;
}
- @Override
public boolean addResourceProvider(IResourceProvider resourceProvider) {
return resourceProviders.add(resourceProvider);
}
- @Override
public boolean removeResourceProvider(IResourceProvider resourceProvider) {
return resourceProviders.remove(resourceProvider);
}
@@ -138,4 +143,51 @@ public class ResourceManager implements IResourceManager {
IResourceProvider provider = getProvider(locator);
return provider.exists(locator);
}
+
+ @Override
+ public Collection<String> getProtocols() {
+ Set<String> protocols = new HashSet<String>();
+ for (IResourceLocatorProvider provider : resourceLocatorProviders) {
+ protocols.add(provider.getSupportedProtocol());
+ }
+ return protocols;
+ }
+
+ public boolean addResourceLocatorProvider(IResourceLocatorProvider resourceLocatorProvider) {
+ return this.resourceLocatorProviders.add(resourceLocatorProvider);
+ }
+
+ public boolean removeResourceLocatorProvider(IResourceLocatorProvider resourceLocatorProvider) {
+ return this.resourceLocatorProviders.remove(resourceLocatorProvider);
+ }
+
+ @Override
+ public IResourceLocator generateResourceLocator(String protocol, String seed, String name) throws OseeCoreException {
+ IResourceLocatorProvider resourceLocatorProvider = getProvider(protocol);
+ return resourceLocatorProvider.generateResourceLocator(seed, name);
+ }
+
+ @Override
+ public IResourceLocator getResourceLocator(String path) throws OseeCoreException {
+ IResourceLocatorProvider resourceLocatorProvider = getProvider(path);
+ return resourceLocatorProvider.getResourceLocator(path);
+ }
+
+ private IResourceLocatorProvider getProvider(String protocol) throws OseeCoreException {
+ if (resourceLocatorProviders.isEmpty()) {
+ throw new OseeStateException("Resource locator providers are not available");
+ }
+ IResourceLocatorProvider toReturn = null;
+ for (IResourceLocatorProvider provider : resourceLocatorProviders) {
+ if (provider.isValid(protocol)) {
+ toReturn = provider;
+ break;
+ }
+ }
+ if (toReturn == null) {
+ throw new MalformedLocatorException("Error finding locator for [%s] in [%s]", protocol,
+ resourceLocatorProviders);
+ }
+ return toReturn;
+ }
}

Back to the top