[jboss-cvs] JBossAS SVN: r64998 - trunk/connector/src/main/org/jboss/resource/deployers/management.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Aug 31 18:41:58 EDT 2007


Author: scott.stark at jboss.org
Date: 2007-08-31 18:41:58 -0400 (Fri, 31 Aug 2007)
New Revision: 64998

Added:
   trunk/connector/src/main/org/jboss/resource/deployers/management/DsDataSourceTemplate.java
Log:
Start of the ds template

Added: trunk/connector/src/main/org/jboss/resource/deployers/management/DsDataSourceTemplate.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/deployers/management/DsDataSourceTemplate.java	                        (rev 0)
+++ trunk/connector/src/main/org/jboss/resource/deployers/management/DsDataSourceTemplate.java	2007-08-31 22:41:58 UTC (rev 64998)
@@ -0,0 +1,98 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.resource.deployers.management;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.net.URI;
+import java.util.Map;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+
+import org.jboss.deployers.spi.management.DeploymentTemplate;
+import org.jboss.deployers.spi.management.DeploymentTemplateInfo;
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.resource.metadata.mcf.ManagedConnectionFactoryDeploymentGroup;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * The connection factory template implementation.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class DsDataSourceTemplate
+   implements DeploymentTemplate
+{
+   private DeploymentTemplateInfo info;
+
+   public VirtualFile applyTemplate(VirtualFile root, String deploymentBaseName, DeploymentTemplateInfo values) throws Exception
+   {
+      String dsName = deploymentBaseName+"-ds.xml";
+      URI dsXmlURI = new URI(root.toURI()+dsName);
+      File dsXml = new File(dsXmlURI.getPath());
+      writeTemplate(dsXml, values);
+      VirtualFile dsXmlVF = root.findChild(dsName);
+      return dsXmlVF;
+   }
+
+   public DeploymentTemplateInfo getInfo()
+   {
+      return info;
+   }
+   public void setInfo(DeploymentTemplateInfo info)
+   {
+      this.info = info;
+   }
+
+   public void updateTemplateDeployment(VFSDeployment ctx, DeploymentTemplateInfo values)
+      throws Exception
+   {
+      // 
+   }
+
+   protected void writeTemplate(File dsXml, DeploymentTemplateInfo values)
+      throws Exception
+   {
+      FileWriter fw = new FileWriter(dsXml);
+
+      // Just get the first ManagedProperty to access the ManagedObject
+      Map<String, ManagedProperty> properties = values.getProperties();
+      ManagedProperty prop = properties.values().iterator().next();
+      ManagedObject mo = prop.getManagedObject();
+      Object group = mo.getAttachment();
+      if( group instanceof ManagedConnectionFactoryDeploymentGroup )
+      {
+         
+      }
+
+      Class[] classes = {ManagedConnectionFactoryDeploymentGroup.class};
+      JAXBContext context = JAXBContext.newInstance(classes);      
+      Marshaller marshaller = context.createMarshaller();
+      marshaller.marshal(group, fw);
+   }
+
+
+}


Property changes on: trunk/connector/src/main/org/jboss/resource/deployers/management/DsDataSourceTemplate.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native




More information about the jboss-cvs-commits mailing list