You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by me...@apache.org on 2007/01/31 08:32:03 UTC

svn commit: r501755 - in /incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/storer: ./ Storer.java StorerException.java StorerRegistry.java

Author: meerajk
Date: Tue Jan 30 23:32:02 2007
New Revision: 501755

URL: http://svn.apache.org/viewvc?view=rev&rev=501755
Log:
First cut of the storer f/w.

Added:
    incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/storer/
    incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/storer/Storer.java   (with props)
    incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/storer/StorerException.java   (with props)
    incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/storer/StorerRegistry.java   (with props)

Added: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/storer/Storer.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/storer/Storer.java?view=auto&rev=501755
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/storer/Storer.java (added)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/storer/Storer.java Tue Jan 30 23:32:02 2007
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package org.apache.tuscany.spi.storer;
+
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.spi.model.ModelObject;
+
+/**
+ * Interface for serialzing model objects to corresponding XML infoset.
+ * 
+ * @version $Rev$ $Date$
+ *
+ */
+public interface Storer<MD extends ModelObject> {
+    
+    /**
+     * Serailizes the model object.
+     * 
+     * @param modelObject Model object to be stored.
+     * @param writer STaX writer to which the model is written.
+     * @throws StorerException Thrown in case of any storer error.
+     */
+    void store(MD modelObject, XMLStreamWriter writer) throws StorerException;
+
+}

Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/storer/Storer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/storer/Storer.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/storer/StorerException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/storer/StorerException.java?view=auto&rev=501755
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/storer/StorerException.java (added)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/storer/StorerException.java Tue Jan 30 23:32:02 2007
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package org.apache.tuscany.spi.storer;
+
+import org.apache.tuscany.api.TuscanyException;
+
+/**
+ * Base class for all storer exceptions.
+ *
+ * @version $Rev$ $Date$
+ */
+@SuppressWarnings("serial")
+public class StorerException extends TuscanyException {
+
+    /**
+     * Initializes the error message.
+     * @param message Error message.
+     */
+    public StorerException(String message) {
+        super(message);
+    }
+
+    /**
+     * Initializes the root cause.
+     * @param cause Root cause for the exception.
+     */
+    public StorerException(Throwable cause) {
+        super(cause);
+    }
+    
+}

Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/storer/StorerException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/storer/StorerException.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/storer/StorerRegistry.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/storer/StorerRegistry.java?view=auto&rev=501755
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/storer/StorerRegistry.java (added)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/storer/StorerRegistry.java Tue Jan 30 23:32:02 2007
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package org.apache.tuscany.spi.storer;
+
+import org.apache.tuscany.spi.model.ModelObject;
+
+/**
+ * A registry for storers against model object types.
+ * 
+ * @version $Rev$ $Date$
+ *
+ */
+public interface StorerRegistry extends Storer {
+    
+    /**
+     * Registers a model object storer for a given type.
+     * @param <T> Model object type.
+     * @param modelObjectType Class of the model object type.
+     * @param storer Storer for the model object type.
+     */
+    <T extends ModelObject> void register(Class<T> modelObjectType, Storer<T> storer);
+    
+    /**
+     * Unregisters a model object storer for a given type.
+     * @param <T> Model object type.
+     * @param modelObjectType Class of the model object type.
+     * @throws If no storer found for the specified type.
+     */
+    <T extends ModelObject> void unRegister(Class<T> modelObjectType) throws StorerException;
+
+}

Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/storer/StorerRegistry.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/storer/StorerRegistry.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org