You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ds...@apache.org on 2009/07/21 20:51:41 UTC
svn commit: r796467 [7/25] - in /felix/trunk/sigil:
common/core.tests/src/org/apache/felix/sigil/core/
common/core/src/org/apache/felix/sigil/bnd/
common/core/src/org/apache/felix/sigil/config/
common/core/src/org/apache/felix/sigil/core/ common/core/s...
Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/common/Or.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/common/Or.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/common/Or.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/common/Or.java Tue Jul 21 18:51:33 2009
@@ -19,9 +19,12 @@
package org.apache.felix.sigil.model.common;
+
import java.util.Map;
-public class Or implements LDAPExpr {
+
+public class Or implements LDAPExpr
+{
/**
*
@@ -29,72 +32,98 @@
private static final long serialVersionUID = 1L;
private LDAPExpr[] children;
- public static LDAPExpr apply(LDAPExpr... terms) {
- if (terms == null) {
- throw new NullPointerException("terms cannot be null");
+
+ public static LDAPExpr apply( LDAPExpr... terms )
+ {
+ if ( terms == null )
+ {
+ throw new NullPointerException( "terms cannot be null" );
}
- else if (terms.length == 0) {
+ else if ( terms.length == 0 )
+ {
return Expressions.T;
}
- else if (terms.length == 1) {
+ else if ( terms.length == 1 )
+ {
return terms[0];
}
LDAPExpr[] filtered = new LDAPExpr[terms.length];
int ctr = 0;
- for (int i = 0; i < terms.length; i++) {
- if (terms[i].equals(Expressions.T))
+ for ( int i = 0; i < terms.length; i++ )
+ {
+ if ( terms[i].equals( Expressions.T ) )
return Expressions.T;
- if (terms[i].equals(Expressions.F))
+ if ( terms[i].equals( Expressions.F ) )
continue;
filtered[ctr] = terms[i];
ctr++;
}
- if (ctr == 0) {
+ if ( ctr == 0 )
+ {
return Expressions.F;
}
- else if (ctr == 1) {
+ else if ( ctr == 1 )
+ {
return filtered[0];
}
LDAPExpr[] orTerms = new LDAPExpr[ctr];
- System.arraycopy(filtered, 0, orTerms, 0, ctr);
+ System.arraycopy( filtered, 0, orTerms, 0, ctr );
- return new Or(orTerms);
+ return new Or( orTerms );
}
- private Or(LDAPExpr... children) {
+
+ private Or( LDAPExpr... children )
+ {
this.children = children;
}
- public boolean eval(Map<String, ?> map) {
- for (int i = 0; i < children.length; i++) {
- if (children[i].eval(map)) {
+
+ public boolean eval( Map<String, ?> map )
+ {
+ for ( int i = 0; i < children.length; i++ )
+ {
+ if ( children[i].eval( map ) )
+ {
return true;
}
}
return false;
}
- public void visit(ExprVisitor v) {
- v.visitOr(this);
+
+ public void visit( ExprVisitor v )
+ {
+ v.visitOr( this );
}
- public LDAPExpr[] getChildren() {
+
+ public LDAPExpr[] getChildren()
+ {
return children;
}
- public void setChildren(LDAPExpr[] children) {
+
+ public void setChildren( LDAPExpr[] children )
+ {
this.children = children;
}
+
@Override
- public boolean equals(Object other) {
- if (other instanceof Or) {
- Or that = (Or) other;
- if (children.length != that.children.length) {
+ public boolean equals( Object other )
+ {
+ if ( other instanceof Or )
+ {
+ Or that = ( Or ) other;
+ if ( children.length != that.children.length )
+ {
return false;
}
- for (int i = 0; i < children.length; i++) {
- if (children[i].equals(that.children[i])) {
+ for ( int i = 0; i < children.length; i++ )
+ {
+ if ( children[i].equals( that.children[i] ) )
+ {
return true;
}
}
@@ -103,14 +132,17 @@
return false;
}
+
@Override
- public String toString() {
- StringBuffer buf = new StringBuffer(256);
- buf.append("(|");
- for (int i = 0; i < children.length; i++) {
- buf.append(" ").append(children[i]).append(" ");
+ public String toString()
+ {
+ StringBuffer buf = new StringBuffer( 256 );
+ buf.append( "(|" );
+ for ( int i = 0; i < children.length; i++ )
+ {
+ buf.append( " " ).append( children[i] ).append( " " );
}
- buf.append(")");
+ buf.append( ")" );
return buf.toString();
}
Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/common/ParseState.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/common/ParseState.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/common/ParseState.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/common/ParseState.java Tue Jul 21 18:51:33 2009
@@ -19,13 +19,16 @@
package org.apache.felix.sigil.model.common;
+
import java.io.Serializable;
+
/**
* @author dave
*
*/
-class ParseState implements Serializable {
+class ParseState implements Serializable
+{
/**
*
*/
@@ -35,48 +38,67 @@
String str;
- ParseState(String str) {
+
+ ParseState( String str )
+ {
this.str = str;
}
- public boolean lookingAt(String start) {
- return str.substring(pos).startsWith(start);
+
+ public boolean lookingAt( String start )
+ {
+ return str.substring( pos ).startsWith( start );
}
- public CharSequence skip(int n) {
+
+ public CharSequence skip( int n )
+ {
int end = pos + n < str.length() ? pos + n : str.length();
int start = pos;
pos = end;
- return str.subSequence(start, end);
+ return str.subSequence( start, end );
}
- public char read() {
- char ch = str.charAt(pos);
- if (pos < str.length()) {
+
+ public char read()
+ {
+ char ch = str.charAt( pos );
+ if ( pos < str.length() )
+ {
pos++;
}
return ch;
}
- public char readAndSkipWhiteSpace() {
+
+ public char readAndSkipWhiteSpace()
+ {
char ch = read();
skipWhitespace();
return ch;
}
- char peek() {
- if (isEndOfString()) {
- return (char) -1;
+
+ char peek()
+ {
+ if ( isEndOfString() )
+ {
+ return ( char ) -1;
}
- return str.charAt(pos);
+ return str.charAt( pos );
}
- boolean isEndOfString() {
+
+ boolean isEndOfString()
+ {
return pos == str.length();
}
- void skipWhitespace() {
- while (pos < str.length() && Character.isWhitespace(str.charAt(pos))) {
+
+ void skipWhitespace()
+ {
+ while ( pos < str.length() && Character.isWhitespace( str.charAt( pos ) ) )
+ {
pos++;
}
}
Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/common/SimpleTerm.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/common/SimpleTerm.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/common/SimpleTerm.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/common/SimpleTerm.java Tue Jul 21 18:51:33 2009
@@ -19,261 +19,333 @@
package org.apache.felix.sigil.model.common;
+
import java.lang.reflect.Constructor;
import java.util.Iterator;
import java.util.Map;
import java.util.Vector;
-public class SimpleTerm implements LDAPExpr {
+
+public class SimpleTerm implements LDAPExpr
+{
/**
*
*/
private static final long serialVersionUID = 1L;
public static final char WILDCARD = 2 ^ 16 - 1;
- private static final String WILDCARD_STRING = new String(new char[] { SimpleTerm.WILDCARD });
+ private static final String WILDCARD_STRING = new String( new char[]
+ { SimpleTerm.WILDCARD } );
private Ops op;
private String name;
private String rval;
- public SimpleTerm(String name, Ops op, String value) {
+
+ public SimpleTerm( String name, Ops op, String value )
+ {
this.op = op;
this.name = name.intern();
this.rval = value.intern();
}
- public String getName() {
+
+ public String getName()
+ {
return name;
}
- public Ops getOp() {
+
+ public Ops getOp()
+ {
return op;
}
- public String getRval() {
+
+ public String getRval()
+ {
return rval;
}
- public boolean eval(Map<String, ?> map) {
- Object lval = map.get(name);
- if (lval == null) {
+ public boolean eval( Map<String, ?> map )
+ {
+
+ Object lval = map.get( name );
+ if ( lval == null )
+ {
return false;
}
- else if (Ops.EQ == op && WILDCARD_STRING.equals(lval)) {
+ else if ( Ops.EQ == op && WILDCARD_STRING.equals( lval ) )
+ {
return true;
}
// any match in the vector will do
- else if (lval instanceof Vector<?>) {
- Vector<?> vec = (Vector<?>) lval;
- for (Iterator<?> i = vec.iterator(); i.hasNext();) {
- if (check(i.next())) {
+ else if ( lval instanceof Vector<?> )
+ {
+ Vector<?> vec = ( Vector<?> ) lval;
+ for ( Iterator<?> i = vec.iterator(); i.hasNext(); )
+ {
+ if ( check( i.next() ) )
+ {
return true;
}
}
return false;
}
// any match in the array will do
- else if (lval instanceof Object[]) {
- Object[] arr = (Object[]) lval;
- for (int i = 0; i < arr.length; i++) {
- if (check(arr[i])) {
+ else if ( lval instanceof Object[] )
+ {
+ Object[] arr = ( Object[] ) lval;
+ for ( int i = 0; i < arr.length; i++ )
+ {
+ if ( check( arr[i] ) )
+ {
return true;
}
}
return false;
}
- return check(lval);
+ return check( lval );
}
+
@SuppressWarnings("unchecked")
- private boolean check(Object lval) {
- if (lval == null) {
+ private boolean check( Object lval )
+ {
+ if ( lval == null )
+ {
return false;
}
- else if (Ops.EQ == op && WILDCARD_STRING.equals(lval)) {
+ else if ( Ops.EQ == op && WILDCARD_STRING.equals( lval ) )
+ {
return true;
}
Object rhs = null;
- if (lval instanceof String) {
+ if ( lval instanceof String )
+ {
- if (Ops.APPROX == op) {
- rhs = collapseWhiteSpace(rval);
- lval = collapseWhiteSpace((String) lval);
+ if ( Ops.APPROX == op )
+ {
+ rhs = collapseWhiteSpace( rval );
+ lval = collapseWhiteSpace( ( String ) lval );
}
- if (Ops.EQ == op || Ops.APPROX == op) {
- return stringCheck((String) lval);
+ if ( Ops.EQ == op || Ops.APPROX == op )
+ {
+ return stringCheck( ( String ) lval );
}
// rhs already a string
}
- else if (lval.getClass() == Byte.class) {
- rhs = Byte.valueOf(rval);
- }
- else if (lval.getClass() == Short.class) {
- rhs = Short.valueOf(rval);
- }
- else if (lval.getClass() == Integer.class) {
- rhs = Integer.valueOf(rval);
- }
- else if (lval.getClass() == Long.class) {
- rhs = Long.valueOf(rval);
- }
- else if (lval.getClass() == Float.class) {
- rhs = Float.valueOf(rval);
- }
- else if (lval.getClass() == Double.class) {
- rhs = Double.valueOf(rval);
- }
- else {
- try {
- Constructor<?> stringCtor = lval.getClass().getConstructor(new Class[] { String.class });
- rhs = stringCtor.newInstance(rval);
+ else if ( lval.getClass() == Byte.class )
+ {
+ rhs = Byte.valueOf( rval );
+ }
+ else if ( lval.getClass() == Short.class )
+ {
+ rhs = Short.valueOf( rval );
+ }
+ else if ( lval.getClass() == Integer.class )
+ {
+ rhs = Integer.valueOf( rval );
+ }
+ else if ( lval.getClass() == Long.class )
+ {
+ rhs = Long.valueOf( rval );
+ }
+ else if ( lval.getClass() == Float.class )
+ {
+ rhs = Float.valueOf( rval );
+ }
+ else if ( lval.getClass() == Double.class )
+ {
+ rhs = Double.valueOf( rval );
+ }
+ else
+ {
+ try
+ {
+ Constructor<?> stringCtor = lval.getClass().getConstructor( new Class[]
+ { String.class } );
+ rhs = stringCtor.newInstance( rval );
}
- catch (Exception e) {
+ catch ( Exception e )
+ {
// log it
e.printStackTrace();
return false;
}
}
- if (!(lval instanceof Comparable)) {
- return Ops.EQ == op && lval.equals(rval);
- }
- else {
-
- Comparable<? super Object> lhs = (Comparable<? super Object>) lval;
-
- int compare = lhs.compareTo(rhs);
-
- switch (op) {
- case EQ:
- return compare == 0;
- case APPROX:
- return compare == 0;
- case GE:
- return compare >= 0;
- case LE:
- return compare <= 0;
- case GT:
- return compare > 0;
- case LT:
- return compare < 0;
+ if ( !( lval instanceof Comparable ) )
+ {
+ return Ops.EQ == op && lval.equals( rval );
+ }
+ else
+ {
+
+ Comparable<? super Object> lhs = ( Comparable<? super Object> ) lval;
+
+ int compare = lhs.compareTo( rhs );
+
+ switch ( op )
+ {
+ case EQ:
+ return compare == 0;
+ case APPROX:
+ return compare == 0;
+ case GE:
+ return compare >= 0;
+ case LE:
+ return compare <= 0;
+ case GT:
+ return compare > 0;
+ case LT:
+ return compare < 0;
}
}
return false;
}
- private boolean stringCheck(String lhs) {
+
+ private boolean stringCheck( String lhs )
+ {
String rhs;
- switch (op) {
- case EQ:
- case APPROX:
- rhs = rval;
- break;
- default:
- return false;
+ switch ( op )
+ {
+ case EQ:
+ case APPROX:
+ rhs = rval;
+ break;
+ default:
+ return false;
}
int valLength = lhs.length();
int patLength = rval.length();
- if (valLength == 0 && patLength == 0) {
+ if ( valLength == 0 && patLength == 0 )
+ {
return true;
}
boolean wc = false;
int j = 0;
- for (int i = 0; i < patLength; i++) {
+ for ( int i = 0; i < patLength; i++ )
+ {
// trailing wildcards
- char pc = rhs.charAt(i);
- if (j == valLength) {
- if (pc != SimpleTerm.WILDCARD) {
+ char pc = rhs.charAt( i );
+ if ( j == valLength )
+ {
+ if ( pc != SimpleTerm.WILDCARD )
+ {
return false;
}
continue;
}
- if (pc == SimpleTerm.WILDCARD) {
+ if ( pc == SimpleTerm.WILDCARD )
+ {
wc = true;
continue;
}
- while (wc && j < valLength - 1 && lhs.charAt(j) != pc) {
+ while ( wc && j < valLength - 1 && lhs.charAt( j ) != pc )
+ {
j++;
}
- if (lhs.charAt(j) != pc) {
+ if ( lhs.charAt( j ) != pc )
+ {
return false;
}
- else {
+ else
+ {
wc = false;
j++;
}
}
- return (wc || j == valLength);
+ return ( wc || j == valLength );
}
- private String collapseWhiteSpace(String in) {
- StringBuffer out = new StringBuffer(in.trim().length());
+
+ private String collapseWhiteSpace( String in )
+ {
+ StringBuffer out = new StringBuffer( in.trim().length() );
boolean white = false;
- for (int i = 0; i < in.length(); i++) {
- char ch = in.charAt(i);
- if (Character.isWhitespace(ch)) {
+ for ( int i = 0; i < in.length(); i++ )
+ {
+ char ch = in.charAt( i );
+ if ( Character.isWhitespace( ch ) )
+ {
white = true;
}
- else {
- if (white) {
- out.append(" ");
+ else
+ {
+ if ( white )
+ {
+ out.append( " " );
white = false;
}
- out.append(ch);
+ out.append( ch );
}
}
return out.toString();
}
- public void visit(ExprVisitor v) {
- v.visitSimple(this);
+
+ public void visit( ExprVisitor v )
+ {
+ v.visitSimple( this );
}
- public LDAPExpr[] getChildren() {
+
+ public LDAPExpr[] getChildren()
+ {
return CHILDLESS;
}
+
@Override
- public boolean equals(Object other) {
- if (other instanceof SimpleTerm) {
- SimpleTerm that = (SimpleTerm) other;
- return name.equals(that.name) && op.equals(that.op) && rval.equals(that.rval);
+ public boolean equals( Object other )
+ {
+ if ( other instanceof SimpleTerm )
+ {
+ SimpleTerm that = ( SimpleTerm ) other;
+ return name.equals( that.name ) && op.equals( that.op ) && rval.equals( that.rval );
}
return false;
}
+
@Override
- public String toString() {
- return "(" + name + " " + op.toString() + " " + escape(rval) + ")";
+ public String toString()
+ {
+ return "(" + name + " " + op.toString() + " " + escape( rval ) + ")";
}
- private String escape(String raw) {
- StringBuffer buf = new StringBuffer(raw.length() + 10);
- for (int i = 0; i < raw.length(); i++) {
- char ch = raw.charAt(i);
- switch (ch) {
- case SimpleTerm.WILDCARD:
- buf.append("*");
- break;
- case '(':
- case ')':
- case '*':
- buf.append("\\").append(ch);
- break;
- default:
- buf.append(ch);
+
+ private String escape( String raw )
+ {
+ StringBuffer buf = new StringBuffer( raw.length() + 10 );
+ for ( int i = 0; i < raw.length(); i++ )
+ {
+ char ch = raw.charAt( i );
+ switch ( ch )
+ {
+ case SimpleTerm.WILDCARD:
+ buf.append( "*" );
+ break;
+ case '(':
+ case ')':
+ case '*':
+ buf.append( "\\" ).append( ch );
+ break;
+ default:
+ buf.append( ch );
}
}
return buf.toString();
Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/common/Utils.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/common/Utils.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/common/Utils.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/common/Utils.java Tue Jul 21 18:51:33 2009
@@ -19,52 +19,66 @@
package org.apache.felix.sigil.model.common;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-public class Utils {
- public static MapBuilder map(String name, Object value) {
- return new MapBuilder().put(name, value);
+
+public class Utils
+{
+ public static MapBuilder map( String name, Object value )
+ {
+ return new MapBuilder().put( name, value );
}
- public static String toString(Map<String, Object> attrs) {
- if (attrs == null) {
+
+ public static String toString( Map<String, Object> attrs )
+ {
+ if ( attrs == null )
+ {
return "NULL";
}
- StringBuffer buf = new StringBuffer(128);
- List<String> keys = new ArrayList<String>(attrs.keySet());
- Collections.sort(keys);
- buf.append("{");
-
- for (int i = 0; i < keys.size(); i++) {
- Object name = keys.get(i);
- Object value = attrs.get(name);
- buf.append(name).append("=").append(value).append(",");
+ StringBuffer buf = new StringBuffer( 128 );
+ List<String> keys = new ArrayList<String>( attrs.keySet() );
+ Collections.sort( keys );
+ buf.append( "{" );
+
+ for ( int i = 0; i < keys.size(); i++ )
+ {
+ Object name = keys.get( i );
+ Object value = attrs.get( name );
+ buf.append( name ).append( "=" ).append( value ).append( "," );
}
- if (buf.length() > 1) {
- buf.delete(buf.length() - 1, buf.length());
+ if ( buf.length() > 1 )
+ {
+ buf.delete( buf.length() - 1, buf.length() );
}
- buf.append("}");
+ buf.append( "}" );
return buf.toString();
}
- public static class MapBuilder {
+ public static class MapBuilder
+ {
private Map<String, Object> map = new HashMap<String, Object>();
- public MapBuilder put(String name, Object value) {
- map.put(name, value);
+
+ public MapBuilder put( String name, Object value )
+ {
+ map.put( name, value );
return this;
}
- public Map<String, Object> toMap() {
+
+ public Map<String, Object> toMap()
+ {
return map;
}
}
Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/common/VersionRange.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/common/VersionRange.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/common/VersionRange.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/common/VersionRange.java Tue Jul 21 18:51:33 2009
@@ -19,25 +19,30 @@
package org.apache.felix.sigil.model.common;
+
import java.io.Serializable;
import org.osgi.framework.Version;
-public class VersionRange implements Serializable {
+
+public class VersionRange implements Serializable
+{
/**
*
*/
private static final long serialVersionUID = 1L;
- public static final Version INFINITE_VERSION = new Version(Integer.MAX_VALUE, Integer.MAX_VALUE,
- Integer.MAX_VALUE, "");
- public static final VersionRange ANY_VERSION = new VersionRange(false, Version.emptyVersion, INFINITE_VERSION, true);
+ public static final Version INFINITE_VERSION = new Version( Integer.MAX_VALUE, Integer.MAX_VALUE,
+ Integer.MAX_VALUE, "" );
+ public static final VersionRange ANY_VERSION = new VersionRange( false, Version.emptyVersion, INFINITE_VERSION,
+ true );
private boolean openFloor;
private Version floor;
private Version ceiling;
private boolean openCeiling;
+
/**
* Interval constructor
*
@@ -46,207 +51,253 @@
* @param ceiling The upper bound version of the range.
* @param openCeiling Whether the upper bound of the range is inclusive (false) or exclusive (true).
*/
- public VersionRange(boolean openFloor, Version floor, Version ceiling, boolean openCeiling) {
+ public VersionRange( boolean openFloor, Version floor, Version ceiling, boolean openCeiling )
+ {
this.openFloor = openFloor;
this.floor = floor;
this.ceiling = ceiling;
this.openCeiling = openCeiling;
}
+
/**
* atLeast constructor
*
* @param openFloor
* @param floor
*/
- public VersionRange(Version atLeast) {
+ public VersionRange( Version atLeast )
+ {
this.openFloor = false;
this.floor = atLeast;
this.ceiling = INFINITE_VERSION;
this.openCeiling = true;
}
-
- public static VersionRange parseVersionRange(String val) throws IllegalArgumentException, NumberFormatException {
- if ( val == null || val.trim().length() == 0 ) {
- return ANY_VERSION;
- }
-
+
+
+ public static VersionRange parseVersionRange( String val ) throws IllegalArgumentException, NumberFormatException
+ {
+ if ( val == null || val.trim().length() == 0 )
+ {
+ return ANY_VERSION;
+ }
+
boolean openFloor;
boolean openCeiling;
- val = val.replaceAll("\\s", "");
- val = val.replaceAll("\"", "");
- int fst = val.charAt(0);
- if (fst == '[') {
+ val = val.replaceAll( "\\s", "" );
+ val = val.replaceAll( "\"", "" );
+ int fst = val.charAt( 0 );
+ if ( fst == '[' )
+ {
openFloor = false;
}
- else if (fst == '(') {
+ else if ( fst == '(' )
+ {
openFloor = true;
}
- else {
- Version atLeast = Version.parseVersion(val);
- return new VersionRange(atLeast);
+ else
+ {
+ Version atLeast = Version.parseVersion( val );
+ return new VersionRange( atLeast );
}
- int lst = val.charAt(val.length() - 1);
- if (lst == ']') {
+ int lst = val.charAt( val.length() - 1 );
+ if ( lst == ']' )
+ {
openCeiling = false;
}
- else if (lst == ')') {
+ else if ( lst == ')' )
+ {
openCeiling = true;
}
- else {
- throw new IllegalArgumentException("illegal version range syntax " + val + ": range must end in ')' or ']'");
+ else
+ {
+ throw new IllegalArgumentException( "illegal version range syntax " + val
+ + ": range must end in ')' or ']'" );
+ }
+
+ String inner = val.substring( 1, val.length() - 1 );
+ String[] floorCeiling = inner.split( "," );
+ if ( floorCeiling.length != 2 )
+ {
+ throw new IllegalArgumentException( "illegal version range syntax " + "too many commas" );
}
+ Version floor = Version.parseVersion( floorCeiling[0] );
+ Version ceiling = "*".equals( floorCeiling[1] ) ? INFINITE_VERSION : Version.parseVersion( floorCeiling[1] );
+ return new VersionRange( openFloor, floor, ceiling, openCeiling );
+ }
+
- String inner = val.substring(1, val.length() - 1);
- String[] floorCeiling = inner.split(",");
- if (floorCeiling.length != 2) {
- throw new IllegalArgumentException("illegal version range syntax " + "too many commas");
- }
- Version floor = Version.parseVersion(floorCeiling[0]);
- Version ceiling = "*".equals( floorCeiling[1] ) ? INFINITE_VERSION : Version.parseVersion(floorCeiling[1]);
- return new VersionRange(openFloor, floor, ceiling, openCeiling);
- }
- public Version getCeiling() {
+ public Version getCeiling()
+ {
return ceiling;
}
- public Version getFloor() {
+
+ public Version getFloor()
+ {
return floor;
}
- public boolean isOpenCeiling() {
+
+ public boolean isOpenCeiling()
+ {
return openCeiling;
}
- public boolean isOpenFloor() {
+
+ public boolean isOpenFloor()
+ {
return openFloor;
}
- public boolean isPointVersion() {
- return !openFloor && !openCeiling && floor.equals(ceiling);
+
+ public boolean isPointVersion()
+ {
+ return !openFloor && !openCeiling && floor.equals( ceiling );
}
+
/**
* test a version to see if it falls in the range
*
* @param version
* @return
*/
- public boolean contains(Version version) {
- if (version.equals(INFINITE_VERSION)) {
- return ceiling.equals(INFINITE_VERSION);
- }
- else {
- return (version.compareTo(floor) > 0 && version.compareTo(ceiling) < 0)
- || (!openFloor && version.equals(floor)) || (!openCeiling && version.equals(ceiling));
+ public boolean contains( Version version )
+ {
+ if ( version.equals( INFINITE_VERSION ) )
+ {
+ return ceiling.equals( INFINITE_VERSION );
+ }
+ else
+ {
+ return ( version.compareTo( floor ) > 0 && version.compareTo( ceiling ) < 0 )
+ || ( !openFloor && version.equals( floor ) ) || ( !openCeiling && version.equals( ceiling ) );
}
}
+
@Override
- public int hashCode() {
+ public int hashCode()
+ {
final int prime = 31;
int result = 1;
- result = prime * result + ((ceiling == null) ? 0 : ceiling.hashCode());
- result = prime * result + ((floor == null) ? 0 : floor.hashCode());
- result = prime * result + (openCeiling ? 1231 : 1237);
- result = prime * result + (openFloor ? 1231 : 1237);
+ result = prime * result + ( ( ceiling == null ) ? 0 : ceiling.hashCode() );
+ result = prime * result + ( ( floor == null ) ? 0 : floor.hashCode() );
+ result = prime * result + ( openCeiling ? 1231 : 1237 );
+ result = prime * result + ( openFloor ? 1231 : 1237 );
return result;
}
+
@Override
- public boolean equals(Object obj) {
- if (this == obj)
+ public boolean equals( Object obj )
+ {
+ if ( this == obj )
return true;
- if (obj == null)
+ if ( obj == null )
return false;
- if (getClass() != obj.getClass())
+ if ( getClass() != obj.getClass() )
return false;
- final VersionRange other = (VersionRange) obj;
- if (ceiling == null) {
- if (other.ceiling != null)
+ final VersionRange other = ( VersionRange ) obj;
+ if ( ceiling == null )
+ {
+ if ( other.ceiling != null )
return false;
}
- else if (!ceiling.equals(other.ceiling))
+ else if ( !ceiling.equals( other.ceiling ) )
return false;
- if (floor == null) {
- if (other.floor != null)
+ if ( floor == null )
+ {
+ if ( other.floor != null )
return false;
}
- else if (!floor.equals(other.floor))
+ else if ( !floor.equals( other.floor ) )
return false;
- if (openCeiling != other.openCeiling)
+ if ( openCeiling != other.openCeiling )
return false;
- if (openFloor != other.openFloor)
+ if ( openFloor != other.openFloor )
return false;
return true;
}
+
@Override
- public String toString() {
- if (ANY_VERSION.equals(this)) {
- return makeString(openFloor, Version.emptyVersion, INFINITE_VERSION, openCeiling);
- }
- return makeString(openFloor, floor, ceiling, openCeiling);
+ public String toString()
+ {
+ if ( ANY_VERSION.equals( this ) )
+ {
+ return makeString( openFloor, Version.emptyVersion, INFINITE_VERSION, openCeiling );
+ }
+ return makeString( openFloor, floor, ceiling, openCeiling );
}
- private String makeString(boolean openFloor, Version floor, Version ceiling, boolean openCeiling) {
- StringBuffer vr = new StringBuffer(32);
- if ( INFINITE_VERSION.equals(ceiling) ) {
- vr.append( Version.emptyVersion.equals(floor) ? "0" : floor.toString() );
- }
- else {
- vr.append(openFloor ? "(" : "[");
- String floorStr = Version.emptyVersion.equals(floor) ? "0" : floor.toString();
+
+ private String makeString( boolean openFloor, Version floor, Version ceiling, boolean openCeiling )
+ {
+ StringBuffer vr = new StringBuffer( 32 );
+ if ( INFINITE_VERSION.equals( ceiling ) )
+ {
+ vr.append( Version.emptyVersion.equals( floor ) ? "0" : floor.toString() );
+ }
+ else
+ {
+ vr.append( openFloor ? "(" : "[" );
+ String floorStr = Version.emptyVersion.equals( floor ) ? "0" : floor.toString();
String ceilingStr = ceiling.toString();
- vr.append(floorStr).append(",").append(ceilingStr);
- vr.append(openCeiling ? ")" : "]");
+ vr.append( floorStr ).append( "," ).append( ceilingStr );
+ vr.append( openCeiling ? ")" : "]" );
}
return vr.toString();
}
-
- public static VersionRange newInstance(Version pointVersion, VersionRangeBoundingRule lowerBoundRule, VersionRangeBoundingRule upperBoundRule) {
- Version floor = null;
- switch (lowerBoundRule) {
- case Any:
- floor = new Version(0, 0, 0);
- break;
- case Major:
- floor = new Version(pointVersion.getMajor(), 0, 0);
- break;
- case Minor:
- floor = new Version(pointVersion.getMajor(), pointVersion.getMinor(), 0);
- break;
- case Micro:
- floor = new Version(pointVersion.getMajor(), pointVersion.getMinor(), pointVersion.getMicro());
- break;
- case Exact:
- floor = pointVersion;
- break;
- }
-
- Version ceiling = null;
- boolean openCeiling = true;
- switch (upperBoundRule) {
- case Any:
- ceiling = INFINITE_VERSION;
- break;
- case Major:
- ceiling = new Version(pointVersion.getMajor() + 1, 0, 0);
- break;
- case Minor:
- ceiling = new Version(pointVersion.getMajor(), pointVersion.getMinor() + 1, 0);
- break;
- case Micro:
- ceiling = new Version(pointVersion.getMajor(), pointVersion.getMinor(), pointVersion.getMicro() + 1);
- break;
- case Exact:
- ceiling = pointVersion;
- openCeiling = false;
- break;
- }
-
- return new VersionRange(false, floor, ceiling, openCeiling);
+
+ public static VersionRange newInstance( Version pointVersion, VersionRangeBoundingRule lowerBoundRule,
+ VersionRangeBoundingRule upperBoundRule )
+ {
+ Version floor = null;
+ switch ( lowerBoundRule )
+ {
+ case Any:
+ floor = new Version( 0, 0, 0 );
+ break;
+ case Major:
+ floor = new Version( pointVersion.getMajor(), 0, 0 );
+ break;
+ case Minor:
+ floor = new Version( pointVersion.getMajor(), pointVersion.getMinor(), 0 );
+ break;
+ case Micro:
+ floor = new Version( pointVersion.getMajor(), pointVersion.getMinor(), pointVersion.getMicro() );
+ break;
+ case Exact:
+ floor = pointVersion;
+ break;
+ }
+
+ Version ceiling = null;
+ boolean openCeiling = true;
+ switch ( upperBoundRule )
+ {
+ case Any:
+ ceiling = INFINITE_VERSION;
+ break;
+ case Major:
+ ceiling = new Version( pointVersion.getMajor() + 1, 0, 0 );
+ break;
+ case Minor:
+ ceiling = new Version( pointVersion.getMajor(), pointVersion.getMinor() + 1, 0 );
+ break;
+ case Micro:
+ ceiling = new Version( pointVersion.getMajor(), pointVersion.getMinor(), pointVersion.getMicro() + 1 );
+ break;
+ case Exact:
+ ceiling = pointVersion;
+ openCeiling = false;
+ break;
+ }
+
+ return new VersionRange( false, floor, ceiling, openCeiling );
}
}
Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/common/VersionRangeBoundingRule.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/common/VersionRangeBoundingRule.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/common/VersionRangeBoundingRule.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/common/VersionRangeBoundingRule.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,8 @@
package org.apache.felix.sigil.model.common;
-public enum VersionRangeBoundingRule {
- Exact, Micro, Minor, Major, Any
+
+public enum VersionRangeBoundingRule
+{
+ Exact, Micro, Minor, Major, Any
}
\ No newline at end of file
Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/IDownloadJar.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/IDownloadJar.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/IDownloadJar.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/IDownloadJar.java Tue Jul 21 18:51:33 2009
@@ -19,17 +19,25 @@
package org.apache.felix.sigil.model.eclipse;
+
import java.util.Set;
import org.apache.felix.sigil.model.IModelElement;
import org.eclipse.core.runtime.IPath;
-public interface IDownloadJar extends IModelElement {
- void addEntry(IPath entry);
- void removeEntry(IPath entry);
- // XXX bad spelling on purpose so that ModelElementSupport picks up method
- // TODO fix in ModelElementSupport
- Set<IPath> getEntrys();
-
- void clearEntries();
+
+public interface IDownloadJar extends IModelElement
+{
+ void addEntry( IPath entry );
+
+
+ void removeEntry( IPath entry );
+
+
+ // XXX bad spelling on purpose so that ModelElementSupport picks up method
+ // TODO fix in ModelElementSupport
+ Set<IPath> getEntrys();
+
+
+ void clearEntries();
}
Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/ILibrary.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/ILibrary.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/ILibrary.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/ILibrary.java Tue Jul 21 18:51:33 2009
@@ -19,18 +19,33 @@
package org.apache.felix.sigil.model.eclipse;
+
import java.util.Collection;
import org.apache.felix.sigil.model.IModelElement;
import org.apache.felix.sigil.model.osgi.IPackageImport;
import org.osgi.framework.Version;
-public interface ILibrary extends IModelElement {
- String getName();
- void setName(String name);
- Version getVersion();
- void setVersion(Version version);
- void addImport(IPackageImport pi);
- void removeImport(IPackageImport pi);
- Collection<IPackageImport> getImports();
+
+public interface ILibrary extends IModelElement
+{
+ String getName();
+
+
+ void setName( String name );
+
+
+ Version getVersion();
+
+
+ void setVersion( Version version );
+
+
+ void addImport( IPackageImport pi );
+
+
+ void removeImport( IPackageImport pi );
+
+
+ Collection<IPackageImport> getImports();
}
Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/ILibraryImport.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/ILibraryImport.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/ILibraryImport.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/ILibraryImport.java Tue Jul 21 18:51:33 2009
@@ -19,12 +19,21 @@
package org.apache.felix.sigil.model.eclipse;
+
import org.apache.felix.sigil.model.IModelElement;
import org.apache.felix.sigil.model.common.VersionRange;
-public interface ILibraryImport extends IModelElement {
- String getLibraryName();
- void setLibraryName(String name);
- VersionRange getVersions();
- void setVersions(VersionRange range);
+
+public interface ILibraryImport extends IModelElement
+{
+ String getLibraryName();
+
+
+ void setLibraryName( String name );
+
+
+ VersionRange getVersions();
+
+
+ void setVersions( VersionRange range );
}
Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/INewtonSystem.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/INewtonSystem.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/INewtonSystem.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/INewtonSystem.java Tue Jul 21 18:51:33 2009
@@ -19,15 +19,19 @@
package org.apache.felix.sigil.model.eclipse;
+
import org.apache.felix.sigil.model.IModelElement;
import org.eclipse.core.runtime.IPath;
+
/**
* @author dave
*
*/
-public interface INewtonSystem extends IModelElement {
+public interface INewtonSystem extends IModelElement
+{
IPath getLocation();
-
- void setLocation(IPath location);
+
+
+ void setLocation( IPath location );
}
Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/ISCAComposite.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/ISCAComposite.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/ISCAComposite.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/ISCAComposite.java Tue Jul 21 18:51:33 2009
@@ -19,15 +19,19 @@
package org.apache.felix.sigil.model.eclipse;
+
import org.apache.felix.sigil.model.IModelElement;
import org.eclipse.core.runtime.IPath;
+
/**
* @author dave
*
*/
-public interface ISCAComposite extends IModelElement {
+public interface ISCAComposite extends IModelElement
+{
IPath getLocation();
-
- void setLocation(IPath location);
+
+
+ void setLocation( IPath location );
}
\ No newline at end of file
Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/ISigilBundle.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/ISigilBundle.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/ISigilBundle.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/ISigilBundle.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
package org.apache.felix.sigil.model.eclipse;
+
import java.io.IOException;
import java.util.Set;
@@ -30,112 +31,148 @@
import org.apache.felix.sigil.model.osgi.IPackageImport;
import org.apache.felix.sigil.model.osgi.IVersionedModelElement;
+
/**
* @author dave
*
*/
-public interface ISigilBundle extends ICompoundModelElement, IVersionedModelElement {
- void synchronize(IProgressMonitor monitor) throws IOException;
-
- boolean isSynchronized();
-
+public interface ISigilBundle extends ICompoundModelElement, IVersionedModelElement
+{
+ void synchronize( IProgressMonitor monitor ) throws IOException;
+
+
+ boolean isSynchronized();
+
+
IBundleModelElement getBundleInfo();
-
- String getSymbolicName();
-
- void setBundleInfo(IBundleModelElement bundle);
-
+
+
+ String getSymbolicName();
+
+
+ void setBundleInfo( IBundleModelElement bundle );
+
+
IDownloadJar getDownloadJar();
-
- void setDownloadJar(IDownloadJar download);
-
- void addComposite(ISCAComposite composite);
-
- void removeComposite(ISCAComposite composite);
-
+
+
+ void setDownloadJar( IDownloadJar download );
+
+
+ void addComposite( ISCAComposite composite );
+
+
+ void removeComposite( ISCAComposite composite );
+
+
Set<ISCAComposite> getComposites();
- void addLibraryPath(IPath path);
- void removeLibraryPath(IPath path);
+ void addLibraryPath( IPath path );
+
+
+ void removeLibraryPath( IPath path );
+
Set<IPath> getLibraryPaths();
- void addSourcePath(IPath path);
- void removeSourcePath(IPath path);
+ void addSourcePath( IPath path );
+
+
+ void removeSourcePath( IPath path );
+
Set<IPath> getSourcePaths();
- void clearSourcePaths();
- Set<String> getClasspathEntrys();
-
- void addClasspathEntry(String encodedClasspath);
-
- void removeClasspathEntry(String encodedClasspath);
-
- IPath getLocation();
-
- void setLocation(IPath location);
-
- IPath getSourcePathLocation();
-
- void setSourcePathLocation( IPath location );
-
- IPath getSourceRootPath();
-
- void setSourceRootPath( IPath location );
-
- void setLicencePathLocation(IPath cacheSourceLocation);
-
- IPath getLicencePathLocation();
-
- /**
- * get package names included in bundle.
- * Can contain wildcards e.g. org.foo.*
- */
- Set<String> getPackages();
-
- /**
- * remove package name from those included in bundle.
- */
- boolean removePackage(String pkg);
-
- /**
- * add package name to be included in bundle.
- */
- void addPackage(String pkg);
-
-
- /**
- * get package names included in download jar.
- * Can contain wildcards e.g. org.foo.*
- */
- Set<String> getDownloadPackages();
-
- /**
- * remove package name from those included in download jar.
- */
- boolean removeDownloadPackage(String pkg);
-
- /**
- * add package name to be included in download jar.
- */
- void addDownloadPackage(String pkg);
-
- /**
- * Attempt to find a package export that matches the given name or return null if none specified
- *
- * @param elementName
- * @return
- */
- IPackageExport findExport(String elementName);
-
- /**
- * Attempt to find a package import that matches the given name or return null if none specified
- * @param packageName
- * @return
- */
- IPackageImport findImport(String packageName);
+ void clearSourcePaths();
+
+
+ Set<String> getClasspathEntrys();
+
+
+ void addClasspathEntry( String encodedClasspath );
+
+
+ void removeClasspathEntry( String encodedClasspath );
+
+
+ IPath getLocation();
+
+
+ void setLocation( IPath location );
+
+
+ IPath getSourcePathLocation();
+
+
+ void setSourcePathLocation( IPath location );
+
+
+ IPath getSourceRootPath();
+
+
+ void setSourceRootPath( IPath location );
+
+
+ void setLicencePathLocation( IPath cacheSourceLocation );
+
+
+ IPath getLicencePathLocation();
+
+
+ /**
+ * get package names included in bundle.
+ * Can contain wildcards e.g. org.foo.*
+ */
+ Set<String> getPackages();
+
+
+ /**
+ * remove package name from those included in bundle.
+ */
+ boolean removePackage( String pkg );
+
+
+ /**
+ * add package name to be included in bundle.
+ */
+ void addPackage( String pkg );
+
+
+ /**
+ * get package names included in download jar.
+ * Can contain wildcards e.g. org.foo.*
+ */
+ Set<String> getDownloadPackages();
+
+
+ /**
+ * remove package name from those included in download jar.
+ */
+ boolean removeDownloadPackage( String pkg );
+
+
+ /**
+ * add package name to be included in download jar.
+ */
+ void addDownloadPackage( String pkg );
+
+
+ /**
+ * Attempt to find a package export that matches the given name or return null if none specified
+ *
+ * @param elementName
+ * @return
+ */
+ IPackageExport findExport( String elementName );
+
+
+ /**
+ * Attempt to find a package import that matches the given name or return null if none specified
+ * @param packageName
+ * @return
+ */
+ IPackageImport findImport( String packageName );
}
\ No newline at end of file
Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/osgi/IBundleModelElement.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/osgi/IBundleModelElement.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/osgi/IBundleModelElement.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/osgi/IBundleModelElement.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
package org.apache.felix.sigil.model.osgi;
+
import java.net.URI;
import java.util.Collection;
import java.util.Set;
@@ -28,87 +29,129 @@
import org.apache.felix.sigil.model.eclipse.ILibraryImport;
import org.osgi.framework.Version;
-public interface IBundleModelElement extends INamedModelElement, ICompoundModelElement, IVersionedModelElement {
- String getActivator();
-
- void setActivator(String activator);
-
- String getCategory();
+public interface IBundleModelElement extends INamedModelElement, ICompoundModelElement, IVersionedModelElement
+{
+
+ String getActivator();
+
+
+ void setActivator( String activator );
+
+
+ String getCategory();
+
+
+ void setCategory( String category );
+
+
+ String getContactAddress();
+
+
+ void setContactAddress( String contactAddress );
+
+
+ String getCopyright();
+
+
+ void setCopyright( String copyright );
+
+
+ URI getDocURI();
+
+
+ void setDocURI( URI docURI );
+
+
+ Set<IPackageExport> getExports();
+
+
+ void addExport( IPackageExport packageExport );
+
+
+ void removeExport( IPackageExport packageExport );
+
+
+ Set<IPackageImport> getImports();
+
+
+ void addImport( IPackageImport packageImport );
+
+
+ void removeImport( IPackageImport packageImport );
+
+
+ Set<IRequiredBundle> getRequiredBundles();
+
+
+ void addRequiredBundle( IRequiredBundle bundle );
+
+
+ void removeRequiredBundle( IRequiredBundle bundle );
+
+
+ void addLibraryImport( ILibraryImport library );
+
+
+ void removeLibraryImport( ILibraryImport library );
+
+
+ Set<ILibraryImport> getLibraryImports();
+
+
+ URI getLicenseURI();
+
+
+ void setLicenseURI( URI licenseURI );
+
+
+ URI getSourceLocation();
+
- void setCategory(String category);
+ void setSourceLocation( URI sourceLocation );
- String getContactAddress();
- void setContactAddress(String contactAddress);
+ String getSymbolicName();
- String getCopyright();
- void setCopyright(String copyright);
+ void setSymbolicName( String symbolicName );
- URI getDocURI();
- void setDocURI(URI docURI);
+ URI getUpdateLocation();
- Set<IPackageExport> getExports();
- void addExport(IPackageExport packageExport);
+ void setUpdateLocation( URI updateLocation );
- void removeExport(IPackageExport packageExport);
- Set<IPackageImport> getImports();
+ String getVendor();
- void addImport(IPackageImport packageImport);
- void removeImport(IPackageImport packageImport);
+ void setVendor( String vendor );
- Set<IRequiredBundle> getRequiredBundles();
- void addRequiredBundle(IRequiredBundle bundle);
+ Version getVersion();
- void removeRequiredBundle(IRequiredBundle bundle);
-
- void addLibraryImport(ILibraryImport library);
-
- void removeLibraryImport(ILibraryImport library);
-
- Set<ILibraryImport> getLibraryImports();
- URI getLicenseURI();
+ void setVersion( Version version );
- void setLicenseURI(URI licenseURI);
- URI getSourceLocation();
+ void setDescription( String elementText );
- void setSourceLocation(URI sourceLocation);
- String getSymbolicName();
+ String getDescription();
- void setSymbolicName(String symbolicName);
- URI getUpdateLocation();
+ Collection<String> getClasspaths();
- void setUpdateLocation(URI updateLocation);
- String getVendor();
+ void addClasspath( String path );
- void setVendor(String vendor);
- Version getVersion();
+ void removeClasspath( String path );
- void setVersion(Version version);
- void setDescription(String elementText);
-
- String getDescription();
+ void setFragmentHost( IRequiredBundle fragmentHost );
- Collection<String> getClasspaths();
-
- void addClasspath(String path);
-
- void removeClasspath(String path);
- void setFragmentHost(IRequiredBundle fragmentHost);
-
- IRequiredBundle getFragmentHost();
+ IRequiredBundle getFragmentHost();
}
\ No newline at end of file
Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/osgi/IPackageExport.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/osgi/IPackageExport.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/osgi/IPackageExport.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/osgi/IPackageExport.java Tue Jul 21 18:51:33 2009
@@ -19,18 +19,25 @@
package org.apache.felix.sigil.model.osgi;
+
import java.util.Collection;
import org.osgi.framework.Version;
-public interface IPackageExport extends IPackageModelElement, IVersionedModelElement, Comparable<IPackageExport> {
- void addUse(String uses);
-
- void removeUse(String uses);
-
- Collection<String> getUses();
-
- void setUses(Collection<String> asList);
-
- Version getRawVersion();
+
+public interface IPackageExport extends IPackageModelElement, IVersionedModelElement, Comparable<IPackageExport>
+{
+ void addUse( String uses );
+
+
+ void removeUse( String uses );
+
+
+ Collection<String> getUses();
+
+
+ void setUses( Collection<String> asList );
+
+
+ Version getRawVersion();
}
\ No newline at end of file
Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/osgi/IPackageImport.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/osgi/IPackageImport.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/osgi/IPackageImport.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/osgi/IPackageImport.java Tue Jul 21 18:51:33 2009
@@ -19,47 +19,57 @@
package org.apache.felix.sigil.model.osgi;
+
import org.apache.felix.sigil.model.IRequirementModelElement;
-public interface IPackageImport extends IPackageModelElement, IVersionRangeModelElement, IRequirementModelElement, Comparable<IPackageImport> {
- /**
- * indicates whether the OSGi attribute "resolution=optional" is specified.
- */
- boolean isOptional();
-
- void setOptional(boolean optional);
-
- /**
- * indicates whether import is needed at compile-time.
- * Default true. Used in conjunction with OSGiHeader.ALWAYS,
- * to add an OSGI import, without creating a dependency.
- */
- boolean isDependency();
-
- void setDependency(boolean dependency);
-
- /**
- * indicates whether import should be added to OSGi Package-Import header.
- * Default: AUTO.
- */
- OSGiImport getOSGiImport();
-
- void setOSGiImport(OSGiImport osgiImport);
-
- enum OSGiImport {
- /**
- * only add to OSGi header, if it appears to be needed.
- */
- AUTO,
-
- /**
- * always add to OSGi header, even if it appears unnecessary.
- */
- ALWAYS,
-
- /**
- * never add to OSGi header.
- */
- NEVER
- }
+
+public interface IPackageImport extends IPackageModelElement, IVersionRangeModelElement, IRequirementModelElement,
+ Comparable<IPackageImport>
+{
+ /**
+ * indicates whether the OSGi attribute "resolution=optional" is specified.
+ */
+ boolean isOptional();
+
+
+ void setOptional( boolean optional );
+
+
+ /**
+ * indicates whether import is needed at compile-time.
+ * Default true. Used in conjunction with OSGiHeader.ALWAYS,
+ * to add an OSGI import, without creating a dependency.
+ */
+ boolean isDependency();
+
+
+ void setDependency( boolean dependency );
+
+
+ /**
+ * indicates whether import should be added to OSGi Package-Import header.
+ * Default: AUTO.
+ */
+ OSGiImport getOSGiImport();
+
+
+ void setOSGiImport( OSGiImport osgiImport );
+
+ enum OSGiImport
+ {
+ /**
+ * only add to OSGi header, if it appears to be needed.
+ */
+ AUTO,
+
+ /**
+ * always add to OSGi header, even if it appears unnecessary.
+ */
+ ALWAYS,
+
+ /**
+ * never add to OSGi header.
+ */
+ NEVER
+ }
}
\ No newline at end of file
Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/osgi/IPackageModelElement.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/osgi/IPackageModelElement.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/osgi/IPackageModelElement.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/osgi/IPackageModelElement.java Tue Jul 21 18:51:33 2009
@@ -19,12 +19,16 @@
package org.apache.felix.sigil.model.osgi;
+
import org.apache.felix.sigil.model.IModelElement;
-public interface IPackageModelElement extends IModelElement {
- String getPackageName();
+public interface IPackageModelElement extends IModelElement
+{
+
+ String getPackageName();
+
- void setPackageName(String packageName);
+ void setPackageName( String packageName );
}
Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/osgi/IRequiredBundle.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/osgi/IRequiredBundle.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/osgi/IRequiredBundle.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/osgi/IRequiredBundle.java Tue Jul 21 18:51:33 2009
@@ -19,20 +19,28 @@
package org.apache.felix.sigil.model.osgi;
+
import org.apache.felix.sigil.model.IModelElement;
import org.apache.felix.sigil.model.IRequirementModelElement;
import org.apache.felix.sigil.model.common.VersionRange;
-public interface IRequiredBundle extends IModelElement, IRequirementModelElement, Comparable<IRequiredBundle> {
- String getSymbolicName();
- void setSymbolicName(String symbolicName);
+public interface IRequiredBundle extends IModelElement, IRequirementModelElement, Comparable<IRequiredBundle>
+{
+ String getSymbolicName();
+
+
+ void setSymbolicName( String symbolicName );
+
+
+ VersionRange getVersions();
+
+
+ void setVersions( VersionRange versions );
+
- VersionRange getVersions();
+ boolean isOptional();
- void setVersions(VersionRange versions);
- boolean isOptional();
-
- void setOptional(boolean optional);
+ void setOptional( boolean optional );
}
\ No newline at end of file
Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/osgi/IVersionRangeModelElement.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/osgi/IVersionRangeModelElement.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/osgi/IVersionRangeModelElement.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/osgi/IVersionRangeModelElement.java Tue Jul 21 18:51:33 2009
@@ -19,12 +19,16 @@
package org.apache.felix.sigil.model.osgi;
+
import org.apache.felix.sigil.model.common.VersionRange;
-public interface IVersionRangeModelElement {
- VersionRange getVersions();
+public interface IVersionRangeModelElement
+{
+
+ VersionRange getVersions();
+
- void setVersions(VersionRange version);
+ void setVersions( VersionRange version );
}
Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/osgi/IVersionedModelElement.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/osgi/IVersionedModelElement.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/osgi/IVersionedModelElement.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/osgi/IVersionedModelElement.java Tue Jul 21 18:51:33 2009
@@ -19,12 +19,16 @@
package org.apache.felix.sigil.model.osgi;
+
import org.osgi.framework.Version;
-public interface IVersionedModelElement {
- Version getVersion();
+public interface IVersionedModelElement
+{
+
+ Version getVersion();
+
- void setVersion(Version version);
+ void setVersion( Version version );
}