[jboss-svn-commits] JBL Code SVN: r9374 - labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/importexport.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Feb 6 14:21:15 EST 2007
Author: tfennelly
Date: 2007-02-06 14:21:15 -0500 (Tue, 06 Feb 2007)
New Revision: 9374
Removed:
labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/importexport/ResourceImport.java
labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/importexport/ResourceLocation.java
Log:
removed
Deleted: labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/importexport/ResourceImport.java
===================================================================
--- labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/importexport/ResourceImport.java 2007-02-06 19:20:13 UTC (rev 9373)
+++ labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/importexport/ResourceImport.java 2007-02-06 19:21:15 UTC (rev 9374)
@@ -1,188 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * 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,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author JBoss Inc.
- */
-
-package org.jboss.soa.esb.admin.console.transform.importexport;
-
-import static org.jboss.seam.ScopeType.CONVERSATION;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hibernate.Session;
-import org.jboss.seam.annotations.Begin;
-import org.jboss.seam.annotations.End;
-import org.jboss.seam.annotations.In;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Out;
-import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.core.FacesMessages;
-import org.jboss.soa.esb.admin.console.UpdateNotifier;
-import org.jboss.soa.esb.admin.console.transform.NewResource;
-import org.jboss.soa.esb.admin.console.transform.SmooksResourceList;
-import org.jboss.soa.esb.admin.console.transform.SmooksUtils;
-import org.jboss.soa.esb.admin.console.transform.TransformationResource;
-import org.jboss.soa.esb.admin.console.transform.TransformationResourceParameter;
-import org.milyn.cdr.Parameter;
-import org.milyn.cdr.SmooksResourceConfiguration;
-import org.milyn.cdr.SmooksResourceConfigurationList;
-import org.milyn.cdr.UseragentExpression;
-import org.milyn.cdr.XMLConfigDigester;
-import org.xml.sax.SAXException;
-
-/**
- * Imports/Exports Smooks transformation resource condifurations.
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- */
- at Name("resourceImportExport")
- at Scope(CONVERSATION)
-public class ResourceImportExport implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @In(create=true)
- private Session esbDatabase;
-
- @In(create=true)
- private UpdateNotifier updateNotifier;
-
- private byte[] importData;
-
- @Out(required=false)
- private String exportData;
-
- @Begin(join=true)
- public String show() {
- importData = null;
- exportData = null;
-
- return "import-export-resources";
- }
-
- public void importResources() {
- if(importData != null) {
- try {
- loadConfigurations(new ByteArrayInputStream(importData));
- } catch (SAXException e) {
- FacesMessages.instance().add("Import Failed. Invalid Configuration: " + e.getMessage());
- return;
- } catch (IOException e) {
- FacesMessages.instance().add("Import Failed. Error Reading Configuration: " + e.getMessage());
- return;
- }
-
- updateNotifier.sendNotification();
- }
- }
-
- public void exportResources() {
- exportData = SmooksResourceList.getList(esbDatabase);
- }
-
- @End
- public String home() {
- return "home";
- }
-
- private void loadConfigurations(InputStream resStream) throws SAXException, IOException {
- SmooksResourceConfigurationList resList = XMLConfigDigester.digestConfig("import-list", resStream);
-
- for(int i = 0; i < resList.size(); i++) {
- TransformationResource transResource = toTransformationResource(resList.get(i));
-
- NewResource.persistNewResource(transResource, esbDatabase);
- }
- }
-
- private TransformationResource toTransformationResource(SmooksResourceConfiguration configuration) {
- TransformationResource resource = new TransformationResource();
-
- resource.setUseragent(getUseragentString(configuration.getUseragentExpressions()));
- resource.setSelector(configuration.getSelector());
- resource.setPath(configuration.getPath());
- resource.setNamespace(configuration.getNamespaceURI());
-
- List smooksParams = configuration.getParameters();
- resource.setParameters(new ArrayList<TransformationResourceParameter>());
- for(int i = 0; i < smooksParams.size(); i++) {
- Object listEntry = smooksParams.get(i);
- if(listEntry instanceof List) {
- List parameterGroup = (List)listEntry;
- for(int ii = 0; ii < parameterGroup.size(); ii++) {
- Parameter param = (Parameter)parameterGroup.get(ii);
- addParameter(resource, param);
- }
- } else if(listEntry instanceof Parameter) {
- Parameter param = (Parameter)listEntry;
- addParameter(resource, param);
- }
- }
-
- return resource;
- }
-
- private void addParameter(TransformationResource resource, Parameter param) {
- if(param.getName().equals(SmooksUtils.RESOURCE_NAME_PARAM)) {
- // This is not a "real" parameter. It's just how we get over the fact that the SmooksResourceConfiguration
- // class doesn't have "name" attribute like the TransformationResource class. So, we import and export
- // as a resource parameter.
- resource.setName(param.getValue());
- } else {
- TransformationResourceParameter parameter;
- parameter = new TransformationResourceParameter(param.getName(), param.getType(), param.getValue());
- parameter.setTransResource(resource);
- resource.getParameters().add(parameter);
- }
- }
-
-
- private String getUseragentString(UseragentExpression[] useragentExpressions) {
- StringBuffer string = new StringBuffer();
-
- for(int i = 0; i < useragentExpressions.length; i++) {
- string.append(useragentExpressions[i].getExpression());
- if(i < (useragentExpressions.length - 1)) {
- string.append(", ");
- }
- }
-
- return string.toString();
- }
-
- public byte[] getImportData() {
- return importData;
- }
-
- public void setImportData(byte[] importData) {
- this.importData = importData;
- }
-
- public String getExportData() {
- return exportData;
- }
-
- public void setExportData(String exportData) {
- this.exportData = exportData;
- }
-}
Deleted: labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/importexport/ResourceLocation.java
===================================================================
--- labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/importexport/ResourceLocation.java 2007-02-06 19:20:13 UTC (rev 9373)
+++ labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/importexport/ResourceLocation.java 2007-02-06 19:21:15 UTC (rev 9374)
@@ -1,49 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * 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,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author JBoss Inc.
- */
-
-package org.jboss.soa.esb.admin.console.transform.importexport;
-
-import org.jboss.seam.annotations.Name;
-
-/**
- * Resource Import location bean.
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- */
- at Name("resourceLocation")
-public class ResourceLocation {
-
- private String location;
-
- /**
- * @return Returns the location.
- */
- public String getLocation() {
- return location;
- }
-
- /**
- * @param location The location to set.
- */
- public void setLocation(String location) {
- this.location = location;
- }
-
-}
More information about the jboss-svn-commits
mailing list