Author: reinhard
Date: Mon Oct 4 06:03:28 2004
New Revision: 51883
Added:
cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/wiring/RealBlockWiring.java
cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/wiring/WiredRealBlockConnection.java
cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/wiring/WiredRealBlockDescriptor.java
cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/wiring/WiredRealBlockProperty.java
Modified:
cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/wiring/WiringBuilder.java
Log:
- work on XML mappings
- some refactoring
Added:
cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/wiring/RealBlockWiring.java
==============================================================================
--- (empty file)
+++
cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/wiring/RealBlockWiring.java
Mon Oct 4 06:03:28 2004
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed 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.cocoon.blockdeployer.wiring;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+/**
+ * @since 0.1
+ */
+public class RealBlockWiring implements Wiring {
+
+ private Collection blockDescriptors = new ArrayList();
+
+ // default constructor
+ public RealBlockWiring() {};
+
+ public Collection getBlockDescriptors() {
+ return this.blockDescriptors;
+ }
+
+}
Added:
cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/wiring/WiredRealBlockConnection.java
==============================================================================
--- (empty file)
+++
cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/wiring/WiredRealBlockConnection.java
Mon Oct 4 06:03:28 2004
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed 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.cocoon.blockdeployer.wiring;
+
+/**
+ * @since 03.10.2004
+ */
+public class WiredRealBlockConnection implements WiredBlockConnection {
+
+ private String name;
+ private String connectedBlockId;
+
+
+ public String getConnectedBlockId() {
+ return connectedBlockId;
+ }
+ public void setConnectedBlockId(String connectedBlockId) {
+ this.connectedBlockId = connectedBlockId;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+}
Added:
cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/wiring/WiredRealBlockDescriptor.java
==============================================================================
--- (empty file)
+++
cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/wiring/WiredRealBlockDescriptor.java
Mon Oct 4 06:03:28 2004
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed 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.cocoon.blockdeployer.wiring;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+/**
+ * @since 0.1
+ */
+public class WiredRealBlockDescriptor implements WiredBlockDescriptor {
+
+ private String id;
+ private String location;
+ private String mountPath;
+ private Collection properties = new ArrayList();
+ private Collection connections = new ArrayList();
+
+ // default constructor
+ public WiredRealBlockDescriptor() {};
+
+ public String getLocation() {
+ return location;
+ }
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ public String getId() {
+ return id;
+ }
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public Collection getConnections() {
+ return connections;
+ }
+ public void setConnections(Collection connections) {
+ this.connections = connections;
+ }
+
+ public String getMountPath() {
+ return mountPath;
+ }
+ public void setMountPath(String mountPath) {
+ this.mountPath = mountPath;
+ }
+
+ public Collection getProperties() {
+ return properties;
+ }
+ public void setProperties(Collection properties) {
+ this.properties = properties;
+ }
+}
Added:
cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/wiring/WiredRealBlockProperty.java
==============================================================================
--- (empty file)
+++
cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/wiring/WiredRealBlockProperty.java
Mon Oct 4 06:03:28 2004
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed 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.cocoon.blockdeployer.wiring;
+
+/**
+ * @since 03.10.2004
+ */
+public class WiredRealBlockProperty implements WiredBlockProperty {
+
+ private String name;
+ private String value;
+
+
+ public String getValue() {
+ return value;
+ }
+ public void setValue(String value) {
+ this.value = value;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+}
Modified:
cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/wiring/WiringBuilder.java
==============================================================================
---
cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/wiring/WiringBuilder.java
(original)
+++
cocoon/whiteboard/block-deployer/src/impl/org/apache/cocoon/blockdeployer/wiring/WiringBuilder.java
Mon Oct 4 06:03:28 2004
@@ -15,10 +15,34 @@
*/
package org.apache.cocoon.blockdeployer.wiring;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+import org.exolab.castor.mapping.Mapping;
+import org.exolab.castor.xml.Unmarshaller;
+
/**
- * @author Cocoon Community
* @since 0.1
*/
public class WiringBuilder {
+
+ public static Wiring build(File descriptorFile) throws Exception {
+ Mapping mapping = new Mapping();
+ // FIXME read the mapping by using the classloader
+ mapping.loadMapping("mapping/wiring.xml-mapping.xml");
+
+ Unmarshaller unmarshaller = new Unmarshaller(RealBlockWiring.class);
+ unmarshaller.setMapping(mapping);
+ unmarshaller.setIgnoreExtraAttributes(true);
+ unmarshaller.setIgnoreExtraElements(true);
+ unmarshaller.setDebug(true);
+
+ InputStream is = new FileInputStream(descriptorFile);
+
+ RealBlockWiring realblockWiring =
(RealBlockWiring)unmarshaller.unmarshal(new InputStreamReader(is));
+ return realblockWiring;
+ }
}