You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by lr...@apache.org on 2007/03/06 00:52:43 UTC
svn commit: r514928 - in
/incubator/tuscany/branches/sca-java-integration/sca/kernel:
api/src/main/java/org/apache/tuscany/api/
core/src/main/java/org/apache/tuscany/core/deployer/
core/src/main/java/org/apache/tuscany/core/implementation/java/ core/sr...
Author: lresende
Date: Mon Mar 5 15:52:42 2007
New Revision: 514928
URL: http://svn.apache.org/viewvc?view=rev&rev=514928
Log:
PMD & Checkstyle
Added:
incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/InvalidPojoComponentDefinitionlException.java
Modified:
incubator/tuscany/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/SCAContainer.java
incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java
incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentTypeLoader.java
incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ConversationProcessor.java
incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ResourceProcessor.java
incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/launcher/LauncherImpl.java
incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/AssemblyServiceImpl.java
incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/JavaContributionProcessor.java
incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/util/FileHelper.java
incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/util/IOHelper.java
Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/SCAContainer.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/SCAContainer.java?view=diff&rev=514928&r1=514927&r2=514928
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/SCAContainer.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/SCAContainer.java Mon Mar 5 15:52:42 2007
@@ -102,7 +102,7 @@
className = "org.apache.tuscany.core.bootstrap.DefaultSCAContainer";
}
Class cls = Class.forName(className, true, classLoader);
- return (SCAContainer)cls.newInstance();
+ return (SCAContainer)cls.newInstance(); // NOPMD lresende
} catch (Exception e) {
throw new IllegalStateException(e);
}
Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java?view=diff&rev=514928&r1=514927&r2=514928
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java Mon Mar 5 15:52:42 2007
@@ -52,8 +52,8 @@
* @version $Rev$ $Date$
*/
public class DeployerImpl implements Deployer {
- protected XMLInputFactory xmlFactory;
private Loader loader;
+ protected XMLInputFactory xmlFactory;
protected Builder builder;
protected ScopeContainerMonitor monitor;
Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentTypeLoader.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentTypeLoader.java?view=diff&rev=514928&r1=514927&r2=514928
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentTypeLoader.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentTypeLoader.java Mon Mar 5 15:52:42 2007
@@ -74,7 +74,8 @@
ServiceDefinition sideFileSD = (ServiceDefinition) o;
ServiceDefinition actualSD = (ServiceDefinition)it.next();
ServiceContract<?> newServiceContract = sideFileSD.getServiceContract();
- // TODO: TUSCANY-1111, runtime requires interfaceClass but currently there's no way of gen'ing that from WSDL
+ // TODO: TUSCANY-1111, runtime requires interfaceClass
+ // but currently there's no way of gen'ing that from WSDL
newServiceContract.setInterfaceClass(actualSD.getServiceContract().getInterfaceClass());
newServiceContract.setDataBinding(actualSD.getServiceContract().getDataBinding());
actualSD.setServiceContract(newServiceContract);
Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ConversationProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ConversationProcessor.java?view=diff&rev=514928&r1=514927&r2=514928
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ConversationProcessor.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ConversationProcessor.java Mon Mar 5 15:52:42 2007
@@ -58,7 +58,8 @@
type.setImplementationScope(org.apache.tuscany.spi.model.Scope.CONVERSATION);
} else if (scope != null && !"CONVERSATION".equals(scope.value().toUpperCase())) {
throw new InvalidConversationalImplementation(
- "Service is marked with @ConversationAttributes but the scope is not @Scope(\"CONVERSATION\")", clazz.getName());
+ "Service is marked with @ConversationAttributes but the scope is not @Scope(\"CONVERSATION\")",
+ clazz.getName());
} else if (conversation != null) {
long maxAge;
long maxIdleTime;
Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ResourceProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ResourceProcessor.java?view=diff&rev=514928&r1=514927&r2=514928
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ResourceProcessor.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ResourceProcessor.java Mon Mar 5 15:52:42 2007
@@ -49,7 +49,8 @@
PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
DeploymentContext context)
throws ProcessingException {
- org.apache.tuscany.api.annotation.Resource annotation = method.getAnnotation(org.apache.tuscany.api.annotation.Resource.class);
+ org.apache.tuscany.api.annotation.Resource annotation =
+ method.getAnnotation(org.apache.tuscany.api.annotation.Resource.class);
if (annotation == null) {
return;
}
@@ -80,7 +81,8 @@
PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
DeploymentContext context) throws ProcessingException {
- org.apache.tuscany.api.annotation.Resource annotation = field.getAnnotation(org.apache.tuscany.api.annotation.Resource.class);
+ org.apache.tuscany.api.annotation.Resource annotation =
+ field.getAnnotation(org.apache.tuscany.api.annotation.Resource.class);
if (annotation == null) {
return;
}
Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/launcher/LauncherImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/launcher/LauncherImpl.java?view=diff&rev=514928&r1=514927&r2=514928
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/launcher/LauncherImpl.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/launcher/LauncherImpl.java Mon Mar 5 15:52:42 2007
@@ -74,8 +74,8 @@
private CompositeComponent composite;
public CompositeContext bootApplication(URL applicationScdl, ClassLoader applicationClassLoader) {
- // TODO Auto-generated method stub
- return null;
+ // TODO Auto-generated method stub
+ return null;
}
public void bootRuntime(URL systemScdl, ClassLoader systemClassLoader, MonitorFactory monitor)
Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/AssemblyServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/AssemblyServiceImpl.java?view=diff&rev=514928&r1=514927&r2=514928
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/AssemblyServiceImpl.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/AssemblyServiceImpl.java Mon Mar 5 15:52:42 2007
@@ -43,9 +43,6 @@
import org.apache.tuscany.spi.deployer.ChangeSetHandlerRegistry;
import org.apache.tuscany.spi.deployer.Deployer;
import org.apache.tuscany.spi.model.ComponentDefinition;
-import org.apache.tuscany.spi.model.CompositeComponentType;
-import org.apache.tuscany.spi.model.Contribution;
-import org.apache.tuscany.spi.model.DeployedArtifact;
import org.osoa.sca.annotations.Constructor;
/**
@@ -64,11 +61,12 @@
this.domain = domain;
}
- public Object addCompositeToDomain(URI contribution, URI composite, String artifactName) throws DeploymentException {
+ public Object addCompositeToDomain(URI contribution, URI composite, String artifactName)
+ throws DeploymentException {
- Contribution contributionMetadata =
+ /*Contribution contributionMetadata =
(Contribution)this.contributionService.getContribution(contribution);
- /*DeployedArtifact scdlArtifact = contributionMetadata.getArtifacts().get(composite);
+ DeployedArtifact scdlArtifact = contributionMetadata.getArtifacts().get(composite);
ComponentDefinition model =
(ComponentDefinition)scdlArtifact.getModelObject(CompositeComponentType.class, null);*/
Added: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/InvalidPojoComponentDefinitionlException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/InvalidPojoComponentDefinitionlException.java?view=auto&rev=514928
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/InvalidPojoComponentDefinitionlException.java (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/InvalidPojoComponentDefinitionlException.java Mon Mar 5 15:52:42 2007
@@ -0,0 +1,36 @@
+/*
+ * 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.core.services.deployment.contribution;
+
+import org.apache.tuscany.host.deployment.DeploymentException;
+
+/**
+ * Exception that indicates that the supplied XML Document invalid.
+ *
+ */
+public class InvalidPojoComponentDefinitionlException extends DeploymentException {
+
+ protected InvalidPojoComponentDefinitionlException(String componentDefinitionLocatoin) {
+ super(componentDefinitionLocatoin);
+ }
+
+ protected InvalidPojoComponentDefinitionlException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/JavaContributionProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/JavaContributionProcessor.java?view=diff&rev=514928&r1=514927&r2=514928
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/JavaContributionProcessor.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/JavaContributionProcessor.java Mon Mar 5 15:52:42 2007
@@ -31,35 +31,43 @@
import org.apache.tuscany.spi.extension.ContributionProcessorExtension;
import org.apache.tuscany.spi.implementation.java.IntrospectionRegistry;
import org.apache.tuscany.spi.implementation.java.Introspector;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
import org.apache.tuscany.spi.model.Contribution;
import org.osoa.sca.annotations.Constructor;
public class JavaContributionProcessor extends ContributionProcessorExtension implements ContributionProcessor {
+ /**
+ * Content-type that this processor can handle
+ */
public static final String CONTENT_TYPE = "application/java-vm";
+ /**
+ * Pojo introspector
+ */
private Introspector introspector;
-
- @Override
- public String getContentType() {
- return CONTENT_TYPE;
- }
-
+
@Constructor("introspector")
public JavaContributionProcessor(@Autowire IntrospectionRegistry introspector) {
this.introspector = introspector;
}
+
+ @Override
+ public String getContentType() {
+ return CONTENT_TYPE;
+ }
private String getClazzName(URL clazzURL) {
String clazzName;
-
- clazzName = clazzURL.toExternalForm().substring(clazzURL.toExternalForm().lastIndexOf("!/") + 2,
- clazzURL.toExternalForm().length() - ".class".length());
+
+ clazzName =
+ clazzURL.toExternalForm().substring(clazzURL.toExternalForm().lastIndexOf("!/") + 2,
+ clazzURL.toExternalForm().length() - ".class".length());
clazzName = clazzName.replace("/", ".");
-
+
return clazzName;
}
-
- public void processContent(Contribution contribution, URI source, InputStream inputStream)
+ public void processContent(Contribution contribution, URI source, InputStream inputStream)
throws DeploymentException, IOException {
if (source == null) {
throw new IllegalArgumentException("Invalid null source uri.");
@@ -67,36 +75,33 @@
if (inputStream == null) {
throw new IllegalArgumentException("Invalid null source inputstream.");
- }
-
- // TODO Auto-generated method stub
-
+ }
+
try {
CompositeClassLoader cl = new CompositeClassLoader(getClass().getClassLoader());
cl.addURL(contribution.getLocation());
-
+
String clazzName = getClazzName(contribution.getArtifact(source).getLocation());
System.out.println(clazzName);
-
+
Class clazz = cl.loadClass(clazzName);
-
- //PojoComponentType javaInfo = introspector.introspect(null, clazz, null, null);
- } catch (ClassNotFoundException cnfe) {
- String msg = cnfe.getMessage();
-
- }
-// catch(ProcessingException pe){
-// String msg = pe.getMessage();
-
-
+ PojoComponentType javaInfo = introspector.introspect(null, clazz, null, null);
- }
+ contribution.getArtifact(source).addModelObject(PojoComponentType.class, null, javaInfo);
- public void processModel(Contribution contribution, URI source, Object modelObject)
- throws DeploymentException, IOException {
- // TODO Auto-generated method stub
+ } catch (ClassNotFoundException cnfe) {
+ throw new InvalidPojoComponentDefinitionlException(contribution.getArtifact(source).getLocation()
+ .toExternalForm(), cnfe);
+ } catch (ProcessingException pe) {
+ throw new InvalidPojoComponentDefinitionlException(contribution.getArtifact(source).getLocation()
+ .toExternalForm(), pe);
+ }
+ }
+ public void processModel(Contribution contribution, URI source, Object modelObject) throws DeploymentException,
+ IOException {
+ // NOOP
}
}
Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/util/FileHelper.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/util/FileHelper.java?view=diff&rev=514928&r1=514927&r2=514928
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/util/FileHelper.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/util/FileHelper.java Mon Mar 5 15:52:42 2007
@@ -280,7 +280,7 @@
} else {
String filename = url.getFile().replace('/', File.separatorChar);
int pos = 0;
- while ((pos = filename.indexOf('%', pos)) >= 0) {
+ while ((pos = filename.indexOf('%', pos)) >= 0) { // NOPMD
if (pos + 2 < filename.length()) {
String hexStr = filename.substring(pos + 1, pos + 3);
char ch = (char)Integer.parseInt(hexStr, 16);
Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/util/IOHelper.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/util/IOHelper.java?view=diff&rev=514928&r1=514927&r2=514928
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/util/IOHelper.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/util/IOHelper.java Mon Mar 5 15:52:42 2007
@@ -90,7 +90,7 @@
byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
int count = 0;
int n = 0;
- while (-1 != (n = input.read(buffer))) {
+ while (-1 != (n = input.read(buffer))) { // NOPMD
output.write(buffer, 0, n);
count += n;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org