diff options
Diffstat (limited to 'sca-java-2.x/trunk')
3 files changed, 79 insertions, 0 deletions
diff --git a/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/extensibility/impl/DefaultHttpPortAllocatorImpl.java b/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/extensibility/impl/DefaultHttpPortAllocatorImpl.java new file mode 100644 index 0000000000..b345402d8b --- /dev/null +++ b/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/extensibility/impl/DefaultHttpPortAllocatorImpl.java @@ -0,0 +1,41 @@ +/* + * 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.host.http.extensibility.impl; + +import org.apache.tuscany.sca.host.http.HttpScheme; +import org.apache.tuscany.sca.host.http.extensibility.HttpPortAllocator; + +public class DefaultHttpPortAllocatorImpl implements HttpPortAllocator { + + public int getDefaultPort(HttpScheme scheme) { + int port = 0; + + if(scheme == HttpScheme.HTTP) { + port = 8080; + } else if(scheme == HttpScheme.HTTPS) { + port = 8443; + } else { + throw new IllegalArgumentException("Scheme not support : " + scheme.toString()); + } + + return port; + } + +} diff --git a/sca-java-2.x/trunk/modules/host-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.http.extensibility.HttpPortAllocator b/sca-java-2.x/trunk/modules/host-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.http.extensibility.HttpPortAllocator new file mode 100644 index 0000000000..70bc948ffc --- /dev/null +++ b/sca-java-2.x/trunk/modules/host-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.http.extensibility.HttpPortAllocator @@ -0,0 +1,19 @@ +# 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. + +org.apache.tuscany.sca.host.http.extensibility.impl.DefaultHttpPortAllocatorImpl + diff --git a/sca-java-2.x/trunk/modules/host-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.http.extensibility.HttpPortAllocatorExtensionPoint b/sca-java-2.x/trunk/modules/host-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.http.extensibility.HttpPortAllocatorExtensionPoint new file mode 100644 index 0000000000..06d49c5ea3 --- /dev/null +++ b/sca-java-2.x/trunk/modules/host-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.http.extensibility.HttpPortAllocatorExtensionPoint @@ -0,0 +1,19 @@ +# 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. + +org.apache.tuscany.sca.host.http.extensibility.DefaultHttpPortAllocatorExtensionPoint + |