From f20ddb18c5425b2dae9abc90a8a1c0f3f1d7b71a Mon Sep 17 00:00:00 2001 From: slaws Date: Thu, 19 May 2011 12:41:09 +0000 Subject: Bit of renaming to be clear this is about looking at the domain rather then being the domain. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1124713 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/tuscany/sca/domain/Composite.java | 47 ---------- .../apache/tuscany/sca/domain/CompositeImpl.java | 40 -------- .../apache/tuscany/sca/domain/CompositeView.java | 46 ++++++++++ .../tuscany/sca/domain/CompositeViewImpl.java | 73 +++++++++++++++ .../java/org/apache/tuscany/sca/domain/Domain.java | 85 ----------------- .../org/apache/tuscany/sca/domain/DomainImpl.java | 102 --------------------- .../org/apache/tuscany/sca/domain/DomainView.java | 80 ++++++++++++++++ .../apache/tuscany/sca/domain/DomainViewImpl.java | 80 ++++++++++++++++ .../src/main/resources/domain.composite | 6 +- 9 files changed, 282 insertions(+), 277 deletions(-) delete mode 100644 sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/Composite.java delete mode 100644 sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeImpl.java create mode 100644 sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeView.java create mode 100644 sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeViewImpl.java delete mode 100644 sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/Domain.java delete mode 100644 sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainImpl.java create mode 100644 sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainView.java create mode 100644 sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainViewImpl.java (limited to 'sandbox') diff --git a/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/Composite.java b/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/Composite.java deleted file mode 100644 index fdc7f142c1..0000000000 --- a/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/Composite.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.domain; - -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; - -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -public interface Composite { - -// @GET - @Produces( {MediaType.TEXT_HTML}) - @Path("{domainname}/composite") - public String get(); - - - @GET - @Produces( {MediaType.APPLICATION_ATOM_XML, - MediaType.APPLICATION_JSON, - MediaType.APPLICATION_XML, - MediaType.TEXT_HTML}) - @Path("{domainname}/composite/{compositename}") - public String getComposite(@PathParam("compositename") String domainName); - -} \ No newline at end of file diff --git a/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeImpl.java b/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeImpl.java deleted file mode 100644 index 1011a5b693..0000000000 --- a/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeImpl.java +++ /dev/null @@ -1,40 +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.domain; - -/** - * Some hand crafted HTTP code to help me think about what info is missing - * from the domain registry - * - */ -public class CompositeImpl implements Composite { - - public String get() { - String outputHTML = "

get"; - return outputHTML; - } - - - public String getComposite(String domainName) { - String outputHTML = "

get composite"; - return outputHTML; - } - -} \ No newline at end of file diff --git a/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeView.java b/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeView.java new file mode 100644 index 0000000000..4ff1101cfa --- /dev/null +++ b/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeView.java @@ -0,0 +1,46 @@ +/* + * 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.domain; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface CompositeView { + + @GET + @Produces( {MediaType.TEXT_HTML}) + public String get(); + + + @GET + @Produces( {MediaType.APPLICATION_ATOM_XML, + MediaType.APPLICATION_JSON, + MediaType.APPLICATION_XML, + MediaType.TEXT_HTML}) + @Path("{compositename}") + public String getComposite(@PathParam("compositename") String domainName); + +} \ No newline at end of file diff --git a/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeViewImpl.java b/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeViewImpl.java new file mode 100644 index 0000000000..8220672a8b --- /dev/null +++ b/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeViewImpl.java @@ -0,0 +1,73 @@ +/* + * 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.domain; + +import java.util.List; +import java.util.Map; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.sca.assembly.AssemblyFactory; +import org.apache.tuscany.sca.assembly.Base; +import org.apache.tuscany.sca.assembly.Composite; +import org.apache.tuscany.sca.assembly.xml.Utils; +import org.apache.tuscany.sca.core.FactoryExtensionPoint; + +/** + * Some hand crafted HTTP code to help me think about what info is missing + * from the domain registry + * + */ +public class CompositeViewImpl implements CompositeView { + + public String get() { + String outputHTML = "

get"; + return outputHTML; + +// Utils.modelToXML(getDomainComposite(domainName), true, DomainViewRunner.extensionPointRegistry); + } + + + public String getComposite(String domainName) { + String outputHTML = "

get composite"; + return outputHTML; + } + + // utilities + + // copied from domain node + public Composite getDomainComposite(String domainName) { + FactoryExtensionPoint factories = DomainViewRunner.extensionPointRegistry.getExtensionPoint(FactoryExtensionPoint.class); + AssemblyFactory assemblyFactory = factories.getFactory(AssemblyFactory.class); + Composite domainComposite = assemblyFactory.createComposite(); + domainComposite.setName(new QName(Base.SCA11_TUSCANY_NS, domainName)); + domainComposite.setAutowire(false); + domainComposite.setLocal(false); + List domainIncludes = domainComposite.getIncludes(); + Map> runningCompositeURIs = DomainViewRunner.domainRegistry.getRunningCompositeURIs(); + for (String curi : runningCompositeURIs.keySet()) { + for (String compositeURI : runningCompositeURIs.get(curi)) { + domainIncludes.add(DomainViewRunner.domainRegistry.getRunningComposite(curi, compositeURI)); + } + } + return domainComposite; + } + +} \ No newline at end of file diff --git a/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/Domain.java b/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/Domain.java deleted file mode 100644 index 5acaf73be3..0000000000 --- a/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/Domain.java +++ /dev/null @@ -1,85 +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.domain; - -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; - -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -public interface Domain { - - @GET - @Produces( {MediaType.TEXT_HTML}) - public String get(); - - @Path("{domainname}") - @GET - @Produces( {MediaType.APPLICATION_ATOM_XML, - MediaType.APPLICATION_JSON, - MediaType.APPLICATION_XML, - MediaType.TEXT_HTML}) - public String getDomainServiceDocument(@PathParam("domainname") String domainName); - - @Path("{domainname}/contribution") - @GET - @Produces( {MediaType.APPLICATION_ATOM_XML, - MediaType.APPLICATION_JSON, - MediaType.APPLICATION_XML, - MediaType.TEXT_HTML}) - public String getContributions(@PathParam("domainname") String domainName); - - @Path("{domainname}/composite") - @GET - @Produces( {MediaType.APPLICATION_ATOM_XML, - MediaType.APPLICATION_JSON, - MediaType.APPLICATION_XML, - MediaType.TEXT_HTML}) - public String getComposites(@PathParam("domainname") String domainName); - - @Path("{domainname}/component") - @GET - @Produces( {MediaType.APPLICATION_ATOM_XML, - MediaType.APPLICATION_JSON, - MediaType.APPLICATION_XML, - MediaType.TEXT_HTML}) - public String getComponents(@PathParam("domainname") String domainName); - - @Path("{domainname}/endpoint") - @GET - @Produces( {MediaType.APPLICATION_ATOM_XML, - MediaType.APPLICATION_JSON, - MediaType.APPLICATION_XML, - MediaType.TEXT_HTML}) - public String getEndpoints(@PathParam("domainname") String domainName); - - @Path("{domainname}/node") - @GET - @Produces( {MediaType.APPLICATION_ATOM_XML, - MediaType.APPLICATION_JSON, - MediaType.APPLICATION_XML, - MediaType.TEXT_HTML}) - public String getNodes(@PathParam("domainname") String domainName); - -} \ No newline at end of file diff --git a/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainImpl.java b/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainImpl.java deleted file mode 100644 index 5aab3d922e..0000000000 --- a/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainImpl.java +++ /dev/null @@ -1,102 +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.domain; - -import java.io.File; -import java.util.List; -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.assembly.Base; -import org.apache.tuscany.sca.assembly.Composite; -import org.apache.tuscany.sca.assembly.xml.Utils; -import org.apache.tuscany.sca.core.FactoryExtensionPoint; -import org.apache.tuscany.sca.impl.NodeImpl; -import org.apache.tuscany.sca.runtime.DomainRegistry; - - -/** - * Some hand crafted HTTP code to help me think about what info is missing - * from the domain registry - * - */ -public class DomainImpl implements Domain { - - public String get() { - String outputHTML = "

enter URL in the form http://host:port/sca/domain/yourdomainnamehere"; - return outputHTML; - } - - public String getDomainServiceDocument(String domainName) { - String outputHTML = "

contributions" + - "

composites" + - "

endpoints" + - "

nodes"; - return outputHTML; - } - - public String getContributions(String domainName) { - DomainRegistry domainRegistry = DomainView.domainRegistry; - List contributions = domainRegistry.getInstalledContributionURIs(); - return contributions.toString(); - } - - public String getComposites(String domainName){ - return Utils.modelToXML(getDomainComposite(domainName), true, DomainView.extensionPointRegistry); - } - - public String getComponents(String domainName) { - // TODO Auto-generated method stub - return null; - } - - public String getEndpoints(String domainName) { - DomainRegistry domainRegistry = DomainView.domainRegistry; - return domainRegistry.getEndpoints().toString(); - } - - public String getNodes(String domainName){ - DomainRegistry domainRegistry = DomainView.domainRegistry; - return domainRegistry.getMembers().toString(); - } - - // utilities - - // copied from domain node - public Composite getDomainComposite(String domainName) { - FactoryExtensionPoint factories = DomainView.extensionPointRegistry.getExtensionPoint(FactoryExtensionPoint.class); - AssemblyFactory assemblyFactory = factories.getFactory(AssemblyFactory.class); - Composite domainComposite = assemblyFactory.createComposite(); - domainComposite.setName(new QName(Base.SCA11_TUSCANY_NS, domainName)); - domainComposite.setAutowire(false); - domainComposite.setLocal(false); - List domainIncludes = domainComposite.getIncludes(); - Map> runningCompositeURIs = DomainView.domainRegistry.getRunningCompositeURIs(); - for (String curi : runningCompositeURIs.keySet()) { - for (String compositeURI : runningCompositeURIs.get(curi)) { - domainIncludes.add(DomainView.domainRegistry.getRunningComposite(curi, compositeURI)); - } - } - return domainComposite; - } - -} \ No newline at end of file diff --git a/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainView.java b/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainView.java new file mode 100644 index 0000000000..d7514f1bf3 --- /dev/null +++ b/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainView.java @@ -0,0 +1,80 @@ +/* + * 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.domain; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface DomainView { + + @GET + @Produces( {MediaType.TEXT_HTML}) + public String get(); + + @Path("{domainname}") + @GET + @Produces( {MediaType.APPLICATION_ATOM_XML, + MediaType.APPLICATION_JSON, + MediaType.APPLICATION_XML, + MediaType.TEXT_HTML}) + public String getDomainServiceDocument(@PathParam("domainname") String domainName); + + @Path("{domainname}/contribution") + @GET + @Produces( {MediaType.APPLICATION_ATOM_XML, + MediaType.APPLICATION_JSON, + MediaType.APPLICATION_XML, + MediaType.TEXT_HTML}) + public String getContributions(@PathParam("domainname") String domainName); + + @Path("{domainname}/composite") + public CompositeView getComposites(@PathParam("domainname") String domainName); + + @Path("{domainname}/component") + @GET + @Produces( {MediaType.APPLICATION_ATOM_XML, + MediaType.APPLICATION_JSON, + MediaType.APPLICATION_XML, + MediaType.TEXT_HTML}) + public String getComponents(@PathParam("domainname") String domainName); + + @Path("{domainname}/endpoint") + @GET + @Produces( {MediaType.APPLICATION_ATOM_XML, + MediaType.APPLICATION_JSON, + MediaType.APPLICATION_XML, + MediaType.TEXT_HTML}) + public String getEndpoints(@PathParam("domainname") String domainName); + + @Path("{domainname}/node") + @GET + @Produces( {MediaType.APPLICATION_ATOM_XML, + MediaType.APPLICATION_JSON, + MediaType.APPLICATION_XML, + MediaType.TEXT_HTML}) + public String getNodes(@PathParam("domainname") String domainName); + +} \ No newline at end of file diff --git a/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainViewImpl.java b/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainViewImpl.java new file mode 100644 index 0000000000..1cfa4da94e --- /dev/null +++ b/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainViewImpl.java @@ -0,0 +1,80 @@ +/* + * 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.domain; + +import java.util.List; +import java.util.Map; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.sca.assembly.AssemblyFactory; +import org.apache.tuscany.sca.assembly.Base; +import org.apache.tuscany.sca.assembly.Composite; +import org.apache.tuscany.sca.assembly.xml.Utils; +import org.apache.tuscany.sca.core.FactoryExtensionPoint; +import org.apache.tuscany.sca.runtime.DomainRegistry; + + +/** + * Some hand crafted HTTP code to help me think about what info is missing + * from the domain registry + * + */ +public class DomainViewImpl implements DomainView { + + public String get() { + String outputHTML = "

enter URL in the form http://host:port/sca/domain/yourdomainnamehere"; + return outputHTML; + } + + public String getDomainServiceDocument(String domainName) { + String outputHTML = "

contributions" + + "

composites" + + "

components" + + "

endpoints" + + "

nodes"; + return outputHTML; + } + + public String getContributions(String domainName) { + DomainRegistry domainRegistry = DomainViewRunner.domainRegistry; + List contributions = domainRegistry.getInstalledContributionURIs(); + return contributions.toString(); + } + + public CompositeView getComposites(String domainName){ + return new CompositeViewImpl(); + } + + public String getComponents(String domainName) { + return null; + } + + public String getEndpoints(String domainName) { + DomainRegistry domainRegistry = DomainViewRunner.domainRegistry; + return domainRegistry.getEndpoints().toString(); + } + + public String getNodes(String domainName){ + DomainRegistry domainRegistry = DomainViewRunner.domainRegistry; + return domainRegistry.getMembers().toString(); + } + +} \ No newline at end of file diff --git a/sandbox/slaws/domain-view/src/main/resources/domain.composite b/sandbox/slaws/domain-view/src/main/resources/domain.composite index b86485d6b0..a3cdcbc3f8 100644 --- a/sandbox/slaws/domain-view/src/main/resources/domain.composite +++ b/sandbox/slaws/domain-view/src/main/resources/domain.composite @@ -30,9 +30,9 @@ - - - + + + -- cgit v1.2.3