Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorafinkbein2008-09-26 17:00:45 +0000
committerafinkbein2008-09-26 17:00:45 +0000
commitb33ddb1903f21d54165ffc3db1eff8debf190085 (patch)
tree07da009396e965d2e9fa2a251255ccda37c72dcf
parentf5c2f8cc8756ae13c03ab6bdd626051d6113e56f (diff)
downloadorg.eclipse.osee-b33ddb1903f21d54165ffc3db1eff8debf190085.tar.gz
org.eclipse.osee-b33ddb1903f21d54165ffc3db1eff8debf190085.tar.xz
org.eclipse.osee-b33ddb1903f21d54165ffc3db1eff8debf190085.zip
-rw-r--r--org.eclipse.osee.framework.resource.locator.attribute/.classpath7
-rw-r--r--org.eclipse.osee.framework.resource.locator.attribute/.project28
-rw-r--r--org.eclipse.osee.framework.resource.locator.attribute/.settings/org.eclipse.pde.core.prefs4
-rw-r--r--org.eclipse.osee.framework.resource.locator.attribute/META-INF/MANIFEST.MF14
-rw-r--r--org.eclipse.osee.framework.resource.locator.attribute/OSGI-INF/locator.provider.attribute.xml7
-rw-r--r--org.eclipse.osee.framework.resource.locator.attribute/build.properties5
-rw-r--r--org.eclipse.osee.framework.resource.locator.attribute/src/org/eclipse/osee/framework/resource/locator/attribute/Activator.java32
-rw-r--r--org.eclipse.osee.framework.resource.locator.attribute/src/org/eclipse/osee/framework/resource/locator/attribute/AttributeLocatorProvider.java95
8 files changed, 192 insertions, 0 deletions
diff --git a/org.eclipse.osee.framework.resource.locator.attribute/.classpath b/org.eclipse.osee.framework.resource.locator.attribute/.classpath
new file mode 100644
index 00000000000..8a8f1668cdc
--- /dev/null
+++ b/org.eclipse.osee.framework.resource.locator.attribute/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.osee.framework.resource.locator.attribute/.project b/org.eclipse.osee.framework.resource.locator.attribute/.project
new file mode 100644
index 00000000000..7d90409e1b2
--- /dev/null
+++ b/org.eclipse.osee.framework.resource.locator.attribute/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osee.framework.resource.locator.attribute</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.osee.framework.resource.locator.attribute/.settings/org.eclipse.pde.core.prefs b/org.eclipse.osee.framework.resource.locator.attribute/.settings/org.eclipse.pde.core.prefs
new file mode 100644
index 00000000000..fe8cf7b05d8
--- /dev/null
+++ b/org.eclipse.osee.framework.resource.locator.attribute/.settings/org.eclipse.pde.core.prefs
@@ -0,0 +1,4 @@
+#Tue Apr 15 12:47:34 MST 2008
+eclipse.preferences.version=1
+pluginProject.extensions=false
+resolve.requirebundle=false
diff --git a/org.eclipse.osee.framework.resource.locator.attribute/META-INF/MANIFEST.MF b/org.eclipse.osee.framework.resource.locator.attribute/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..8604388c9a9
--- /dev/null
+++ b/org.eclipse.osee.framework.resource.locator.attribute/META-INF/MANIFEST.MF
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Locator Plug-in
+Bundle-SymbolicName: org.eclipse.osee.framework.resource.locator.attribute
+Bundle-Version: 0.4.0.qualifier
+Bundle-Activator: org.eclipse.osee.framework.resource.locator.attribute.Activator
+Bundle-Vendor: Boeing
+Bundle-ActivationPolicy: lazy
+Service-Component: OSGI-INF/locator.provider.attribute.xml
+Import-Package: org.eclipse.osee.framework.resource.management,
+ org.eclipse.osee.framework.resource.management.exception,
+ org.osgi.framework;version="1.3.0"
+Export-Package: org.eclipse.osee.framework.resource.locator.attribute
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/org.eclipse.osee.framework.resource.locator.attribute/OSGI-INF/locator.provider.attribute.xml b/org.eclipse.osee.framework.resource.locator.attribute/OSGI-INF/locator.provider.attribute.xml
new file mode 100644
index 00000000000..dc7131e8a49
--- /dev/null
+++ b/org.eclipse.osee.framework.resource.locator.attribute/OSGI-INF/locator.provider.attribute.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<component name="resource.locator.attribute">
+ <implementation class="org.eclipse.osee.framework.resource.locator.attribute.AttributeLocatorProvider"/>
+ <service>
+ <provide interface="org.eclipse.osee.framework.resource.management.IResourceLocatorProvider"/>
+ </service>
+</component> \ No newline at end of file
diff --git a/org.eclipse.osee.framework.resource.locator.attribute/build.properties b/org.eclipse.osee.framework.resource.locator.attribute/build.properties
new file mode 100644
index 00000000000..a65755cb2a8
--- /dev/null
+++ b/org.eclipse.osee.framework.resource.locator.attribute/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ OSGI-INF/
diff --git a/org.eclipse.osee.framework.resource.locator.attribute/src/org/eclipse/osee/framework/resource/locator/attribute/Activator.java b/org.eclipse.osee.framework.resource.locator.attribute/src/org/eclipse/osee/framework/resource/locator/attribute/Activator.java
new file mode 100644
index 00000000000..3d0090b11cf
--- /dev/null
+++ b/org.eclipse.osee.framework.resource.locator.attribute/src/org/eclipse/osee/framework/resource/locator/attribute/Activator.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * 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.locator.attribute;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ }
+
+}
diff --git a/org.eclipse.osee.framework.resource.locator.attribute/src/org/eclipse/osee/framework/resource/locator/attribute/AttributeLocatorProvider.java b/org.eclipse.osee.framework.resource.locator.attribute/src/org/eclipse/osee/framework/resource/locator/attribute/AttributeLocatorProvider.java
new file mode 100644
index 00000000000..df19161c393
--- /dev/null
+++ b/org.eclipse.osee.framework.resource.locator.attribute/src/org/eclipse/osee/framework/resource/locator/attribute/AttributeLocatorProvider.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * 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.locator.attribute;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.net.URI;
+import org.eclipse.osee.framework.resource.management.IResourceLocator;
+import org.eclipse.osee.framework.resource.management.IResourceLocatorProvider;
+import org.eclipse.osee.framework.resource.management.ResourceLocator;
+import org.eclipse.osee.framework.resource.management.exception.MalformedLocatorException;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class AttributeLocatorProvider implements IResourceLocatorProvider {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osee.framework.resource.management.IResourceLocatorProvider#generateResourceLocator(java.lang.String)
+ */
+ @Override
+ public IResourceLocator generateResourceLocator(String seed, String name) throws MalformedLocatorException {
+ URI uri = null;
+ try {
+ uri = new URI(generatePath(seed, name));
+ } catch (Exception ex) {
+ throw new MalformedLocatorException(ex);
+ }
+ return new ResourceLocator(uri);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osee.framework.resource.management.IResourceLocatorProvider#getResourceLocator(java.lang.String)
+ */
+ @Override
+ public IResourceLocator getResourceLocator(String path) throws MalformedLocatorException {
+ URI uri = null;
+ if (isPathValid(path) != false) {
+ try {
+ uri = new URI(path);
+ } catch (Exception ex) {
+ throw new MalformedLocatorException(ex);
+ }
+ } else {
+ throw new MalformedLocatorException(String.format("Invalid path hint: [%s]", path));
+ }
+ return new ResourceLocator(uri);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osee.framework.resource.management.IResourceLocatorProvider#isValid(java.lang.String)
+ */
+ @Override
+ public boolean isValid(String protocol) {
+ return isArgValid(protocol) != false && protocol.startsWith("attr") != false;
+ }
+
+ private boolean isArgValid(String value) {
+ return value != null && value.length() > 0;
+ }
+
+ private boolean isPathValid(String value) {
+ return isArgValid(value) && value.startsWith("attr://");
+ }
+
+ private String generatePath(String seed, String name) throws MalformedLocatorException {
+ StringBuilder builder = new StringBuilder("attr://");
+ if (isArgValid(seed) != false && isArgValid(name) != false) {
+ try {
+ char[] buffer = new char[3];
+ int cnt = -1;
+ Reader in = new StringReader(seed);
+ while ((cnt = in.read(buffer)) != -1) {
+ builder.append(buffer, 0, cnt);
+ builder.append("/");
+ }
+ } catch (IOException ex) {
+ throw new MalformedLocatorException(ex);
+ }
+ builder.append(name);
+ } else {
+ throw new MalformedLocatorException("Invalid arguments during locator generation.");
+ }
+ return builder.toString();
+ }
+}

Back to the top