Skip to content

Commit 1f9c813

Browse files
committed
Close #172 - re-license under Apache License 2.0
1 parent a3f8259 commit 1f9c813

File tree

124 files changed

+2297
-358
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+2297
-358
lines changed

LICENSE

+201-219
Large diffs are not rendered by default.

pom.xml

+28
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Copyright 2019 Tango Controls
4+
~
5+
~ Licensed under the Apache License, Version 2.0 (the "License");
6+
~ you may not use this file except in compliance with the License.
7+
~ You may obtain a copy of the License at
8+
~
9+
~ http://www.apache.org/licenses/LICENSE-2.0
10+
~
11+
~ Unless required by applicable law or agreed to in writing, software
12+
~ distributed under the License is distributed on an "AS IS" BASIS,
13+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
~ See the License for the specific language governing permissions and
15+
~ limitations under the License.
16+
-->
17+
218
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
319
<modelVersion>4.0.0</modelVersion>
420

@@ -15,6 +31,18 @@
1531
</developer>
1632
</developers>
1733

34+
<organization>
35+
<name>Tango Controls</name>
36+
<url>http://tango-controls.org</url>
37+
</organization>
38+
39+
<licenses>
40+
<license>
41+
<name>Apache License 2.0</name>
42+
<url>http://www.apache.org/licenses/LICENSE-2.0</url>
43+
</license>
44+
</licenses>
45+
1846
<properties>
1947
<servlet-api.version>4.0.1</servlet-api.version>
2048
<tomcat.version>[8.5.34,)</tomcat.version>

src/assembly/web-archive.xml

+16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
<!--
2+
~ Copyright 2019 Tango Controls
3+
~
4+
~ Licensed under the Apache License, Version 2.0 (the "License");
5+
~ you may not use this file except in compliance with the License.
6+
~ You may obtain a copy of the License at
7+
~
8+
~ http://www.apache.org/licenses/LICENSE-2.0
9+
~
10+
~ Unless required by applicable law or agreed to in writing, software
11+
~ distributed under the License is distributed on an "AS IS" BASIS,
12+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
~ See the License for the specific language governing permissions and
14+
~ limitations under the License.
15+
-->
16+
117
<assembly
218
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
319
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

src/main/java/org/tango/TangoRestServer.java

+17
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright 2019 Tango Controls
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package org.tango;
218

319
import com.google.common.base.Preconditions;
@@ -87,6 +103,7 @@ public class TangoRestServer {
87103
public void setDeviceManager(final DeviceManager deviceManager) {
88104
this.deviceManager = deviceManager;
89105
}
106+
90107
private Tomcat tomcat;
91108

92109
public static void main(String[] args) {

src/main/java/org/tango/rest/EntryPoint.java

+16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright 2019 Tango Controls
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package org.tango.rest;
218

319
import com.google.common.collect.Maps;

src/main/java/org/tango/rest/TangoRestApi.java

+16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright 2019 Tango Controls
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package org.tango.rest;
218

319
import org.jboss.resteasy.plugins.cache.server.ServerCacheFeature;

src/main/java/org/tango/rest/rc4/DeviceAttribute.java

+22-6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright 2019 Tango Controls
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package org.tango.rest.rc4;
218

319
import com.google.common.base.Function;
@@ -61,11 +77,11 @@ public Object get(@Context UriInfo uriInfo){
6177
@GET
6278
@Path("/{event:change|periodic|archive|user}")
6379
public void deviceAttributeEvent(@PathParam("event") String eventAsString,
64-
@DefaultValue("30000") @QueryParam("timeout") long timeout,
65-
@DefaultValue("0") @QueryParam("last") long last,
66-
@Context ServletContext context,
67-
@Context UriInfo uriInfo,
68-
@Suspended final AsyncResponse response
80+
@DefaultValue("30000") @QueryParam("timeout") long timeout,
81+
@DefaultValue("0") @QueryParam("last") long last,
82+
@Context ServletContext context,
83+
@Context UriInfo uriInfo,
84+
@Suspended final AsyncResponse response
6985
) throws Exception {
7086
TangoEvent event = null;
7187
try {
@@ -89,7 +105,7 @@ public void deviceAttributeEvent(@PathParam("event") String eventAsString,
89105

90106
//this is required because field proxy is actually a proxy wrapper around ThreadLocal contextualData
91107
final TangoProxy finalTangoProxy = ResteasyProviderFactory.getContextData(TangoDeviceProxy.class).getProxy();
92-
108+
93109
CompletableFuture.runAsync(() -> {
94110
try {
95111
Object entity = buffer.createEvent(eventKey, finalTangoProxy).get(timeout);

src/main/java/org/tango/rest/rc4/DeviceCommand.java

+16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright 2019 Tango Controls
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package org.tango.rest.rc4;
218

319
import com.google.common.base.Function;

src/main/java/org/tango/rest/rc4/DeviceHelper.java

+41-25
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright 2019 Tango Controls
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package org.tango.rest.rc4;
218

319
import fr.esrf.Tango.DevFailed;
@@ -68,40 +84,40 @@ public static fr.esrf.TangoApi.DeviceAttribute[] getDeviceAttributesValue(TangoD
6884
//TODO split into good and bad attributes: write good ones; report bad ones (if present)
6985
fr.esrf.TangoApi.DeviceAttribute[] attrs =
7086
queryParams.stream()
71-
.map(stringListEntry -> {
72-
String attrName = stringListEntry.getKey();
73-
String[] value = stringListEntry.getValue().toArray(new String[stringListEntry.getValue().size()]);
74-
DeviceAttribute result;
87+
.map(stringListEntry -> {
88+
String attrName = stringListEntry.getKey();
89+
String[] value = stringListEntry.getValue().toArray(new String[stringListEntry.getValue().size()]);
90+
DeviceAttribute result;
7591

76-
try {
77-
result = new DeviceAttribute(attrName);
78-
TangoDataType<Object> dataType = (TangoDataType<Object>) deviceProxy.getProxy().getAttributeInfo(attrName).getType();
79-
Class<?> type = dataType.getDataTypeClass();
80-
Object converted = ConvertUtils.convert(value.length == 1 ? value[0] : value, type);
92+
try {
93+
result = new DeviceAttribute(attrName);
94+
TangoDataType<Object> dataType = (TangoDataType<Object>) deviceProxy.getProxy().getAttributeInfo(attrName).getType();
95+
Class<?> type = dataType.getDataTypeClass();
96+
Object converted = ConvertUtils.convert(value.length == 1 ? value[0] : value, type);
8197

82-
dataType.insert(TangoDataWrapper.create(result, null), converted);
98+
dataType.insert(TangoDataWrapper.create(result, null), converted);
8399

84-
return result;
85-
} catch (TangoProxyException | NoSuchAttributeException | ValueInsertionException e) {
86-
return null;
87-
}
88-
})
89-
.filter(Objects::nonNull)
90-
.toArray(fr.esrf.TangoApi.DeviceAttribute[]::new);
100+
return result;
101+
} catch (TangoProxyException | NoSuchAttributeException | ValueInsertionException e) {
102+
return null;
103+
}
104+
})
105+
.filter(Objects::nonNull)
106+
.toArray(fr.esrf.TangoApi.DeviceAttribute[]::new);
91107
if(async) {
92108
deviceProxy.getProxy().toDeviceProxy().write_attribute_asynch(attrs);
93109
return null;
94110
} else {
95111
String[] readNames =
96112
Arrays.stream(attrs)
97-
.map(deviceAttribute -> {
98-
try {
99-
return deviceAttribute.getName();
100-
} catch (DevFailed devFailed) {
101-
throw new AssertionError("Must not happen!", TangoUtils.convertDevFailedToException(devFailed));
102-
}
103-
})
104-
.toArray(String[]::new);
113+
.map(deviceAttribute -> {
114+
try {
115+
return deviceAttribute.getName();
116+
} catch (DevFailed devFailed) {
117+
throw new AssertionError("Must not happen!", TangoUtils.convertDevFailedToException(devFailed));
118+
}
119+
})
120+
.toArray(String[]::new);
105121
deviceProxy.getProxy().toDeviceProxy().write_attribute(attrs);
106122
return deviceProxy.getProxy().toDeviceProxy().read_attribute(readNames);
107123
}

src/main/java/org/tango/rest/rc4/DevicePipe.java

+16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright 2019 Tango Controls
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package org.tango.rest.rc4;
218

319
import fr.esrf.Tango.DevFailed;

src/main/java/org/tango/rest/rc4/Devices.java

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
1+
/*
2+
* Copyright 2019 Tango Controls
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package org.tango.rest.rc4;
218

319
import com.google.common.base.Function;
420
import com.google.common.collect.Lists;
521
import fr.esrf.Tango.DevFailed;
6-
import org.tango.client.ez.proxy.NoSuchCommandException;
722
import org.tango.client.ez.proxy.TangoProxyException;
823
import org.tango.rest.rc4.entities.NamedEntity;
924
import org.tango.web.server.binding.Partitionable;

src/main/java/org/tango/rest/rc4/JaxRsDevice.java

+18-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright 2019 Tango Controls
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package org.tango.rest.rc4;
218

319
import com.google.common.base.Function;
@@ -62,7 +78,7 @@ public Object apply(final AttributeInfoEx input) {
6278
@DynamicValue
6379
@Path("/attributes/info")
6480
public fr.esrf.TangoApi.AttributeInfoEx[] deviceAttributeInfos(@QueryParam("attr") String[] attrs,
65-
@Context UriInfo uriInfo) throws DevFailed {
81+
@Context UriInfo uriInfo) throws DevFailed {
6682
return deviceProxy.getProxy().toDeviceProxy().get_attribute_info_ex(attrs);
6783
}
6884

@@ -71,7 +87,7 @@ public fr.esrf.TangoApi.AttributeInfoEx[] deviceAttributeInfos(@QueryParam("attr
7187
@DynamicValue
7288
@Path("/attributes/value")
7389
public fr.esrf.TangoApi.DeviceAttribute[] deviceAttributeValues(@QueryParam("attr") String[] attrs,
74-
@Context UriInfo uriInfo) throws DevFailed {
90+
@Context UriInfo uriInfo) throws DevFailed {
7591
return deviceProxy.getProxy().toDeviceProxy().read_attribute(attrs);
7692
}
7793

src/main/java/org/tango/rest/rc4/JaxRsDeviceProperties.java

+16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright 2019 Tango Controls
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package org.tango.rest.rc4;
218

319
import com.google.common.base.Function;

0 commit comments

Comments
 (0)