From b7e45fbc41d9ad16b0f851a1783170099509af00 Mon Sep 17 00:00:00 2001 From: lresende Date: Fri, 13 Nov 2009 01:22:41 +0000 Subject: Removing obsolete release candidate tags git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835689 13f79535-47bb-0310-9956-ffa450edef68 --- .../extension/helper/utils/AbstractBinding.java | 72 ------- .../helper/utils/AbstractImplementation.java | 153 -------------- .../utils/AbstractStAXArtifactProcessor.java | 132 ------------ .../utils/DefaultPropertyValueObjectFactory.java | 231 --------------------- .../helper/utils/DynamicImplementation.java | 96 --------- .../helper/utils/PropertyValueObjectFactory.java | 33 --- .../sca/extension/helper/utils/ResourceHelper.java | 70 ------- 7 files changed, 787 deletions(-) delete mode 100644 sca-java-1.x/tags/1.5-RC0/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/AbstractBinding.java delete mode 100644 sca-java-1.x/tags/1.5-RC0/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/AbstractImplementation.java delete mode 100644 sca-java-1.x/tags/1.5-RC0/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/AbstractStAXArtifactProcessor.java delete mode 100644 sca-java-1.x/tags/1.5-RC0/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/DefaultPropertyValueObjectFactory.java delete mode 100644 sca-java-1.x/tags/1.5-RC0/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/DynamicImplementation.java delete mode 100644 sca-java-1.x/tags/1.5-RC0/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/PropertyValueObjectFactory.java delete mode 100644 sca-java-1.x/tags/1.5-RC0/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/ResourceHelper.java (limited to 'sca-java-1.x/tags/1.5-RC0/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils') diff --git a/sca-java-1.x/tags/1.5-RC0/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/AbstractBinding.java b/sca-java-1.x/tags/1.5-RC0/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/AbstractBinding.java deleted file mode 100644 index 112fb09f2a..0000000000 --- a/sca-java-1.x/tags/1.5-RC0/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/AbstractBinding.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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.sca.extension.helper.utils; - -import java.util.List; - -import org.apache.tuscany.sca.assembly.Binding; - -/** - * Helper for implementing Bindings, implements all the - * standard getters and setters on the binding interface. - * - * @version $Rev$ $Date$ - */ -public class AbstractBinding implements Binding { - - private String name; - private String uri; - private List extensions; - private boolean unresolved; - - public String getName() { - return name; - } - - public String getURI() { - return uri; - } - - public void setName(String name) { - this.name = name; - } - - public void setURI(String uri) { - this.uri = uri; - } - - public List getExtensions() { - return extensions; - } - - public boolean isUnresolved() { - return unresolved; - } - - public void setUnresolved(boolean unresolved) { - this.unresolved = unresolved; - } - - @Override - public Object clone() throws CloneNotSupportedException { - return super.clone(); - } - -} diff --git a/sca-java-1.x/tags/1.5-RC0/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/AbstractImplementation.java b/sca-java-1.x/tags/1.5-RC0/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/AbstractImplementation.java deleted file mode 100644 index 0e658cfd1e..0000000000 --- a/sca-java-1.x/tags/1.5-RC0/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/AbstractImplementation.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * 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.sca.extension.helper.utils; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.sca.assembly.ConfiguredOperation; -import org.apache.tuscany.sca.assembly.ConstrainingType; -import org.apache.tuscany.sca.assembly.Implementation; -import org.apache.tuscany.sca.assembly.Property; -import org.apache.tuscany.sca.assembly.Reference; -import org.apache.tuscany.sca.assembly.Service; -import org.apache.tuscany.sca.policy.Intent; -import org.apache.tuscany.sca.policy.IntentAttachPointType; -import org.apache.tuscany.sca.policy.PolicySet; - -/** - * Helper for implementing Implementations, implements all the - * standard getters and setters on the Implementation interface. - * - * @version $Rev$ $Date$ - */ -public abstract class AbstractImplementation implements Implementation { - - private List services = new ArrayList(); - private List references = new ArrayList(); - private List properties = new ArrayList(); - private ConstrainingType constrainingType; - private String uri; - private boolean unresolved = true; - private List configuredOperations = new ArrayList(); - private List applicablePolicySets = new ArrayList(); - private List policySets = new ArrayList(); - private List requiredIntents = new ArrayList(); - private IntentAttachPointType type = null; - - public AbstractImplementation() { - } - - public List getProperties() { - return properties; - } - - public List getReferences() { - return references; - } - - public List getServices() { - return services; - } - - public String getURI() { - return uri; - } - - public void setURI(String uri) { - this.uri = uri; - } - - public ConstrainingType getConstrainingType() { - return constrainingType; - } - - public void setConstrainingType(ConstrainingType constrainingType) { - this.constrainingType = constrainingType; - } - - public List getExtensions() { - // TODO what is this for? - return null; - } - - public boolean isUnresolved() { - return unresolved; - } - - public void setUnresolved(boolean unresolved) { - this.unresolved = unresolved; - } - - public Service getService(String name) { - for (Service service : getServices()) { - if (service.getName().equals(name)) { - return service; - } - } - return null; - } - - public Reference getReference(String name) { - for (Reference reference : getReferences()) { - if (reference.getName().equals(name)) { - return reference; - } - } - return null; - } - - public Property getProptery(String name) { - for (Property property : getProperties()) { - if (property.getName().equals(name)) { - return property; - } - } - return null; - } - - public List getConfiguredOperations() { - return configuredOperations; - } - - // public void setConfiguredOperations(List configuredOperations) { - // this.configuredOperations = configuredOperations; - // } - - public List getApplicablePolicySets() { - return applicablePolicySets; - } - - public List getPolicySets() { - return policySets; - } - - public List getRequiredIntents() { - return requiredIntents; - } - - public IntentAttachPointType getType() { - return type; - } - - public void setType(IntentAttachPointType type) { - this.type = type; - } -} diff --git a/sca-java-1.x/tags/1.5-RC0/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/AbstractStAXArtifactProcessor.java b/sca-java-1.x/tags/1.5-RC0/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/AbstractStAXArtifactProcessor.java deleted file mode 100644 index 9a521b5b79..0000000000 --- a/sca-java-1.x/tags/1.5-RC0/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/AbstractStAXArtifactProcessor.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * 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.sca.extension.helper.utils; - -import java.lang.reflect.Method; - -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.assembly.ComponentType; -import org.apache.tuscany.sca.assembly.Implementation; -import org.apache.tuscany.sca.assembly.Property; -import org.apache.tuscany.sca.assembly.Reference; -import org.apache.tuscany.sca.assembly.Service; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.resolver.ModelResolver; -import org.apache.tuscany.sca.contribution.service.ContributionResolveException; -import org.apache.tuscany.sca.interfacedef.Interface; -import org.apache.tuscany.sca.interfacedef.InterfaceContract; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractImpl; -import org.apache.tuscany.sca.interfacedef.impl.InterfaceImpl; -import org.apache.tuscany.sca.interfacedef.impl.OperationImpl; - -/** - * TODO: couldn't something like this class be provided by the runtime? - * Each impl shouldn't have to have their own .componentType merging code - * - * @version $Rev$ $Date$ - */ -public abstract class AbstractStAXArtifactProcessor implements StAXArtifactProcessor { - - protected AssemblyFactory assemblyFactory; - - public AbstractStAXArtifactProcessor(AssemblyFactory assemblyFactory) { - this.assemblyFactory = assemblyFactory; - } - - public void resolve(I model, ModelResolver resolver) throws ContributionResolveException { - - addSideFileComponentType(model.getURI(), model, resolver); - - if (model instanceof DynamicImplementation) { - // if no services have been defined then add a dynamic one - if (model.getServices().size() < 1) { - Service dynamicService = createDynamicService(); - model.getServices().add(dynamicService); - } - } - - // Allow implementation classes to resolve themselves - try { - Method resolveMethod; - if ((resolveMethod = model.getClass().getMethod("resolve", ModelResolver.class)) != null) { - resolveMethod.invoke(model, resolver); - } - } catch (Exception e) { - } - - model.setUnresolved(false); - } - - protected void addSideFileComponentType(String name, Implementation impl, ModelResolver resolver) { - if (name == null) { - return; - } - int lastDot = name.lastIndexOf('.'); - if (lastDot < 0) { - return; - } - String sideFileName = name.substring(0, lastDot) + ".componentType"; - - ComponentType componentType = assemblyFactory.createComponentType(); - componentType.setURI(sideFileName); - componentType.setUnresolved(true); - - componentType = resolver.resolveModel(ComponentType.class, componentType); - - if (!componentType.isUnresolved()) { - for (Reference reference : componentType.getReferences()) { - impl.getReferences().add(reference); - } - for (Service service : componentType.getServices()) { - impl.getServices().add(service); - } - for (Property property : componentType.getProperties()) { - impl.getProperties().add(property); - } - if (componentType.getConstrainingType() != null) { - impl.setConstrainingType(componentType.getConstrainingType()); - } - } - } - - protected Service createDynamicService() { - Service dynamicService = assemblyFactory.createService(); - dynamicService.setName("$dynamic$"); - InterfaceContract dynamicInterfaceContract = new InterfaceContractImpl() {}; - Interface dynamicInterface = new DynamicInterfaceImpl(); - Operation dynamicOperation = new OperationImpl(); - dynamicOperation.setDynamic(true); - dynamicInterface.getOperations().add(dynamicOperation); - dynamicInterfaceContract.setInterface(dynamicInterface); - dynamicService.setInterfaceContract(dynamicInterfaceContract); - - return dynamicService; - } - - private static class DynamicInterfaceImpl extends InterfaceImpl { - @Override - public boolean isDynamic() { - return true; - } - - } - -} \ No newline at end of file diff --git a/sca-java-1.x/tags/1.5-RC0/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/DefaultPropertyValueObjectFactory.java b/sca-java-1.x/tags/1.5-RC0/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/DefaultPropertyValueObjectFactory.java deleted file mode 100644 index 550498d7b1..0000000000 --- a/sca-java-1.x/tags/1.5-RC0/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/DefaultPropertyValueObjectFactory.java +++ /dev/null @@ -1,231 +0,0 @@ -/* - * 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.sca.extension.helper.utils; - -import java.util.ArrayList; -import java.util.List; -import java.util.StringTokenizer; - -import org.apache.tuscany.sca.assembly.Property; -import org.apache.tuscany.sca.core.factory.ObjectCreationException; -import org.apache.tuscany.sca.core.factory.ObjectFactory; -import org.apache.tuscany.sca.databinding.Mediator; -import org.apache.tuscany.sca.databinding.SimpleTypeMapper; -import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl; -import org.apache.tuscany.sca.interfacedef.DataType; -import org.apache.tuscany.sca.interfacedef.util.XMLType; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -/** - * TODO: Shouldn't this class be provided by the runtime? - * - * @version $Rev$ $Date$ - */ -public class DefaultPropertyValueObjectFactory implements PropertyValueObjectFactory { - // protected DataBindingRegistry dbRegistry = new DataBindingRegistryImpl(); - protected Mediator mediator = null; - protected SimpleTypeMapper simpleTypeMapper = new SimpleTypeMapperImpl(); - boolean isSimpleType; - - public DefaultPropertyValueObjectFactory(Mediator mediator) { - this.mediator = mediator; - } - - /* (non-Javadoc) - * @see org.apache.tuscany.sca.extension.helper.utils.PVOF#createValueFactory(org.apache.tuscany.sca.assembly.Property) - */ - public ObjectFactory createValueFactory(Property property) { - isSimpleType = isSimpleType(property); - Document doc = (Document)property.getValue(); - Element rootElement = doc.getDocumentElement(); - - //FIXME : since scripts use dynamic types we need to generate a dynamic java type using the - //XML structure of the property value. Should this be done in the JavaBeansDataBinding... - Class javaType = null; - - if (property.isMany()) { - if (isSimpleType) { - String value = ""; - if (rootElement.getChildNodes().getLength() > 0) { - value = rootElement.getChildNodes().item(0).getTextContent(); - } - List values = - getSimplePropertyValues(value, javaType); - return new ListObjectFactoryImpl(property, - values, - isSimpleType, - javaType); - } else { - return new ListObjectFactoryImpl(property, - getComplexPropertyValues(doc), - isSimpleType, - javaType); - } - } else { - if (isSimpleType) { - String value = ""; - if (rootElement.getChildNodes().getLength() > 0) { - value = rootElement.getChildNodes().item(0).getTextContent(); - } - return new ObjectFactoryImpl(property, - value, - isSimpleType, - javaType); - } else { - Object value = getComplexPropertyValues(doc).get(0); - return new ObjectFactoryImpl(property, - value, - isSimpleType, - javaType); - } - - } - } - - private boolean isSimpleType(Property property) { - if (property.getXSDType() != null) { - return SimpleTypeMapperImpl.isSimpleXSDType(property.getXSDType()); - } else { - if (property instanceof Document) { - Document doc = (Document)property; - Element element = doc.getDocumentElement(); - if (element.getChildNodes().getLength() == 1 && - element.getChildNodes().item(0).getNodeType() == Node.TEXT_NODE) { - return true; - } - } - } - return false; - } - - private List getSimplePropertyValues(String concatenatedValue, Class javaType) { - List propValues = new ArrayList(); - StringTokenizer st = null; - if ( javaType.getName().equals("java.lang.String")) { - st = new StringTokenizer(concatenatedValue, "\""); - } else { - st = new StringTokenizer(concatenatedValue); - } - String aToken = null; - while (st.hasMoreTokens()) { - aToken = st.nextToken(); - if (aToken.trim().length() > 0) { - propValues.add(aToken); - } - } - return propValues; - } - - private List getComplexPropertyValues(Document document) { - Element rootElement = document.getDocumentElement(); - List propValues = new ArrayList(); - for (int count = 0 ; count < rootElement.getChildNodes().getLength() ; ++count) { - if (rootElement.getChildNodes().item(count).getNodeType() == Node.ELEMENT_NODE) { - propValues.add(rootElement.getChildNodes().item(count)); - } - } - return propValues; - } - - public abstract class ObjectFactoryImplBase implements ObjectFactory { - protected SimpleTypeMapper simpleTypeMapper = new SimpleTypeMapperImpl(); - protected Property property; - protected Object propertyValue; - protected Class javaType; - protected DataType sourceDataType; - protected DataType targetDataType; - boolean isSimpleType; - - public ObjectFactoryImplBase(Property property, Object propertyValue, boolean isSimpleType, Class javaType) { - - this.isSimpleType = isSimpleType; - this.property = property; - this.propertyValue = propertyValue; - this.javaType = javaType; - //FIXME : fix this when we have managed to generate dynamic java types - /*sourceDataType = - new DataTypeImpl(DOMDataBinding.NAME, Node.class, - new XMLType(null, this.property.getXSDType())); - TypeInfo typeInfo = null; - if (this.property.getXSDType() != null) { - if (SimpleTypeMapperExtension.isSimpleXSDType(this.property.getXSDType())) { - typeInfo = new TypeInfo(property.getXSDType(), true, null); - } else { - typeInfo = new TypeInfo(property.getXSDType(), false, null); - } - } else { - typeInfo = new TypeInfo(property.getXSDType(), false, null); - } - - XMLType xmlType = new XMLType(typeInfo); - String dataBinding = null; //(String)property.getExtensions().get(DataBinding.class.getName()); - if (dataBinding != null) { - targetDataType = new DataTypeImpl(dataBinding, javaType, xmlType); - } else { - targetDataType = new DataTypeImpl(dataBinding, javaType, xmlType); - mediator.getDataBindingRegistry().introspectType(targetDataType, null); - }*/ - } - } - - public class ObjectFactoryImpl extends ObjectFactoryImplBase { - public ObjectFactoryImpl(Property property, Object propertyValue, boolean isSimpleType, Class javaType) { - super(property, propertyValue, isSimpleType, javaType); - } - - @SuppressWarnings("unchecked") - public Object getInstance() throws ObjectCreationException { - if (isSimpleType) { - return simpleTypeMapper.toJavaObject(property.getXSDType(), (String)propertyValue, null); - } else { - return mediator.mediate(propertyValue, sourceDataType, targetDataType, null); - //return null; - } - } - } - - public class ListObjectFactoryImpl extends ObjectFactoryImplBase { - public ListObjectFactoryImpl(Property property, ListpropertyValues, boolean isSimpleType, Class javaType) { - super(property, propertyValues, isSimpleType, javaType); - } - - @SuppressWarnings("unchecked") - public List getInstance() throws ObjectCreationException { - if (isSimpleType) { - List values = new ArrayList(); - for (String aValue : (List)propertyValue) { - values.add(simpleTypeMapper.toJavaObject(property.getXSDType(), aValue, null)); - } - return values; - } else { - List instances = new ArrayList(); - for (Node aValue : (List)propertyValue) { - instances.add(mediator.mediate(aValue, - sourceDataType, - targetDataType, - null)); - } - return instances; - } - } - } -} - \ No newline at end of file diff --git a/sca-java-1.x/tags/1.5-RC0/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/DynamicImplementation.java b/sca-java-1.x/tags/1.5-RC0/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/DynamicImplementation.java deleted file mode 100644 index dbfb9d089f..0000000000 --- a/sca-java-1.x/tags/1.5-RC0/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/DynamicImplementation.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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.sca.extension.helper.utils; - -import org.apache.tuscany.sca.assembly.Component; -import org.apache.tuscany.sca.assembly.Property; -import org.apache.tuscany.sca.assembly.Reference; -import org.apache.tuscany.sca.assembly.Service; -import org.apache.tuscany.sca.assembly.builder.ComponentPreProcessor; -import org.apache.tuscany.sca.runtime.RuntimeComponent; - -/** - * - * @version $Rev$ $Date$ - */ -public class DynamicImplementation extends AbstractImplementation implements ComponentPreProcessor { - - public void preProcess(Component component) { - RuntimeComponent rtc = (RuntimeComponent) component; - - for (Service service : rtc.getServices()) { - if (getService(service.getName()) == null) { - getServices().add(createService(service)); - } - } - - Service dynamicService = getService("$dynamic$"); - if (dynamicService != null && getServices().size() > 1) { - getServices().remove(dynamicService); - dynamicService = null; - } - - for (Reference reference : rtc.getReferences()) { - if (getReference(reference.getName()) == null) { - getReferences().add(createReference(reference)); - } - } - - for (Property property : rtc.getProperties()) { - if (getProptery(property.getName()) == null) { - getProperties().add(createProperty(property)); - } - } - - // TODO: support properties - } - - protected Service createService(Service service) { - Service newService; - try { - newService = (Service)service.clone(); - } catch (CloneNotSupportedException e) { - throw new AssertionError(e); // should not ever happen - } - - return newService; - } - - protected Reference createReference(Reference reference) { - Reference newReference; - try { - newReference = (Reference)reference.clone(); - } catch (CloneNotSupportedException e) { - throw new AssertionError(e); // should not ever happen - } - return newReference; - } - - protected Property createProperty(Property property) { - Property newProperty; - try { - newProperty = (Property)property.clone(); - } catch (CloneNotSupportedException e) { - throw new AssertionError(e); // should not ever happen - } - return newProperty; - } - -} diff --git a/sca-java-1.x/tags/1.5-RC0/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/PropertyValueObjectFactory.java b/sca-java-1.x/tags/1.5-RC0/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/PropertyValueObjectFactory.java deleted file mode 100644 index f209825679..0000000000 --- a/sca-java-1.x/tags/1.5-RC0/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/PropertyValueObjectFactory.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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.sca.extension.helper.utils; - -import org.apache.tuscany.sca.assembly.Property; -import org.apache.tuscany.sca.core.factory.ObjectFactory; - -/** - * - * @version $Rev$ $Date$ - */ -public interface PropertyValueObjectFactory { - - ObjectFactory createValueFactory(Property property); - -} diff --git a/sca-java-1.x/tags/1.5-RC0/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/ResourceHelper.java b/sca-java-1.x/tags/1.5-RC0/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/ResourceHelper.java deleted file mode 100644 index 4e7965ce60..0000000000 --- a/sca-java-1.x/tags/1.5-RC0/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/ResourceHelper.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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.sca.extension.helper.utils; - -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; -import java.net.URL; -import java.net.URLConnection; - -/** - * TODO: Shouldn't this be using the contribution service? - * - * @version $Rev$ $Date$ - */ -public class ResourceHelper { - - public static String readResource(URL scriptSrcUrl) { - - InputStream is; - try { - URLConnection connection = scriptSrcUrl.openConnection(); - connection.setUseCaches(false); - is = connection.getInputStream(); - } catch (IOException e) { - throw new RuntimeException(e); - } - - try { - - Reader reader = new InputStreamReader(is, "UTF-8"); - char[] buffer = new char[1024]; - StringBuilder source = new StringBuilder(); - int count; - while ((count = reader.read(buffer)) > 0) { - source.append(buffer, 0, count); - } - - return source.toString(); - - } catch (IOException e) { - throw new RuntimeException(e); - } finally { - try { - is.close(); - } catch (IOException e) { - // ignore - } - } - } - -} -- cgit v1.2.3