diff options
Diffstat (limited to '')
6 files changed, 408 insertions, 0 deletions
diff --git a/sca-cpp/trunk/modules/edit/palettes.py b/sca-cpp/trunk/modules/edit/palettes.py new file mode 100644 index 0000000000..9d07973cef --- /dev/null +++ b/sca-cpp/trunk/modules/edit/palettes.py @@ -0,0 +1,32 @@ +# 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. + +# Palettes collection implementation +import uuid +import sys +from util import * + +# Convert an id to a palette id +def paletteid(id): + return ("'" + car(id), "'palette.composite") + +# Get a palette from the palettes db +def get(id, cache): + if isNil(id): + return ("Palettes", "palettes") + return (car(id), car(id), cache.get(paletteid(id))) + diff --git a/sca-cpp/trunk/modules/edit/palettes/control/palette.composite b/sca-cpp/trunk/modules/edit/palettes/control/palette.composite new file mode 100644 index 0000000000..21aa631217 --- /dev/null +++ b/sca-cpp/trunk/modules/edit/palettes/control/palette.composite @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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. +--> +<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912" + xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1" + targetNamespace="http://control" + name="palette"> + + <service name="if" promote="if"/> + <service name="ifelse" promote="ifelse"/> + <service name="foreach" promote="foreach"/> + + <component name="if" t:color="yellow"> + <t:implementation.python script="if_.py"/> + <service name="if" t:align="top"/> + <reference name="condition"/> + <reference name="do" t:align="bottom"/> + </component> + + <component name="ifelse" t:color="yellow"> + <documentation>if else</documentation> + <t:implementation.python script="ifelse.py"/> + <service name="ifelse" t:align="top"/> + <reference name="condition"/> + <reference name="do" t:align="bottom"/> + <reference name="else" t:align="bottom"/> + </component> + + <component name="foreach" t:color="yellow"> + <documentation>for each</documentation> + <t:implementation.python script="ifelse.py"/> + <service name="foreach" t:align="top"/> + <reference name="list"/> + <reference name="do" t:align="bottom"/> + </component> + +</composite> diff --git a/sca-cpp/trunk/modules/edit/palettes/operators/palette.composite b/sca-cpp/trunk/modules/edit/palettes/operators/palette.composite new file mode 100644 index 0000000000..35f8dfdf9c --- /dev/null +++ b/sca-cpp/trunk/modules/edit/palettes/operators/palette.composite @@ -0,0 +1,138 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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. +--> +<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912" + xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1" + targetNamespace="http://operators" + name="palette"> + + <service name="true" promote="true"/> + <service name="false" promote="false"/> + <service name="and" promote="and"/> + <service name="or" promote="or"/> + <service name="not" promote="not"/> + <service name="equals" promote="equals"/> + <service name="greater" promote="greater"/> + <service name="lesser" promote="lesser"/> + <service name="multiply" promote="multiply"/> + <service name="divide" promote="divide"/> + <service name="add" promote="add"/> + <service name="subtract" promote="subtract"/> + + <component name="true" t:color="green"> + <t:implementation.python script="true_.py"/> + <service name="true"/> + </component> + + <component name="false" t:color="green"> + <t:implementation.python script="false_.py"/> + <service name="false"/> + </component> + + <component name="and" t:color="green"> + <t:implementation.python script="and_.py"/> + <service name="and"/> + <reference name="value1"/> + <reference name="value2"/> + </component> + + <component name="or" t:color="green"> + <t:implementation.python script="or_.py"/> + <service name="or"/> + <reference name="value1"/> + <reference name="value2"/> + </component> + + <component name="not" t:color="green"> + <t:implementation.python script="not_.py"/> + <service name="not"/> + <reference name="value"/> + </component> + + <component name="equals" t:color="green"> + <documentation>=</documentation> + <t:implementation.python script="equals.py"/> + <service name="equals"> + <documentation>=</documentation> + </service> + <reference name="value1"/> + <reference name="value2"/> + </component> + + <component name="greater" t:color="green"> + <documentation>gt</documentation> + <t:implementation.python script="greater.py"/> + <service name="greater"> + <documentation>gt</documentation> + </service> + <reference name="value1"/> + <reference name="value2"/> + </component> + + <component name="lesser" t:color="green"> + <documentation>lt</documentation> + <t:implementation.python script="lesser.py"/> + <service name="lesser"> + <documentation>lt</documentation> + </service> + <reference name="value1"/> + <reference name="value2"/> + </component> + + <component name="multiply" t:color="green"> + <documentation>*</documentation> + <t:implementation.python script="multiply.py"/> + <service name="multiply"> + <documentation>*</documentation> + </service> + <reference name="value1"/> + <reference name="value2"/> + </component> + + <component name="divide" t:color="green"> + <documentation>/</documentation> + <t:implementation.python script="divide.py"/> + <service name="divide"> + <documentation>/</documentation> + </service> + <reference name="value1"/> + <reference name="value2"/> + </component> + + <component name="add" t:color="green"> + <documentation>+</documentation> + <t:implementation.python script="add.py"/> + <service name="add"> + <documentation>+</documentation> + </service> + <reference name="value1"/> + <reference name="value2"/> + </component> + + <component name="subtract" t:color="green"> + <documentation>-</documentation> + <t:implementation.python script="subtract.py"/> + <service name="subtract"> + <documentation>-</documentation> + </service> + <reference name="value1"/> + <reference name="value2"/> + </component> + +</composite> diff --git a/sca-cpp/trunk/modules/edit/palettes/sensors/palette.composite b/sca-cpp/trunk/modules/edit/palettes/sensors/palette.composite new file mode 100644 index 0000000000..20ef8225ce --- /dev/null +++ b/sca-cpp/trunk/modules/edit/palettes/sensors/palette.composite @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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. +--> +<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912" + xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1" + targetNamespace="http://sensors" + name="palette"> + + <service name="location" promote="location"/> + + <component name="location" t:color="magenta"> + <t:implementation.python script="location.py"/> + <service name="location"/> + </component> + +</composite> diff --git a/sca-cpp/trunk/modules/edit/palettes/social/palette.composite b/sca-cpp/trunk/modules/edit/palettes/social/palette.composite new file mode 100644 index 0000000000..264e2ed137 --- /dev/null +++ b/sca-cpp/trunk/modules/edit/palettes/social/palette.composite @@ -0,0 +1,81 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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. +--> +<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912" + xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1" + targetNamespace="http://social" + name="palette"> + + <service name="JSONTwit" promote="JSONTwit"/> + <service name="XMLTwit" promote="XMLTwit"/> + <service name="RSSTwit" promote="RSSTwit"/> + <service name="HTML" promote="HTML"/> + <service name="JSONFB" promote="JSONFB"/> + + <component name="JSONTwit" t:color="red"> + <t:implementation.python script="relay.py"/> + <service name="Relay"> + <t:binding.http uri="jsontwit"/> + </service> + <reference name="target"> + <t:binding.http uri="http://api.twitter.com/1/statuses/user_timeline.json?screen_name=jsdelfino"/> + </reference> + </component> + + <component name="XMLTwit" t:color="green"> + <t:implementation.python script="relay.py"/> + <service name="Relay"> + <t:binding.http uri="xmltwit"/> + </service> + <reference name="target"> + <t:binding.http uri="http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=jsdelfino"/> + </reference> + </component> + + <component name="RSSTwit" t:color="blue"> + <t:implementation.python script="relay.py"/> + <service name="Relay"> + <t:binding.http uri="rsstwit"/> + </service> + <reference name="target"> + <t:binding.http uri="http://api.twitter.com/1/statuses/user_timeline.rss?screen_name=jsdelfino"/> + </reference> + </component> + + <component name="HTML" t:color="yellow"> + <t:implementation.python script="relay.py"/> + <service name="Relay"> + <t:binding.http uri="html"/> + </service> + <reference name="target"> + <t:binding.http uri="http://people.apache.org/~jsdelfino/"/> + </reference> + </component> + + <component name="JSONFB" t:color="orange"> + <t:implementation.python script="relay.py"/> + <service name="Relay"> + <t:binding.http uri="jsonfb"/> + </service> + <reference name="target"> + <t:binding.http uri="https://graph.facebook.com/100001053301307"/> + </reference> + </component> + +</composite> diff --git a/sca-cpp/trunk/modules/edit/palettes/variables/palette.composite b/sca-cpp/trunk/modules/edit/palettes/variables/palette.composite new file mode 100644 index 0000000000..42fc43525b --- /dev/null +++ b/sca-cpp/trunk/modules/edit/palettes/variables/palette.composite @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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. +--> +<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912" + xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1" + targetNamespace="http://variables" + name="palette"> + + <service name="number" promote="number"/> + <service name="text" promote="text"/> + <service name="set" promote="set"/> + <service name="list" promote="list"/> + <service name="first" promote="first"/> + <service name="rest" promote="rest"/> + + <component name="number" t:color="orange"> + <t:implementation.python script="number.py"/> + <service name="number"/> + </component> + + <component name="text" t:color="orange"> + <t:implementation.python script="text.py"/> + <service name="text"/> + </component> + + <component name="set" t:color="orange"> + <documentation>set variable</documentation> + <t:implementation.python script="set.py"/> + <service name="set"/> + <reference name="value"/> + <reference name="variable"/> + </component> + + <component name="list" t:color="orange"> + <documentation>make a list</documentation> + <t:implementation.python script="list_.py"/> + <service name="list"/> + <reference name="first"/> + <reference name="rest"/> + </component> + + <component name="first" t:color="orange"> + <documentation>first of a list</documentation> + <t:implementation.python script="first.py"/> + <service name="first"/> + <reference name="value"/> + </component> + + <component name="rest" t:color="orange"> + <documentation>rest of a list</documentation> + <t:implementation.python script="rest.py"/> + <service name="rest"/> + <reference name="value"/> + </component> + +</composite> |