Skip to content

Commit

Permalink
closes #18
Browse files Browse the repository at this point in the history
  • Loading branch information
dukeboard committed Feb 24, 2011
1 parent 911d699 commit 727c77c
Show file tree
Hide file tree
Showing 10 changed files with 256 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class KevoreeCoreActivator extends BundleActivator {
var configBean = new KevoreeConfigServiceBean
bc.registerService(classOf[ConfigurationService].getName(), configBean, new Hashtable());


myBean = new KevoreeCoreBean
myBean.setBundleContext(bc)
myBean.setConfigService(configBean)
Expand All @@ -62,7 +61,6 @@ class KevoreeCoreActivator extends BundleActivator {
/* EXPOSE MODELHELPER SERVICES */
bc.registerService(classOf[MetricsService].getName(), KevoreeMetricsServiceBean(myBean), new Hashtable());



}
}.start
Expand Down
15 changes: 13 additions & 2 deletions kevoree-core/org.kevoree.root/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@
<url>http://scala-tools.org/repo-releases</url>
</repository>
<repository>
<id>kevoree-github</id>
<url>http://dukeboard.github.com/kevoree/maven/</url>
<id>kevoree-libs-release-local</id>
<url>http://maven.kevoree.org/libs-release-local/</url>
</repository>
</repositories>

Expand Down Expand Up @@ -152,6 +152,7 @@
<module>../org.kevoree.baseChecker</module>
</modules>

<!--
<distributionManagement>
<repository>
<id>embedded-repo</id>
Expand All @@ -164,5 +165,15 @@
<uniqueVersion>false</uniqueVersion>
</snapshotRepository>
</distributionManagement>
-->

<distributionManagement>
<repository>
<id>maven.kevoree.org-releases</id>
<name>maven.kevoree.org-releases</name>
<url>http://maven.kevoree.org/libs-release-local</url>
</repository>
</distributionManagement>


</project>
175 changes: 172 additions & 3 deletions kevoree-platform/org.kevoree.platform.osgi.android/seed.txt

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
import org.kevoree.api.service.adaptation.deploy.KevoreeAdaptationDeployService;
import org.kevoree.api.service.core.handler.KevoreeModelHandlerService;
import org.kevoree.api.service.core.kompare.ModelKompareService;
import org.kevoree.core.impl.KevoreeConfigServiceBean;
import org.kevoree.core.impl.KevoreeCoreBean;
import org.kevoree.kompare.KevoreeKompareBean;
import org.kevoree.remote.rest.Handler;
import org.kevoree.remote.rest.KevoreeRemoteBean;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.service.packageadmin.PackageAdmin;
import org.kevoree.api.configuration.ConfigConstants;

/**
*
Expand Down Expand Up @@ -58,7 +58,9 @@ public void start(BundleContext context) throws Exception {

deployBean.setContext(contextDeploy);

KevoreeConfigServiceBean configBean = new KevoreeConfigServiceBean();
KevoreeAndroidConfigService configBean = new KevoreeAndroidConfigService();//new KevoreeConfigServiceBean();
configBean.def.put("node.name", KevoreeActivity.nodeName);

coreBean = new KevoreeCoreBean();
coreBean.setBundleContext(context);
coreBean.setConfigService((ConfigurationService) configBean);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public class EmbeddedFelix {

private Felix m_fwk;

public static String node_name = "KEVOREEDefaultNodeName";

public Felix getM_fwk() {
return m_fwk;
}
Expand All @@ -45,12 +47,14 @@ public void run() {
System.out.println("Init Felix Default path => " + felix_base);
}

/*
String node_name = System.getProperty("node.name");
if (node_name == null) {
node_name = "KEVOREEDefaultNodeName";
}
}*/

File cacheDir = new File(felix_base + "/" + "felixCache_" + node_name);
File cacheDir = new File(felix_base + "/" + "felixCache_" + KevoreeActivity.nodeName);
Map<String, Object> configProps = new HashMap<String, Object>();
if (cacheDir != null) {
configProps.put(Constants.FRAMEWORK_STORAGE, cacheDir.getAbsolutePath());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,24 @@
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TabHost;
import android.widget.*;
import android.widget.TabHost.TabSpec;
import android.widget.TabWidget;
import org.kevoree.android.framework.service.KevoreeAndroidService;
import org.kevoree.platform.osgi.android.ui.PreExistingViewFactory;

/**
* Hello world!
*
*/
public class KevoreeActivity extends Activity implements KevoreeAndroidService {

public static KevoreeAndroidService last = null;

public static String nodeName = "";

@Override
protected void onStart() {
super.onStart();
Expand All @@ -49,6 +48,7 @@ protected void onStop() {
// Intent intent = new Intent(".AndroidFelixService.ACTION");
//stopService(intent);
}

private Boolean alreadyStarted = false;
private TabHost tabs = null;

Expand Down Expand Up @@ -76,11 +76,18 @@ protected synchronized void onCreate(Bundle savedInstanceState) {
tspec1.setIndicator("Admin", this.getResources().getDrawable(android.R.drawable.ic_menu_preferences));

LinearLayout adminLayout = new LinearLayout(this);


final EditText nodeNameView = new EditText(this);
nodeNameView.setText("dukeTab");
nodeNameView.setWidth(200);

Button btstart = new Button(this);
btstart.setText("Start");
Button btstop = new Button(this);
btstop.setText("Stop");

adminLayout.addView(nodeNameView);
adminLayout.addView(btstart);
adminLayout.addView(btstop);

Expand All @@ -90,6 +97,7 @@ protected synchronized void onCreate(Bundle savedInstanceState) {
TabSpec tspec2 = tabs.newTabSpec("Tab2");
tspec2.setIndicator("Two", this.getResources().getDrawable(android.R.drawable.star_on));
tspec2.setContent(new PreExistingViewFactory(content2));
tabs.addTab(tspec2);
TabSpec tspec3 = tabs.newTabSpec("Tab3");
tspec3.setIndicator("Three", this.getResources().getDrawable(android.R.drawable.star_on));
Expand All @@ -111,6 +119,7 @@ public void onClick(View v) {
Intent intent_start = new Intent(ctx, AndroidFelixService.class);
Log.i("art2.service", "start bind service");
if (!alreadyStarted) {
nodeName= nodeNameView.getText().toString();
startService(intent_start);
alreadyStarted = true;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE, Version 3, 29 June 2007;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* 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.kevoree.platform.osgi.android;

import org.kevoree.api.configuration.ConfigConstants;
import org.kevoree.api.configuration.ConfigurationService;

import java.util.HashMap;
import java.util.Map;

public class KevoreeAndroidConfigService implements ConfigurationService {

public Map<String,String> def = new HashMap<String,String>();

@Override
public String getProperty(ConfigConstants.ConfigConstant constant) {
if(def.containsKey(constant.getValue())){
return def.get(constant.getValue());
}
return constant.getDefaultValue();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,25 @@ public class FelixShell extends JPanel {

private static String eol = System.getProperty("line.separator");

private JScrollPane scrollShell = null;

public FelixShell(final ShellService shell) {

setLayout(new BorderLayout());
final RichTextArea textArea = new RichTextArea();
textArea.setBackground(new Color(57,57,57));
textArea.setEditable(false);
textArea.setPreferredSize(new Dimension(500,250));
// textArea.setRows(15);
// textArea.setColumns(60);


singleton = null;
STDwriter = new PrintStream(new TextOutputStream(textArea,Color.GRAY));
STDwriter = new PrintStream(new TextOutputStream(textArea,Color.WHITE));
ERRwriter = new PrintStream(new TextOutputStream(textArea,Color.ORANGE));

add(new JScrollPane(textArea), BorderLayout.CENTER);
scrollShell = new JScrollPane(textArea);
add(scrollShell, BorderLayout.CENTER);

final JTextField input = new JTextField();

Expand All @@ -59,7 +63,7 @@ public void keyPressed(KeyEvent keyEvent) {

try {
// textArea.append("==>" + input.getText() + eol);
textArea.append(input.getText() + eol, Color.BLUE, Color.white, true);
textArea.append(input.getText() + eol, new Color(87,145,198), Color.white, true);

shell.executeCommand(input.getText().trim(), STDwriter, ERRwriter);
input.setText("");
Expand Down Expand Up @@ -94,6 +98,7 @@ public void write(final int i) throws IOException {
public void run() {
try {
_textArea.append(((char) i) + "", _color, Color.white, false);
_textArea.selectAll();
// _textArea.append( ((char) i) + "");
} catch (Exception e) {
e.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,21 @@ public class RichTextArea extends JTextPane {
Document doc;

public RichTextArea() {

style = new SimpleAttributeSet();
this.setContentType("text/rtf" );
this.setContentType("text/rtf");
this.setEditorKit(new javax.swing.text.rtf.RTFEditorKit());
doc = this.getDocument();
}

public void append(String msg, Color color, Color bgColor, boolean isBold) {
StyleConstants.setForeground(style, color);
StyleConstants.setBackground(style, bgColor);
// StyleConstants.setBackground(style, bgColor);
StyleConstants.setBold(style, isBold);
int len = doc.getLength();
try {
doc.insertString(len, msg, style);
doc.insertString(len, msg, style);
} catch (Exception e) {
System.out.print("Failed to append msg ["+msg+"]" );
System.out.print("Failed to append msg [" + msg + "]");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public static void main(String[] args) {




p11.setTitle("P11");
p12.setTitle("P12");
p21.setTitle("P21");
Expand Down

0 comments on commit 727c77c

Please sign in to comment.