|
From: <ri...@us...> - 2007-03-07 08:40:50
|
Revision: 110
http://techne-dev.svn.sourceforge.net/techne-dev/?rev=110&view=rev
Author: rickles
Date: 2007-03-07 00:40:50 -0800 (Wed, 07 Mar 2007)
Log Message:
-----------
Check in prototype code.
Added Paths:
-----------
prototype/org.digivitality.techne.component/
prototype/org.digivitality.techne.component/.classpath
prototype/org.digivitality.techne.component/.project
prototype/org.digivitality.techne.component/bin/
prototype/org.digivitality.techne.component/classes/
prototype/org.digivitality.techne.component/classes/org/
prototype/org.digivitality.techne.component/classes/org/digivitality/
prototype/org.digivitality.techne.component/classes/org/digivitality/techne/
prototype/org.digivitality.techne.component/classes/org/digivitality/techne/component/
prototype/org.digivitality.techne.component/classes/org/digivitality/techne/component/ComponentManager.class
prototype/org.digivitality.techne.component/classes/org/digivitality/techne/component/Feature.class
prototype/org.digivitality.techne.component/classes/org/digivitality/techne/component/FeatureSet.class
prototype/org.digivitality.techne.component/classes/org/digivitality/techne/component/Fragment.class
prototype/org.digivitality.techne.component/classes/org/digivitality/techne/component/interfaces/
prototype/org.digivitality.techne.component/classes/org/digivitality/techne/component/interfaces/Component.class
prototype/org.digivitality.techne.component/src/
prototype/org.digivitality.techne.component/src/org/
prototype/org.digivitality.techne.component/src/org/digivitality/
prototype/org.digivitality.techne.component/src/org/digivitality/techne/
prototype/org.digivitality.techne.component/src/org/digivitality/techne/component/
prototype/org.digivitality.techne.component/src/org/digivitality/techne/component/ComponentManager.java
prototype/org.digivitality.techne.component/src/org/digivitality/techne/component/Feature.java
prototype/org.digivitality.techne.component/src/org/digivitality/techne/component/FeatureSet.java
prototype/org.digivitality.techne.component/src/org/digivitality/techne/component/Fragment.java
prototype/org.digivitality.techne.component/src/org/digivitality/techne/component/interfaces/
prototype/org.digivitality.techne.component/src/org/digivitality/techne/component/interfaces/Component.java
Added: prototype/org.digivitality.techne.component/.classpath
===================================================================
--- prototype/org.digivitality.techne.component/.classpath (rev 0)
+++ prototype/org.digivitality.techne.component/.classpath 2007-03-07 08:40:50 UTC (rev 110)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="output" path="classes"/>
+</classpath>
Added: prototype/org.digivitality.techne.component/.project
===================================================================
--- prototype/org.digivitality.techne.component/.project (rev 0)
+++ prototype/org.digivitality.techne.component/.project 2007-03-07 08:40:50 UTC (rev 110)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.digivitality.techne.component</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: prototype/org.digivitality.techne.component/classes/org/digivitality/techne/component/ComponentManager.class
===================================================================
(Binary files differ)
Property changes on: prototype/org.digivitality.techne.component/classes/org/digivitality/techne/component/ComponentManager.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: prototype/org.digivitality.techne.component/classes/org/digivitality/techne/component/Feature.class
===================================================================
(Binary files differ)
Property changes on: prototype/org.digivitality.techne.component/classes/org/digivitality/techne/component/Feature.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: prototype/org.digivitality.techne.component/classes/org/digivitality/techne/component/FeatureSet.class
===================================================================
(Binary files differ)
Property changes on: prototype/org.digivitality.techne.component/classes/org/digivitality/techne/component/FeatureSet.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: prototype/org.digivitality.techne.component/classes/org/digivitality/techne/component/Fragment.class
===================================================================
(Binary files differ)
Property changes on: prototype/org.digivitality.techne.component/classes/org/digivitality/techne/component/Fragment.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: prototype/org.digivitality.techne.component/classes/org/digivitality/techne/component/interfaces/Component.class
===================================================================
(Binary files differ)
Property changes on: prototype/org.digivitality.techne.component/classes/org/digivitality/techne/component/interfaces/Component.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: prototype/org.digivitality.techne.component/src/org/digivitality/techne/component/ComponentManager.java
===================================================================
--- prototype/org.digivitality.techne.component/src/org/digivitality/techne/component/ComponentManager.java (rev 0)
+++ prototype/org.digivitality.techne.component/src/org/digivitality/techne/component/ComponentManager.java 2007-03-07 08:40:50 UTC (rev 110)
@@ -0,0 +1,127 @@
+/**
+ *
+ */
+package org.digivitality.techne.component;
+
+import java.io.File;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.digivitality.techne.component.interfaces.Component;
+
+
+/**
+ * @author Rick Litton
+ *
+ */
+public class ComponentManager {
+
+ private List features = new ArrayList();
+ private List featureSets = new ArrayList();
+ private List fragments = new ArrayList();
+ private Map registry = new HashMap();
+
+ public ComponentManager() {
+ init();
+ }
+
+ public void init() {
+ try {
+ File file1 = new File("load/rssfeed.jar");
+ File file2 = new File("load/email.jar");
+ File file3 = new File("load/blog.jar");
+ File file4 = new File("load/filebrowser.jar");
+ fragments.add(new Fragment("RSS Feed", file1.toURL(), "1.0.0", "0"));
+ fragments.add(new Fragment("Email", file2.toURL(), "1.0.0", "1"));
+ fragments.add(new Fragment("MyBlog", file3.toURL(), "1.0.0", "2"));
+ fragments.add(new Fragment("FileBrowser", file4.toURL(), "1.0.0", "3"));
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public List getFragments() {
+ return fragments;
+ }
+
+ public List getComponents() {
+ List components = new ArrayList();
+ components.add(features);
+ components.add(featureSets);
+ components.add(fragments);
+ return components;
+ }
+
+ public Component getComponent(String id) {
+ Object[] objs = getComponents().toArray();
+ for (int i = 0; i < objs.length; i++) {
+ ArrayList list = (ArrayList)objs[i];
+ Object[] components = list.toArray();
+ for (int j = 0; j < components.length; j++){
+ if (components[j] instanceof org.digivitality.techne.component.Fragment)
+ return getFragment(id);
+ else if (components[j] instanceof org.digivitality.techne.component.Feature)
+ return getFeature(id);
+ }
+ }
+ return null;
+ }
+
+ public void addFragment(Fragment fragment) {
+ fragments.add(fragment);
+ }
+
+ public void addFeature(Feature feature) {
+ features.add(feature);
+ }
+
+ public List getFeatures() {
+ return features;
+ }
+
+ public Fragment addFragmentToFeature(String id, String feature) {
+ Fragment f = getFragment(id);
+ Feature ft = getFeature(feature);
+ ft.add(f);
+ return f;
+ }
+
+ public Fragment getFragment(String id) {
+ Iterator iter = fragments.iterator();
+ Fragment f = null;
+ while(iter.hasNext()) {
+ f = (Fragment)iter.next();
+ if (f.getId().equals(id))
+ return f;
+ }
+ return null;
+ }
+
+ public Feature getFeature(String name) {
+ name = name.trim();
+ Iterator iter = features.iterator();
+ Feature ft = null;
+ //System.out.println("Trying to get feature: '" + name + "'");
+ //System.out.println("Number of features: " + features.size());
+ while(iter.hasNext()) {
+ ft = (Feature)iter.next();
+ //System.out.println("Got this feature: '" + ft.getName() + "'");
+ if (ft.getName().equals(name))
+ return ft;
+ }
+ return null;
+ }
+
+ // this will be converted to DS
+ public void register(String key, Object value) {
+ registry.put(key, value);
+ }
+
+ public Object find(String key) {
+ return registry.get(key);
+ }
+ }
Added: prototype/org.digivitality.techne.component/src/org/digivitality/techne/component/Feature.java
===================================================================
--- prototype/org.digivitality.techne.component/src/org/digivitality/techne/component/Feature.java (rev 0)
+++ prototype/org.digivitality.techne.component/src/org/digivitality/techne/component/Feature.java 2007-03-07 08:40:50 UTC (rev 110)
@@ -0,0 +1,82 @@
+package org.digivitality.techne.component;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.digivitality.techne.component.interfaces.Component;
+
+public class Feature implements Component {
+ private URL location;
+ private String name;
+ private String id = "1.0";
+ private List fragments = new ArrayList();
+ private String state;
+ private String version;
+ private static String DEFAULT_STATE = "Uninstalled";
+ private String type = Component.FEATURE_TYPE;
+
+ public Feature(String name, String version, String id) {
+ setName(name);
+ setVersion(version);
+ setState(DEFAULT_STATE);
+ setId(id);
+ }
+
+ public void setLocation(URL url) {
+ this.location = url;
+ }
+
+ public URL getLocation() {
+ return location;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void add(Fragment fragment) {
+ fragments.add(fragment);
+ }
+
+ public List getFragments() {
+ return fragments;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ public String getState() {
+ return state;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ // TODO Auto-generated method stub
+
+ }
+}
Added: prototype/org.digivitality.techne.component/src/org/digivitality/techne/component/FeatureSet.java
===================================================================
--- prototype/org.digivitality.techne.component/src/org/digivitality/techne/component/FeatureSet.java (rev 0)
+++ prototype/org.digivitality.techne.component/src/org/digivitality/techne/component/FeatureSet.java 2007-03-07 08:40:50 UTC (rev 110)
@@ -0,0 +1,90 @@
+package org.digivitality.techne.component;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.digivitality.techne.component.interfaces.Component;
+
+public class FeatureSet implements Component{
+
+ private URL location;
+ private String name;
+ private List list = new ArrayList();
+ private String type = Component.FEATURE_SET_TYPE;
+
+ FeatureSet() {}
+
+ FeatureSet(String name, URL url, List features) {
+ setName(name);
+ setLocation(url);
+ setFeatures(features);
+ }
+
+ public void setLocation(URL url) {
+ this.location = url;
+ }
+
+ public URL getLocation() {
+ return location;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void add(Feature feature) {
+ list.add(feature);
+ }
+
+ public List getFeatures() {
+ return list;
+ }
+
+ public void setFeatures(List features) {
+ this.list = features;
+ }
+
+ public String getId() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getState() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getVersion() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setId(String id) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setState(String state) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setVersion(String version) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ // TODO Auto-generated method stub
+
+ }
+}
Added: prototype/org.digivitality.techne.component/src/org/digivitality/techne/component/Fragment.java
===================================================================
--- prototype/org.digivitality.techne.component/src/org/digivitality/techne/component/Fragment.java (rev 0)
+++ prototype/org.digivitality.techne.component/src/org/digivitality/techne/component/Fragment.java 2007-03-07 08:40:50 UTC (rev 110)
@@ -0,0 +1,85 @@
+/**
+ *
+ */
+package org.digivitality.techne.component;
+
+import java.net.URL;
+
+import org.digivitality.techne.component.interfaces.Component;
+
+/**
+ * @author Rick Litton
+ *
+ */
+public class Fragment implements Component {
+
+ private URL location;
+ private String name;
+ private String id;
+ private String state;
+ private String version;
+ private static String DEFAULT_STATE = "Uninstalled";
+ private String type = Component.FRAGMENT_TYPE;
+
+ public Fragment(String name) {
+ setName(name);
+ }
+
+ public Fragment(String name, URL url, String version, String id) {
+ setName(name);
+ setLocation(url);
+ setVersion(version);
+ setState(DEFAULT_STATE);
+ setId(id);
+ }
+
+ public void setLocation(URL url) {
+ this.location = url;
+ }
+
+ public URL getLocation() {
+ return location;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ public String getState() {
+ return state;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public String getType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setType(String type) {
+ // TODO Auto-generated method stub
+
+ }
+}
Added: prototype/org.digivitality.techne.component/src/org/digivitality/techne/component/interfaces/Component.java
===================================================================
--- prototype/org.digivitality.techne.component/src/org/digivitality/techne/component/interfaces/Component.java (rev 0)
+++ prototype/org.digivitality.techne.component/src/org/digivitality/techne/component/interfaces/Component.java 2007-03-07 08:40:50 UTC (rev 110)
@@ -0,0 +1,24 @@
+/**
+ *
+ */
+package org.digivitality.techne.component.interfaces;
+
+/**
+ * @author Rick Litton
+ *
+ */
+public interface Component {
+ public static String FRAGMENT_TYPE = "Fragment";
+ public static String FEATURE_TYPE = "Feature";
+ public static String FEATURE_SET_TYPE = "Feature Set";
+ public void setName(String name);
+ public String getName();
+ public void setId(String id);
+ public String getId();
+ public void setState(String state);
+ public String getState();
+ public void setVersion(String version);
+ public String getVersion();
+ public void setType(String type);
+ public String getType();
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|