diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-11 23:14:18 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-11 23:14:18 +0000 |
commit | fdd5b43d3c139cf2cbd1655d2efbfaf9032a5b5e (patch) | |
tree | bcd16e19fa4bbd45f956812be8b65f7a143b573f /branches/sca-java-1.5.1/itest/contribution-jee/src/main/java | |
parent | 3caf8614f25d6b1962e20331fdf423c863bc02f3 (diff) |
Moving 1.x branches
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835145 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.5.1/itest/contribution-jee/src/main/java')
3 files changed, 0 insertions, 236 deletions
diff --git a/branches/sca-java-1.5.1/itest/contribution-jee/src/main/java/org/apache/tuscany/sca/test/contribution/jee/TestEJBImplementationProvider.java b/branches/sca-java-1.5.1/itest/contribution-jee/src/main/java/org/apache/tuscany/sca/test/contribution/jee/TestEJBImplementationProvider.java deleted file mode 100644 index e7e1d90797..0000000000 --- a/branches/sca-java-1.5.1/itest/contribution-jee/src/main/java/org/apache/tuscany/sca/test/contribution/jee/TestEJBImplementationProvider.java +++ /dev/null @@ -1,48 +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.test.contribution.jee; - -import org.apache.tuscany.sca.implementation.ejb.EJBImplementation; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.provider.ImplementationProvider; -import org.apache.tuscany.sca.runtime.RuntimeComponent; -import org.apache.tuscany.sca.runtime.RuntimeComponentService; - - -class TestEJBImplementationProvider implements ImplementationProvider { - - TestEJBImplementationProvider(RuntimeComponent component, EJBImplementation ejbImplementation) { - } - - public Invoker createInvoker(RuntimeComponentService service, Operation operation) { - return null; - } - - public boolean supportsOneWayInvocation() { - return false; - } - - public void start() { - } - - public void stop() { - } - -} diff --git a/branches/sca-java-1.5.1/itest/contribution-jee/src/main/java/org/apache/tuscany/sca/test/contribution/jee/TestEJBImplementationProviderFactory.java b/branches/sca-java-1.5.1/itest/contribution-jee/src/main/java/org/apache/tuscany/sca/test/contribution/jee/TestEJBImplementationProviderFactory.java deleted file mode 100644 index 4660fee7fd..0000000000 --- a/branches/sca-java-1.5.1/itest/contribution-jee/src/main/java/org/apache/tuscany/sca/test/contribution/jee/TestEJBImplementationProviderFactory.java +++ /dev/null @@ -1,47 +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.test.contribution.jee; - -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.implementation.ejb.EJBImplementation; -import org.apache.tuscany.sca.provider.ImplementationProvider; -import org.apache.tuscany.sca.provider.ImplementationProviderFactory; -import org.apache.tuscany.sca.runtime.RuntimeComponent; - -/** - * A factory for resource implementation providers. - * - * @version $Rev$ $Date$ - */ -public class TestEJBImplementationProviderFactory implements ImplementationProviderFactory<EJBImplementation> { - - /** - * Constructs a resource implementation. - */ - public TestEJBImplementationProviderFactory(ExtensionPointRegistry extensionPoints) { - } - - public ImplementationProvider createImplementationProvider(RuntimeComponent component, EJBImplementation implementation) { - return new TestEJBImplementationProvider(component, implementation); - } - - public Class<EJBImplementation> getModelType() { - return EJBImplementation.class; - } -} diff --git a/branches/sca-java-1.5.1/itest/contribution-jee/src/main/java/org/apache/tuscany/sca/test/contribution/jee/TestExternalEarModelResolver.java b/branches/sca-java-1.5.1/itest/contribution-jee/src/main/java/org/apache/tuscany/sca/test/contribution/jee/TestExternalEarModelResolver.java deleted file mode 100644 index 34bf3702d3..0000000000 --- a/branches/sca-java-1.5.1/itest/contribution-jee/src/main/java/org/apache/tuscany/sca/test/contribution/jee/TestExternalEarModelResolver.java +++ /dev/null @@ -1,141 +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.test.contribution.jee; - -import java.io.File; -import java.net.URI; -import java.net.URL; -import java.util.HashMap; -import java.util.Map; - -import org.apache.tuscany.sca.assembly.Composite; -import org.apache.tuscany.sca.contribution.Artifact; -import org.apache.tuscany.sca.contribution.Contribution; -import org.apache.tuscany.sca.contribution.jee.ExternalEarInfo; -import org.apache.tuscany.sca.contribution.jee.JavaEEApplicationInfo; -import org.apache.tuscany.sca.contribution.jee.JavaEEIntrospector; -import org.apache.tuscany.sca.contribution.resolver.ModelResolver; -import org.apache.tuscany.sca.contribution.service.ContributionService; -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.core.UtilityExtensionPoint; -import org.apache.tuscany.sca.host.embedded.SCADomain; -import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain; - -public class TestExternalEarModelResolver implements ModelResolver { - - private Map<URI, ExternalEarInfo> map = new HashMap<URI, ExternalEarInfo>(); - private JavaEEIntrospector jeeIntrospector; - private ContributionService contributionService; - - - public TestExternalEarModelResolver(Contribution contribution, ExtensionPointRegistry extensionPoints) { - jeeIntrospector = extensionPoints.getExtensionPoint(JavaEEIntrospector.class); - UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class); - contributionService = utilities.getUtility(ContributionService.class); - - } - - public void addModel(Object resolved) { - ExternalEarInfo jeeApp = (ExternalEarInfo)resolved; - map.put(jeeApp.getAppInfo().getUri(), jeeApp); - } - - public Object removeModel(Object resolved) { - return map.remove(((ExternalEarInfo)resolved).getAppInfo().getUri()); - } - - public <T> T resolveModel(final Class<T> modelClass, T unresolved) { - URI uri = ((ExternalEarInfo)unresolved).getAppInfo().getUri(); - if (uri != null) { - ExternalEarInfo resolved = (ExternalEarInfo) map.get(uri); - if (resolved != null) { - return modelClass.cast(resolved); - } else { - // if you don't care about application composites you can - // simply read the EAR directly - /* - try { - File f = new File(uri.toString()); - final JavaEEApplicationInfo o = jeeIntrospector.introspectJeeArchive(f.toURI().toURL()); - return (T)new ExternalEarInfo() { - public JavaEEApplicationInfo getAppInfo() { - return (JavaEEApplicationInfo)o; - } - }; - } catch (Exception e) { - throw new RuntimeException(e); - } - */ - - // if you do care about the application composite you - // need to process the ear as a contribution - try{ - // find the location of the ear using a very specific algorithm - URL earLocation = null; - if ( uri.toString().equals("itest-contribution-jee-samples-13-ear-nonenhanced.ear")){ - earLocation = new File("../contribution-jee-samples/ear-nonenhanced/target/itest-contribution-jee-samples-13-ear-nonenhanced.ear").toURL(); - } else if ( uri.toString().equals("itest-contribution-jee-samples-29-ear-appcomp-contrib-implicit.ear")){ - earLocation = new File("../contribution-jee-samples/ear-appcomp-contrib-implicit/target/itest-contribution-jee-samples-29-ear-appcomp-contrib-implicit.ear").toURL(); - } else if ( uri.toString().equals("itest-contribution-jee-samples-30-ear-appcomp-contrib-implicit-war-appcomp.ear")){ - earLocation = new File("../contribution-jee-samples/ear-appcomp-contrib-implicit-war-appcomp/target/itest-contribution-jee-samples-30-ear-appcomp-contrib-implicit-war-appcomp.ear").toURL(); - } else { - return unresolved; - } - - // if you do care about application composites we have - // to process the EAR as a contribution - Contribution contribution = contributionService.contribute(uri.toString(), earLocation, false); - - JavaEEApplicationInfo appInfo = null; - Composite appComposite = null; - - // get the ear info - for (Artifact artifact : contribution.getArtifacts()){ - if (artifact.getModel() instanceof JavaEEApplicationInfo){ - appInfo = (JavaEEApplicationInfo)artifact.getModel(); - } - - if (artifact.getURI().equals("META-INF/application.composite")){ - appComposite = (Composite)artifact.getModel(); - } - } - - - final JavaEEApplicationInfo returnAppInfo = appInfo; - final Composite returnAppComposite = appComposite; - - return (T)new ExternalEarInfo() { - public JavaEEApplicationInfo getAppInfo() { - return returnAppInfo; - } - public Composite getAppComposite() { - return returnAppComposite; - } - }; - } catch (Exception e) { - throw new RuntimeException(e); - } - } - } - - return unresolved; - } - -} |