Re: [morphos] [PATCH] some funcionality

2003-01-23 Thread Jeremias Maerki
Nicola,

it seems like this patch hasn't made it in fully. For example, the
BasicMorpherFactory doesn't contain all the code that Tomasz Pik had in
his patch. Would you please have another look at it? Thanks!

I've finally got some time and reason to have a closer look at Morphos.
I'll try to come up with a Morpher for FOP to get a feel for it.

On 12.01.2003 11:28:35 Nicola Ken Barozzi wrote:
 
 Tomasz Pik wrote:
  Hi all,
  
  Attached patch contains most of the funcionality discussed
  here: http://nagoya.apache.org/eyebrowse/ReadMsg?listId=15msgNo=20440
  
  Nicola, please, review it and let me know your opinion.
 
 Ok, all good. Committed. Please check if all is ok.
 
 Thanks :-)
 
 The next step I want to do is to make it possible to use Cocoon Blocks 
 in it as a components drop-in system.



Jeremias Maerki


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: [morphos] next steps was Re: [morphos] [PATCH] some funcionality

2003-01-17 Thread Nicola Ken Barozzi


Tomasz Pik wrote:

Nicola Ken Barozzi wrote:


[...]

The next step I want to do is to make it possible to use Cocoon Blocks 
in it as a components drop-in system.


It's not so clear to me :-(

As always, problem with project dependencies.
1) Morphos depends on Cocoon?
2) Cocoon (in the future) depends on Morphos;

ad 2 - I cannot find something like 'cocoon api'. Just huge
set of javadocs with everything inside. I'm not too good in
Cocoon internals so I don't know where to look for... :-(


The idea is that both remain as separate as possible in the framework, 
but that for implementations Morphos depends on Cocoon.

This means that Morphers should be written IMHO as Cocoon Components, 
that are Generators, Transformers, Serializers, Readers.

So Morphos implementations will use Cocoon blocks and depend on Cocoon.

I'm going to write in more depth about it real soon.

Right now I'm working (in free time, so I'm not too fast)
on JAXP-related classes.


Cool! :-)

--
Nicola Ken Barozzi   [EMAIL PROTECTED]
- verba volant, scripta manent -
   (discussions get forgotten, just code remains)
-


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




[morphos] next steps was Re: [morphos] [PATCH] some funcionality

2003-01-15 Thread Tomasz Pik
Nicola Ken Barozzi wrote:


Tomasz Pik wrote:

Ok, all good. Committed. Please check if all is ok.


Thanks, I've found a typo somewhere in docs but I'll fix
it next patch.


Thanks :-)

The next step I want to do is to make it possible to use Cocoon Blocks 
in it as a components drop-in system.

It's not so clear to me :-(

As always, problem with project dependencies.
1) Morphos depends on Cocoon?
2) Cocoon (in the future) depends on Morphos;

ad 2 - I cannot find something like 'cocoon api'. Just huge
set of javadocs with everything inside. I'm not too good in
Cocoon internals so I don't know where to look for... :-(

Right now I'm working (in free time, so I'm not too fast)
on JAXP-related classes.

--
Regards
Tomek Pik
[EMAIL PROTECTED]



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: [morphos] [PATCH] some funcionality

2003-01-12 Thread Nicola Ken Barozzi

Tomasz Pik wrote:

Hi all,

Attached patch contains most of the funcionality discussed
here: http://nagoya.apache.org/eyebrowse/ReadMsg?listId=15msgNo=20440

Nicola, please, review it and let me know your opinion.


Ok, all good. Committed. Please check if all is ok.

Thanks :-)

The next step I want to do is to make it possible to use Cocoon Blocks 
in it as a components drop-in system.

--
Nicola Ken Barozzi   [EMAIL PROTECTED]
- verba volant, scripta manent -
   (discussions get forgotten, just code remains)
-


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]



[morphos] [PATCH] some funcionality

2002-12-30 Thread Tomasz Pik
Hi all,

Attached patch contains most of the funcionality discussed
here: http://nagoya.apache.org/eyebrowse/ReadMsg?listId=15msgNo=20440

Nicola, please, review it and let me know your opinion.

Comments welcome...

Regards
Tomek Pik
[EMAIL PROTECTED]

Index: org/apache/commons/morphos/ObjectFlavor.java
===
RCS file: 
/home/cvspublic/jakarta-commons-sandbox/morphos/src/java/org/apache/commons/morphos/ObjectFlavor.java,v
retrieving revision 1.1
diff -u -r1.1 ObjectFlavor.java
--- org/apache/commons/morphos/ObjectFlavor.java  25 Jul 2002 13:18:10 -  1.1
+++ org/apache/commons/morphos/ObjectFlavor.java  30 Dec 2002 23:45:35 -
@@ -84,6 +84,7 @@
  *
  * @param dataType The mime type
  * @param dataForm The format in which the data is (object, file, stream, etc)
+ * @throws IllegalArgumentException if one (or both) of agumentets is 
+codenull/code
  */
  public ObjectFlavor (String dataType, String dataForm) {
setDataType(dataType);
@@ -98,10 +99,29 @@
setDataForm();
  }
 
+ /**
+  * Sets data type of this flavor.
+  * 
+  * Data type cannot be codenull/code.
+  * 
+  * @param dataType The mime type
+  * @throws IllegalArgumentException if codedataType/code
+  * is codenull/code.
+  */
  void setDataType(String dataType){
this.dataType = dataType;
  }
  
+ /**
+  * Sets data form of this flavor.
+  * 
+  * Data form cannot be codenull/code.
+  * 
+  * @param dataForm The format in which the data is
+  *   (object, file, stream, etc)
+  * @throws IllegalArgumentException if codedataForm/code
+  * is codenull/code.
+  */
  void setDataForm(String dataForm){
this.dataForm = dataForm;
  }
@@ -113,7 +133,26 @@
  String getdataForm(){
return dataForm; 
  }
-  
+
+/**
+ * @see Object#equals(java.lang.Object)
+ */
+public boolean equals(Object o) {
+try {
+ObjectFlavor other = (ObjectFlavor) o;
+return (other.getdataType().equals(dataType) 
+other.getdataForm().equals(dataForm));
+} catch (ClassCastException cce) {
+return false;
+}  
+}
+
+/**
+ * @see Object#hashCode()
+ */
+public int hashCode() {
+return (dataType + - + dataForm).hashCode();
+}
 }
 
 
Index: org/apache/commons/morphos/factories/BasicMorpherFactory.java
===
RCS file: 
/home/cvspublic/jakarta-commons-sandbox/morphos/src/java/org/apache/commons/morphos/factories/BasicMorpherFactory.java,v
retrieving revision 1.2
diff -u -r1.2 BasicMorpherFactory.java
--- org/apache/commons/morphos/factories/BasicMorpherFactory.java 29 Aug 2002 07:07:59 
-  1.2
+++ org/apache/commons/morphos/factories/BasicMorpherFactory.java 30 Dec 2002 23:45:43 
+-
@@ -64,7 +64,12 @@
 import org.apache.commons.morphos.Morpher;
 import org.apache.commons.morphos.MorpherFactory;
 import org.apache.commons.morphos.ObjectFlavor;
+import org.apache.commons.morphos.helpers.FlavorPair;
+
 import java.util.HashMap;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
 
 /**
  *
@@ -73,47 +78,107 @@
  * @version $Revision: 1.2 $ $Date: 2002/08/29 07:07:59 $
  */
 public class BasicMorpherFactory implements MorpherFactory {
- private HashMap knownMorphers;
-
- public BasicMorpherFactory(){
-  super();
-  knownMorphers=new HashMap();
-  // FIXME Make configurable
-  
knownMorphers.put(gnumeric2xls,org.apache.commons.morphos.morphers.poi.HSSFMorpher);
-  
knownMorphers.put(gnumeric2poi,org.apache.commons.morphos.morphers.poi.HSSFMorpher);
-  knownMorphers.put(xslt,org.apache.commons.morphos.morphers.xml.XSLTMorpher);
-  knownMorphers.put(poi2xls,org.apache.commons.morphos.morphers.poi.POIFSMorpher);
-  
knownMorphers.put(is2sax,org.apache.commons.morphos.morphers.dataform.InputSource2SAXMorpher);
-  
knownMorphers.put(stream2sax,org.apache.commons.morphos.morphers.dataform.Stream2SAXMorpher);
- }
-  
-public Morpher getMorpher(ObjectFlavor inputFlavor, ObjectFlavor outputFlavor){
- throw new UnsupportedOperationException(implement me :-));
-}
-
-public Morpher getMorpher(String name){
- Morpher morpher=null;
- String clazzName = (String)knownMorphers.get(name);
-
- if(clazzName!=null){
-  try{
-morpher = (Morpher)Class.forName(clazzName).newInstance();
-  } catch(Exception e){
-e.printStackTrace();
-  }
- }
- return morpher;
-}
-}
-
-
-
-
-
+private Map knownMorphers;
+private Map inputOutputMapping;
 
+public BasicMorpherFactory() {
+super();
+knownMorphers = new HashMap();
+inputOutputMapping = new HashMap();
+registerKnownMorphers();
+}
 
+/**
+ * @see MorpherFactory#getMorpher(ObjectFlavor,