[jboss-cvs] JBossAS SVN: r89052 - in projects/jboss-osgi/trunk: bundle/blueprint/scripts and 11 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue May 19 10:30:51 EDT 2009
Author: thomas.diesler at jboss.com
Date: 2009-05-19 10:30:50 -0400 (Tue, 19 May 2009)
New Revision: 89052
Added:
projects/jboss-osgi/trunk/bundle/blueprint/scripts/
projects/jboss-osgi/trunk/bundle/blueprint/scripts/antrun-test-jars.xml
projects/jboss-osgi/trunk/bundle/blueprint/scripts/assembly-bundles.xml
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/context/
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/context/BlueprintContextTestCase.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/context/bundle/
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/context/bundle/BeanA.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/context/bundle/BeanB.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/context/bundle/ServiceA.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/context/bundle/ServiceB.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicBeansParserTestCase.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicServiceParserTestCase.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/ServiceA.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/ServiceB.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/context/
projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/context/META-INF/
projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/context/META-INF/blueprint/
projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/context/META-INF/blueprint/blueprint-basic-service.xml
projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/context/context-basic.bnd
projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/jboss-osgi-framework.properties
projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/parser/blueprint-basic-service.xml
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/internal/StringPropertyReplacer.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/internal/SysPropertyActions.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/HuskyCapability.java
Log:
Initial integration with Husky
Added: projects/jboss-osgi/trunk/bundle/blueprint/scripts/antrun-test-jars.xml
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/scripts/antrun-test-jars.xml (rev 0)
+++ projects/jboss-osgi/trunk/bundle/blueprint/scripts/antrun-test-jars.xml 2009-05-19 14:30:50 UTC (rev 89052)
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ============================================================ -->
+<!-- JBoss, the OpenSource J2EE webOS -->
+<!-- Distributable under LGPL license. -->
+<!-- See terms of license at http://www.gnu.org. -->
+<!-- ============================================================ -->
+
+<!-- $Id$ -->
+
+<project default="build-test-jars">
+
+ <description>OSGi test archive builder</description>
+
+ <!-- ================================================================== -->
+ <!-- Init -->
+ <!-- ================================================================== -->
+
+ <target name="init">
+
+ <!-- Property override when not called from maven -->
+ <property name="maven.runtime.classpath" value="/usr/java/bnd.jar" />
+ <property name="tests.output.dir" value="${basedir}/../target" />
+
+ <mkdir dir="${tests.output.dir}/test-libs" />
+ <property name="tests.classes.dir" value="${tests.output.dir}/test-classes" />
+ <property name="tests.resources.dir" value="${tests.output.dir}/test-classes" />
+
+ <taskdef resource="aQute/bnd/ant/taskdef.properties">
+ <classpath>
+ <pathelement path="${maven.runtime.classpath}" />
+ </classpath>
+ </taskdef>
+
+ </target>
+
+ <!-- ================================================================== -->
+ <!-- Building -->
+ <!-- ================================================================== -->
+
+ <target name="build-test-jars" depends="init" description="Build the test deployments">
+
+ <!-- Please add alphabetically -->
+
+ <!-- context -->
+ <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/context-basic.jar" files="${tests.resources.dir}/context/context-basic.bnd" />
+
+ <!-- Please add alphabetically -->
+
+ </target>
+
+</project>
Property changes on: projects/jboss-osgi/trunk/bundle/blueprint/scripts/antrun-test-jars.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/bundle/blueprint/scripts/assembly-bundles.xml
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/scripts/assembly-bundles.xml (rev 0)
+++ projects/jboss-osgi/trunk/bundle/blueprint/scripts/assembly-bundles.xml 2009-05-19 14:30:50 UTC (rev 89052)
@@ -0,0 +1,32 @@
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+
+ <id>deploy-artifacts</id>
+ <formats>
+ <format>dir</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <!-- Dependency Sets -->
+ <dependencySets>
+
+ <!-- bundle -->
+ <dependencySet>
+ <outputDirectory>bundles</outputDirectory>
+ <outputFileNameMapping>${artifact.artifactId}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
+ <includes>
+ <include>*:jboss-osgi-common:jar</include>
+ <include>*:jboss-osgi-jmx:jar</include>
+ <include>*:jboss-osgi-husky-harness:jar</include>
+ <include>*:jboss-osgi-logging:jar</include>
+ <include>*:jbossxb-bundle:jar</include>
+ <include>*:org.apache.felix.log:jar</include>
+ <include>*:org.osgi.compendium:jar</include>
+ </includes>
+ <useStrictFiltering>true</useStrictFiltering>
+ <scope>provided</scope>
+ <unpack>false</unpack>
+ </dependencySet>
+
+ </dependencySets>
+</assembly>
Property changes on: projects/jboss-osgi/trunk/bundle/blueprint/scripts/assembly-bundles.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/context/BlueprintContextTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/context/BlueprintContextTestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/context/BlueprintContextTestCase.java 2009-05-19 14:30:50 UTC (rev 89052)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.blueprint.context;
+
+//$Id$
+
+import static org.junit.Assert.assertEquals;
+
+import org.jboss.osgi.husky.BridgeFactory;
+import org.jboss.osgi.husky.annotation.ProvideContext;
+import org.jboss.osgi.spi.testing.HuskyCapability;
+import org.jboss.osgi.spi.testing.JMXCapability;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
+import org.jboss.osgi.spi.testing.OSGiTestHelper;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+
+/**
+ * Blueprint parser tests
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 13-May-2009
+ */
+public class BlueprintContextTestCase
+{
+ @ProvideContext
+ public BundleContext context;
+
+ private OSGiTestHelper helper;
+ private OSGiRuntime runtime;
+
+ @Before
+ public void setUp() throws BundleException
+ {
+ if (context == null)
+ {
+ helper = new OSGiTestHelper();
+ runtime = helper.getEmbeddedRuntime();
+ runtime.addCapability(new JMXCapability());
+ runtime.addCapability(new HuskyCapability());
+
+ runtime.installBundle("context-basic.jar").start();
+ }
+ }
+
+ @After
+ public void tearDown()
+ {
+ if (context == null)
+ {
+ runtime.shutdown();
+ }
+ }
+
+ @Test
+ public void testBlueprintContext() throws Exception
+ {
+ if (context == null)
+ {
+ BridgeFactory.getBridge().run();
+ return;
+ }
+
+ Bundle bundle = context.getBundle();
+ assertEquals("context-basic", bundle.getSymbolicName());
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/context/BlueprintContextTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/context/bundle/BeanA.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/context/bundle/BeanA.java (rev 0)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/context/bundle/BeanA.java 2009-05-19 14:30:50 UTC (rev 89052)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.blueprint.context.bundle;
+
+
+//$Id$
+
+/**
+ * A basic bean
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 13-May-2009
+ */
+public class BeanA
+{
+ private BeanB beanB;
+
+ public BeanB getBeanB()
+ {
+ return beanB;
+ }
+
+ public void setBeanB(BeanB beanB)
+ {
+ this.beanB = beanB;
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/context/bundle/BeanA.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/context/bundle/BeanB.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/context/bundle/BeanB.java (rev 0)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/context/bundle/BeanB.java 2009-05-19 14:30:50 UTC (rev 89052)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.blueprint.context.bundle;
+
+
+//$Id$
+
+/**
+ * A basic bean
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 13-May-2009
+ */
+public class BeanB
+{
+ private BeanA beanA;
+
+ public BeanA getBeanA()
+ {
+ return beanA;
+ }
+
+ public void setBeanA(BeanA beanA)
+ {
+ this.beanA = beanA;
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/context/bundle/BeanB.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/context/bundle/ServiceA.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/context/bundle/ServiceA.java (rev 0)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/context/bundle/ServiceA.java 2009-05-19 14:30:50 UTC (rev 89052)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.blueprint.context.bundle;
+
+//$Id$
+
+/**
+ * A basic service
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 13-May-2009
+ */
+public interface ServiceA
+{
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/context/bundle/ServiceA.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/context/bundle/ServiceB.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/context/bundle/ServiceB.java (rev 0)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/context/bundle/ServiceB.java 2009-05-19 14:30:50 UTC (rev 89052)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.blueprint.context.bundle;
+
+//$Id$
+
+/**
+ * A basic service
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 13-May-2009
+ */
+public interface ServiceB
+{
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/context/bundle/ServiceB.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicBeansParserTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicBeansParserTestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicBeansParserTestCase.java 2009-05-19 14:30:50 UTC (rev 89052)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.blueprint.parser;
+
+//$Id$
+
+import java.net.URL;
+import java.util.List;
+
+import org.jboss.osgi.blueprint.parser.BlueprintParser;
+import org.jboss.osgi.blueprint.reflect.Blueprint;
+import org.jboss.osgi.blueprint.reflect.ComponentMetadataImpl;
+import org.jboss.osgi.spi.testing.OSGiTest;
+import org.osgi.service.blueprint.reflect.BeanMetadata;
+
+/**
+ * Blueprint parser tests
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 13-May-2009
+ */
+public class BasicBeansParserTestCase extends OSGiTest
+{
+ public void testBasicBeans() throws Exception
+ {
+ URL xmlURL = getResourceURL("parser/blueprint-basic-beans.xml");
+ Blueprint blueprint = new BlueprintParser().parse(xmlURL);
+
+ List<ComponentMetadataImpl> compList = blueprint.getComponents();
+ assertTrue(compList.size() > 0);
+
+ BeanMetadata beanA = (BeanMetadata)compList.get(0);
+ assertEquals(BeanA.class.getName(), beanA.getClassName());
+ assertEquals("beanA", beanA.getId());
+
+ BeanMetadata beanB = (BeanMetadata)compList.get(1);
+ assertEquals(BeanB.class.getName(), beanB.getClassName());
+ assertEquals("beanB", beanB.getId());
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicBeansParserTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicServiceParserTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicServiceParserTestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicServiceParserTestCase.java 2009-05-19 14:30:50 UTC (rev 89052)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.blueprint.parser;
+
+//$Id$
+
+import java.net.URL;
+import java.util.List;
+
+import org.jboss.osgi.blueprint.parser.BlueprintParser;
+import org.jboss.osgi.blueprint.reflect.Blueprint;
+import org.jboss.osgi.blueprint.reflect.ComponentMetadataImpl;
+import org.jboss.osgi.spi.testing.OSGiTest;
+import org.osgi.service.blueprint.reflect.BeanMetadata;
+import org.osgi.service.blueprint.reflect.ServiceMetadata;
+
+/**
+ * Blueprint parser tests
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 13-May-2009
+ */
+public class BasicServiceParserTestCase extends OSGiTest
+{
+ public void testBasicBeans() throws Exception
+ {
+ URL xmlURL = getResourceURL("parser/blueprint-basic-service.xml");
+ Blueprint blueprint = new BlueprintParser().parse(xmlURL);
+
+ List<ComponentMetadataImpl> compList = blueprint.getComponents();
+ assertTrue(compList.size() > 0);
+
+ BeanMetadata beanA = (BeanMetadata)compList.get(0);
+ assertEquals(BeanA.class.getName(), beanA.getClassName());
+ assertEquals("beanA", beanA.getId());
+
+ ServiceMetadata serviceA = (ServiceMetadata)compList.get(1);
+ assertEquals("serviceA", serviceA.getId());
+
+ List<String> intfsA = serviceA.getInterfaceNames();
+ assertTrue(intfsA.size() > 0);
+ assertEquals(ServiceA.class.getName(), intfsA.get(0));
+
+ ServiceMetadata serviceB = (ServiceMetadata)compList.get(2);
+ assertEquals("serviceB", serviceB.getId());
+
+ List<String> intfsB = serviceB.getInterfaceNames();
+ assertTrue(intfsB.size() > 0);
+ assertEquals(ServiceB.class.getName(), intfsB.get(0));
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicServiceParserTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/ServiceA.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/ServiceA.java (rev 0)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/ServiceA.java 2009-05-19 14:30:50 UTC (rev 89052)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.blueprint.parser;
+
+//$Id$
+
+/**
+ * A basic service
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 13-May-2009
+ */
+public interface ServiceA
+{
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/ServiceA.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/ServiceB.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/ServiceB.java (rev 0)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/ServiceB.java 2009-05-19 14:30:50 UTC (rev 89052)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.blueprint.parser;
+
+//$Id$
+
+/**
+ * A basic service
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 13-May-2009
+ */
+public interface ServiceB
+{
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/ServiceB.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/context/META-INF/blueprint/blueprint-basic-service.xml
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/context/META-INF/blueprint/blueprint-basic-service.xml (rev 0)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/context/META-INF/blueprint/blueprint-basic-service.xml 2009-05-19 14:30:50 UTC (rev 89052)
@@ -0,0 +1,14 @@
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd schema/blueprint.xsd">
+
+ <bean id="beanA" class="org.jboss.test.osgi.blueprint.context.BeanA">
+ </bean>
+
+ <service id="serviceA" ref="beanA" interface="org.jboss.test.osgi.blueprint.context.ServiceA">
+ </service>
+
+ <service id="serviceB" interface="org.jboss.test.osgi.blueprint.context.ServiceB">
+ <bean class="org.jboss.test.osgi.blueprint.context.BeanB"/>
+ </service>
+
+</blueprint>
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/context/META-INF/blueprint/blueprint-basic-service.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/context/context-basic.bnd
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/context/context-basic.bnd (rev 0)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/context/context-basic.bnd 2009-05-19 14:30:50 UTC (rev 89052)
@@ -0,0 +1,9 @@
+# bnd build -classpath target/test-classes -output target/test-libs/context-basic.jar src/test/resources/context/context-basic.bnd
+
+Bundle-SymbolicName: context-basic
+Export-Package: org.jboss.test.osgi.blueprint.context
+Import-Package: org.jboss.osgi.husky, org.jboss.osgi.husky.annotation, org.jboss.osgi.spi.testing, org.junit, org.osgi.framework
+
+Include-Resource: META-INF/blueprint=META-INF/blueprint
+
+Test-Package: org.jboss.test.osgi.blueprint.context
Added: projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/jboss-osgi-framework.properties
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/jboss-osgi-framework.properties (rev 0)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/jboss-osgi-framework.properties 2009-05-19 14:30:50 UTC (rev 89052)
@@ -0,0 +1,32 @@
+#
+# Properties read by the org.jboss.osgi.spi.framework.PropertiesBootstrapProvider
+#
+# $Id$
+#
+
+# The OSGiFramework implementation
+org.jboss.osgi.spi.framework.impl=org.jboss.osgi.felix.framework.FelixIntegration
+
+# Properties to configure the Framework
+org.osgi.framework.storage=${basedir}/target/osgi-store
+org.osgi.framework.storage.clean=onFirstInit
+
+# Framework bootdelegation
+# org.osgi.framework.bootdelegation=org.osgi.service.log
+
+# Extra System Packages
+org.osgi.framework.system.packages.extra=\
+ org.jboss.logging, \
+ org.jboss.osgi.spi, \
+ org.jboss.osgi.spi.testing, \
+ org.osgi.framework; version\=1.4
+
+# Bundles that need to be installed with the Framework automatically
+org.jboss.osgi.spi.framework.autoInstall=\
+ file://${test.archive.directory}/bundles/org.osgi.compendium.jar
+
+# Bundles that need to be started automatically
+org.jboss.osgi.spi.framework.autoStart=\
+ file://${test.archive.directory}/bundles/org.apache.felix.log.jar \
+ file://${test.archive.directory}/bundles/jboss-osgi-common.jar \
+ file://${test.archive.directory}/bundles/jboss-osgi-logging.jar
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/jboss-osgi-framework.properties
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider (rev 0)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider 2009-05-19 14:30:50 UTC (rev 89052)
@@ -0,0 +1 @@
+org.jboss.osgi.spi.framework.PropertiesBootstrapProvider
\ No newline at end of file
Added: projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/parser/blueprint-basic-service.xml
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/parser/blueprint-basic-service.xml (rev 0)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/parser/blueprint-basic-service.xml 2009-05-19 14:30:50 UTC (rev 89052)
@@ -0,0 +1,14 @@
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd schema/blueprint.xsd">
+
+ <bean id="beanA" class="org.jboss.test.osgi.blueprint.parser.BeanA">
+ </bean>
+
+ <service id="serviceA" ref="beanA" interface="org.jboss.test.osgi.blueprint.parser.ServiceA">
+ </service>
+
+ <service id="serviceB" interface="org.jboss.test.osgi.blueprint.parser.ServiceB">
+ <bean class="org.jboss.test.osgi.blueprint.parser.BeanB"/>
+ </service>
+
+</blueprint>
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/parser/blueprint-basic-service.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/internal/StringPropertyReplacer.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/internal/StringPropertyReplacer.java (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/internal/StringPropertyReplacer.java 2009-05-19 14:30:50 UTC (rev 89052)
@@ -0,0 +1,263 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.spi.internal;
+
+import java.util.Properties;
+import java.io.File;
+
+/**
+ * A utility class for replacing properties in strings.
+ *
+ * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
+ * @author <a href="Scott.Stark at jboss.org">Scott Stark</a>
+ * @author <a href="claudio.vesco at previnet.it">Claudio Vesco</a>
+ * @author <a href="mailto:adrian at jboss.com">Adrian Brock</a>
+ * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
+ * @version <tt>$Revision$</tt>
+ */
+public final class StringPropertyReplacer
+{
+ /** New line string constant */
+ public static final String NEWLINE = SysPropertyActions.getProperty("line.separator", "\n");
+
+ /** File separator value */
+ private static final String FILE_SEPARATOR = File.separator;
+
+ /** Path separator value */
+ private static final String PATH_SEPARATOR = File.pathSeparator;
+
+ /** File separator alias */
+ private static final String FILE_SEPARATOR_ALIAS = "/";
+
+ /** Path separator alias */
+ private static final String PATH_SEPARATOR_ALIAS = ":";
+
+ // States used in property parsing
+ private static final int NORMAL = 0;
+ private static final int SEEN_DOLLAR = 1;
+ private static final int IN_BRACKET = 2;
+
+ /**
+ * Go through the input string and replace any occurance of ${p} with
+ * the System.getProperty(p) value. If there is no such property p defined,
+ * then the ${p} reference will remain unchanged.
+ *
+ * If the property reference is of the form ${p:v} and there is no such property p,
+ * then the default value v will be returned.
+ *
+ * If the property reference is of the form ${p1,p2} or ${p1,p2:v} then
+ * the primary and the secondary properties will be tried in turn, before
+ * returning either the unchanged input, or the default value.
+ *
+ * The property ${/} is replaced with System.getProperty("file.separator")
+ * value and the property ${:} is replaced with System.getProperty("path.separator").
+ *
+ * @param string - the string with possible ${} references
+ * @return the input string with all property references replaced if any.
+ * If there are no valid references the input string will be returned.
+ */
+ public static String replaceProperties(final String string)
+ {
+ return replaceProperties(string, null);
+ }
+
+ /**
+ * Go through the input string and replace any occurance of ${p} with
+ * the props.getProperty(p) value. If there is no such property p defined,
+ * then the ${p} reference will remain unchanged.
+ *
+ * If the property reference is of the form ${p:v} and there is no such property p,
+ * then the default value v will be returned.
+ *
+ * If the property reference is of the form ${p1,p2} or ${p1,p2:v} then
+ * the primary and the secondary properties will be tried in turn, before
+ * returning either the unchanged input, or the default value.
+ *
+ * The property ${/} is replaced with System.getProperty("file.separator")
+ * value and the property ${:} is replaced with System.getProperty("path.separator").
+ *
+ * @param string - the string with possible ${} references
+ * @param props - the source for ${x} property ref values, null means use System.getProperty()
+ * @return the input string with all property references replaced if any.
+ * If there are no valid references the input string will be returned.
+ */
+ public static String replaceProperties(final String string, final Properties props)
+ {
+ final char[] chars = string.toCharArray();
+ StringBuffer buffer = new StringBuffer();
+ boolean properties = false;
+ int state = NORMAL;
+ int start = 0;
+ for (int i = 0; i < chars.length; ++i)
+ {
+ char c = chars[i];
+
+ // Dollar sign outside brackets
+ if (c == '$' && state != IN_BRACKET)
+ state = SEEN_DOLLAR;
+
+ // Open bracket immediatley after dollar
+ else if (c == '{' && state == SEEN_DOLLAR)
+ {
+ buffer.append(string.substring(start, i - 1));
+ state = IN_BRACKET;
+ start = i - 1;
+ }
+
+ // No open bracket after dollar
+ else if (state == SEEN_DOLLAR)
+ state = NORMAL;
+
+ // Closed bracket after open bracket
+ else if (c == '}' && state == IN_BRACKET)
+ {
+ // No content
+ if (start + 2 == i)
+ {
+ buffer.append("${}"); // REVIEW: Correct?
+ }
+ else // Collect the system property
+ {
+ String value = null;
+
+ String key = string.substring(start + 2, i);
+
+ // check for alias
+ if (FILE_SEPARATOR_ALIAS.equals(key))
+ {
+ value = FILE_SEPARATOR;
+ }
+ else if (PATH_SEPARATOR_ALIAS.equals(key))
+ {
+ value = PATH_SEPARATOR;
+ }
+ else
+ {
+ // check from the properties
+ if (props != null)
+ value = props.getProperty(key);
+ else
+ value = System.getProperty(key);
+
+ if (value == null)
+ {
+ // Check for a default value ${key:default}
+ int colon = key.indexOf(':');
+ if (colon > 0)
+ {
+ String realKey = key.substring(0, colon);
+ if (props != null)
+ value = props.getProperty(realKey);
+ else
+ value = System.getProperty(realKey);
+
+ if (value == null)
+ {
+ // Check for a composite key, "key1,key2"
+ value = resolveCompositeKey(realKey, props);
+
+ // Not a composite key either, use the specified default
+ if (value == null)
+ value = key.substring(colon+1);
+ }
+ }
+ else
+ {
+ // No default, check for a composite key, "key1,key2"
+ value = resolveCompositeKey(key, props);
+ }
+ }
+ }
+
+ if (value != null)
+ {
+ properties = true;
+ buffer.append(value);
+ }
+ else
+ {
+ buffer.append("${");
+ buffer.append(key);
+ buffer.append('}');
+ }
+
+ }
+ start = i + 1;
+ state = NORMAL;
+ }
+ }
+
+ // No properties
+ if (properties == false)
+ return string;
+
+ // Collect the trailing characters
+ if (start != chars.length)
+ buffer.append(string.substring(start, chars.length));
+
+ // Done
+ return buffer.toString();
+ }
+
+ /**
+ * Try to resolve a "key" from the provided properties by
+ * checking if it is actually a "key1,key2", in which case
+ * try first "key1", then "key2". If all fails, return null.
+ *
+ * It also accepts "key1," and ",key2".
+ *
+ * @param key the key to resolve
+ * @param props the properties to use
+ * @return the resolved key or null
+ */
+ private static String resolveCompositeKey(String key, Properties props)
+ {
+ String value = null;
+
+ // Look for the comma
+ int comma = key.indexOf(',');
+ if (comma > -1)
+ {
+ // If we have a first part, try resolve it
+ if (comma > 0)
+ {
+ // Check the first part
+ String key1 = key.substring(0, comma);
+ if (props != null)
+ value = props.getProperty(key1);
+ else
+ value = System.getProperty(key1);
+ }
+ // Check the second part, if there is one and first lookup failed
+ if (value == null && comma < key.length() - 1)
+ {
+ String key2 = key.substring(comma + 1);
+ if (props != null)
+ value = props.getProperty(key2);
+ else
+ value = System.getProperty(key2);
+ }
+ }
+ // Return whatever we've found or null
+ return value;
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/internal/StringPropertyReplacer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/internal/SysPropertyActions.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/internal/SysPropertyActions.java (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/internal/SysPropertyActions.java 2009-05-19 14:30:50 UTC (rev 89052)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.spi.internal;
+
+// $Id$
+
+import java.security.PrivilegedAction;
+import java.security.AccessController;
+
+/**
+ * Priviledged actions for the package
+ *
+ * @author Scott.Stark at jboss.org
+ */
+ at SuppressWarnings("unchecked")
+class SysPropertyActions
+{
+ interface SysProps
+ {
+ SysProps NON_PRIVILEDGED = new SysProps()
+ {
+ public String getProperty(final String name, final String defaultValue)
+ {
+ return System.getProperty(name, defaultValue);
+ }
+ };
+ SysProps PRIVILEDGED = new SysProps()
+ {
+ public String getProperty(final String name, final String defaultValue)
+ {
+ PrivilegedAction action = new PrivilegedAction()
+ {
+ public Object run()
+ {
+ return System.getProperty(name, defaultValue);
+ }
+ };
+ return (String)AccessController.doPrivileged(action);
+ }
+ };
+
+ String getProperty(String name, String defaultValue);
+ }
+
+ public static String getProperty(String name, String defaultValue)
+ {
+ String prop;
+ if (System.getSecurityManager() == null)
+ prop = SysProps.NON_PRIVILEDGED.getProperty(name, defaultValue);
+ else
+ prop = SysProps.PRIVILEDGED.getProperty(name, defaultValue);
+ return prop;
+ }
+}
Property changes on: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/internal/SysPropertyActions.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/HuskyCapability.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/HuskyCapability.java (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/HuskyCapability.java 2009-05-19 14:30:50 UTC (rev 89052)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.spi.testing;
+
+//$Id$
+
+import java.util.Properties;
+
+
+/**
+ * [TODO]
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 05-May-2009
+ */
+public class HuskyCapability extends Capability
+{
+ public HuskyCapability()
+ {
+ Properties props = getProperties();
+ //props.setProperty("org.jboss.osgi.jmx.host", System.getProperty("jboss.bind.address", "localhost"));
+ //props.setProperty("org.jboss.osgi.jmx.rmi.port", "1198");
+
+ addBundle("bundles/jboss-osgi-husky-harness.jar");
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/HuskyCapability.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
More information about the jboss-cvs-commits
mailing list