Skip to content

Commit

Permalink
SDE Integration
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Kit <kit@d3s.mff.cuni.cz>
  • Loading branch information
Michal Kit committed Sep 4, 2012
1 parent 549eab8 commit a5914f8
Show file tree
Hide file tree
Showing 79 changed files with 1,308 additions and 248 deletions.
20 changes: 20 additions & 0 deletions .project
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,24 @@
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>sf.eclipse.javacc.javaccnature</nature>
</natures>
<filteredResources>
<filter>
<id>1346743757318</id>
<name></name>
<type>10</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-SDE</arguments>
</matcher>
</filter>
<filter>
<id>1346743757321</id>
<name></name>
<type>6</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-EXAMPLE-OSGi</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
7 changes: 7 additions & 0 deletions EXAMPLE-OSGi/MigrationEnsembleOSGI/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
28 changes: 28 additions & 0 deletions EXAMPLE-OSGi/MigrationEnsembleOSGI/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>MigrationEnsembleOSGI</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
eclipse.preferences.version=1
pluginProject.equinox=false
pluginProject.extensions=false
resolve.requirebundle=false
14 changes: 14 additions & 0 deletions EXAMPLE-OSGi/MigrationEnsembleOSGI/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: MigrationEnsembleOSGI
Bundle-SymbolicName: MigrationEnsembleOSGI
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Service-Component: OSGI-INF/MigrationEnsembleOSGI.xml
Bundle-ClassPath: .
Import-Package: cz.cuni.mff.d3s.deeco.annotations,
cz.cuni.mff.d3s.deeco.ensemble,
cz.cuni.mff.d3s.deeco.knowledge,
cz.cuni.mff.d3s.deeco.provider,
cz.cuni.mff.d3s.deeco.provider.sde
Bundle-ActivationPolicy: lazy
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0"?>
<component name="MigrationEnsembleOSGI">
<implementation class="cz.cuni.mff.d3s.deeco.provider.sde.OSGiBundleDEECoObjectProvider"/>
<service>
<provide interface="cz.cuni.mff.d3s.deeco.provider.AbstractDEECoObjectProvider"/>
</service>
<property name="ensembles"
value="cz.cuni.mff.d3s.deeco.demo.cloud.MigrationEnsemble"/>
</component>
Binary file not shown.
6 changes: 6 additions & 0 deletions EXAMPLE-OSGi/MigrationEnsembleOSGI/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
OSGI-INF/
jars.compile.order = .
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*******************************************************************************
* Copyright 2012 Charles University in Prague
*
* Licensed 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 cz.cuni.mff.d3s.deeco.demo.cloud;

import cz.cuni.mff.d3s.deeco.annotations.DEECoEnsemble;
import cz.cuni.mff.d3s.deeco.annotations.DEECoEnsembleMapper;
import cz.cuni.mff.d3s.deeco.annotations.DEECoEnsembleMembership;
import cz.cuni.mff.d3s.deeco.annotations.DEECoIn;
import cz.cuni.mff.d3s.deeco.annotations.DEECoOut;
import cz.cuni.mff.d3s.deeco.annotations.DEECoPeriodicScheduling;
import cz.cuni.mff.d3s.deeco.ensemble.Ensemble;
import cz.cuni.mff.d3s.deeco.knowledge.OutWrapper;

/**
* Sample ensemble class.
*
* @author Michal Kit
*
*/
@DEECoEnsemble
@DEECoPeriodicScheduling(3000)
public class MigrationEnsemble extends Ensemble {

@DEECoEnsembleMembership
public static boolean membership(
@DEECoIn("member.id") String mId,
@DEECoIn("member.loadRatio") Float mLoadRatio,
@DEECoIn("member.maxLoadRatio") Float mMaxLoadRatio,
@DEECoIn("coord.id") String cId,
@DEECoIn("coord.loadRatio") Float cLoadRatio,
@DEECoIn("coord.maxLoadRatio") Float cMaxLoadRatio) {
return !mId.equals(cId) && mLoadRatio > mMaxLoadRatio && cLoadRatio < cMaxLoadRatio;
}

@DEECoEnsembleMapper
public static void map(@DEECoOut("member.targetNode") OutWrapper<String> mTargetNode,
@DEECoIn("coord.id") String cId) {
System.out.println("Move application to " + cId);
mTargetNode.item = cId;
}
}
7 changes: 7 additions & 0 deletions EXAMPLE-OSGi/NodeAOSGI/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
28 changes: 28 additions & 0 deletions EXAMPLE-OSGi/NodeAOSGI/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>NodeAOSGI</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
7 changes: 7 additions & 0 deletions EXAMPLE-OSGi/NodeAOSGI/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
4 changes: 4 additions & 0 deletions EXAMPLE-OSGi/NodeAOSGI/.settings/org.eclipse.pde.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
eclipse.preferences.version=1
pluginProject.equinox=false
pluginProject.extensions=false
resolve.requirebundle=false
13 changes: 13 additions & 0 deletions EXAMPLE-OSGi/NodeAOSGI/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: NodeAOSGI
Bundle-SymbolicName: NodeAOSGI
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Service-Component: OSGI-INF/NodeAOSGI.xml
Bundle-ClassPath: .
Import-Package: cz.cuni.mff.d3s.deeco.annotations,
cz.cuni.mff.d3s.deeco.knowledge,
cz.cuni.mff.d3s.deeco.provider,
cz.cuni.mff.d3s.deeco.provider.sde
Bundle-ActivationPolicy: lazy
9 changes: 9 additions & 0 deletions EXAMPLE-OSGi/NodeAOSGI/OSGI-INF/NodeAOSGI.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0"?>
<component name="NodeAOSGI">
<implementation class="cz.cuni.mff.d3s.deeco.provider.sde.OSGiBundleDEECoObjectProvider"/>
<service>
<provide interface="cz.cuni.mff.d3s.deeco.provider.AbstractDEECoObjectProvider"/>
</service>
<property name="components"
value="cz.cuni.mff.d3s.deeco.demo.cloud.NodeA"/>
</component>
Binary file not shown.
6 changes: 6 additions & 0 deletions EXAMPLE-OSGi/NodeAOSGI/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
OSGI-INF/
jars.compile.order = .
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*******************************************************************************
* Copyright 2012 Charles University in Prague
*
* Licensed 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 cz.cuni.mff.d3s.deeco.demo.cloud;

import java.util.Random;

import cz.cuni.mff.d3s.deeco.annotations.DEECoComponent;
import cz.cuni.mff.d3s.deeco.annotations.DEECoInitialize;
import cz.cuni.mff.d3s.deeco.annotations.DEECoOut;
import cz.cuni.mff.d3s.deeco.annotations.DEECoPeriodicScheduling;
import cz.cuni.mff.d3s.deeco.annotations.DEECoProcess;
import cz.cuni.mff.d3s.deeco.knowledge.ComponentKnowledge;
import cz.cuni.mff.d3s.deeco.knowledge.OutWrapper;

@DEECoComponent
public class NodeA extends ComponentKnowledge {

public Float loadRatio;
public Float maxLoadRatio;
public Integer networkId;
public String targetNode;

@DEECoInitialize
public static ComponentKnowledge getInitialKnowledge() {
NodeA k = new NodeA();
k.id = "NodeA";
k.loadRatio = 0.0f;
k.maxLoadRatio = 0.5f;
k.networkId = 1;
k.targetNode = null;
return k;
}

@DEECoProcess
@DEECoPeriodicScheduling(6000)
public static void process(@DEECoOut("loadRatio") OutWrapper<Float> loadRatio) {
loadRatio.item = new Random().nextFloat();
System.out.println("Node A new load ratio: " + loadRatio.item);
}
}
7 changes: 7 additions & 0 deletions EXAMPLE-OSGi/NodeBOSGI/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
28 changes: 28 additions & 0 deletions EXAMPLE-OSGi/NodeBOSGI/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>NodeBOSGI</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
7 changes: 7 additions & 0 deletions EXAMPLE-OSGi/NodeBOSGI/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
4 changes: 4 additions & 0 deletions EXAMPLE-OSGi/NodeBOSGI/.settings/org.eclipse.pde.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
eclipse.preferences.version=1
pluginProject.equinox=false
pluginProject.extensions=false
resolve.requirebundle=false
13 changes: 13 additions & 0 deletions EXAMPLE-OSGi/NodeBOSGI/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: NodeBOSGI
Bundle-SymbolicName: NodeBOSGI
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Service-Component: OSGI-INF/NodeBOSGI.xml
Bundle-ClassPath: .
Import-Package: cz.cuni.mff.d3s.deeco.annotations,
cz.cuni.mff.d3s.deeco.knowledge,
cz.cuni.mff.d3s.deeco.provider,
cz.cuni.mff.d3s.deeco.provider.sde
Bundle-ActivationPolicy: lazy
9 changes: 9 additions & 0 deletions EXAMPLE-OSGi/NodeBOSGI/OSGI-INF/NodeBOSGI.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0"?>
<component name="NodeBOSGI">
<implementation class="cz.cuni.mff.d3s.deeco.provider.sde.OSGiBundleDEECoObjectProvider"/>
<service>
<provide interface="cz.cuni.mff.d3s.deeco.provider.AbstractDEECoObjectProvider"/>
</service>
<property name="components"
value="cz.cuni.mff.d3s.deeco.demo.cloud.NodeB"/>
</component>
Binary file not shown.
6 changes: 6 additions & 0 deletions EXAMPLE-OSGi/NodeBOSGI/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
OSGI-INF/
jars.compile.order = .
Loading

0 comments on commit a5914f8

Please sign in to comment.