summaryrefslogtreecommitdiffstats
path: root/sandbox/container.ruby/src/main/java/org/apache/tuscany/container/ruby/config/RubyContextFactory.java
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox/container.ruby/src/main/java/org/apache/tuscany/container/ruby/config/RubyContextFactory.java')
-rw-r--r--sandbox/container.ruby/src/main/java/org/apache/tuscany/container/ruby/config/RubyContextFactory.java55
1 files changed, 55 insertions, 0 deletions
diff --git a/sandbox/container.ruby/src/main/java/org/apache/tuscany/container/ruby/config/RubyContextFactory.java b/sandbox/container.ruby/src/main/java/org/apache/tuscany/container/ruby/config/RubyContextFactory.java
new file mode 100644
index 0000000000..e39faca6a3
--- /dev/null
+++ b/sandbox/container.ruby/src/main/java/org/apache/tuscany/container/ruby/config/RubyContextFactory.java
@@ -0,0 +1,55 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * 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 org.apache.tuscany.container.ruby.config;
+
+import org.apache.tuscany.container.extension.config.AbstractContextFactory;
+import org.apache.tuscany.container.ruby.context.RubyComponentContext;
+import org.apache.tuscany.container.ruby.invoker.RubyScript;
+import org.apache.tuscany.core.builder.ContextCreationException;
+import org.apache.tuscany.model.assembly.Scope;
+
+/**
+ * Ruby context factory.
+ */
+public class RubyContextFactory extends AbstractContextFactory<RubyComponentContext> {
+
+ // Ruby script to run
+ private RubyScript rubyScript;
+
+ /**
+ * Initializes the context factory.
+ *
+ * @param name Context name.
+ * @param scope Context scope.
+ * @param rubyScript Ruby script to run.
+ */
+ public RubyContextFactory(String name, Scope scope, RubyScript rubyScript) {
+ super(name, scope);
+ this.rubyScript = rubyScript;
+ }
+
+ /**
+ * Creates the Ruby component context.
+ */
+ public RubyComponentContext createContext() throws ContextCreationException {
+ return new RubyComponentContext(
+ getName(),
+ getTargetWireFactories(),
+ rubyScript);
+ }
+
+}