Return-Path: Delivered-To: apmail-felix-commits-archive@www.apache.org Received: (qmail 78153 invoked from network); 13 Jul 2009 13:27:17 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 13 Jul 2009 13:27:17 -0000 Received: (qmail 3285 invoked by uid 500); 13 Jul 2009 13:27:26 -0000 Delivered-To: apmail-felix-commits-archive@felix.apache.org Received: (qmail 3251 invoked by uid 500); 13 Jul 2009 13:27:26 -0000 Mailing-List: contact commits-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list commits@felix.apache.org Received: (qmail 3196 invoked by uid 99); 13 Jul 2009 13:27:26 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Jul 2009 13:27:26 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Jul 2009 13:27:20 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 86EBB23889B8; Mon, 13 Jul 2009 13:26:26 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r793581 [10/23] - in /felix/trunk/sigil: ./ bld-ivy/ bld-ivy/example/ bld-ivy/example/dependence/ bld-ivy/example/dependence/dependee/ bld-ivy/example/dependence/dependee/src/ bld-ivy/example/dependence/dependee/src/standalone/ bld-ivy/exam... Date: Mon, 13 Jul 2009 13:26:06 -0000 To: commits@felix.apache.org From: rickhall@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090713132626.86EBB23889B8@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Added: felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/common/ParseState.java URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/common/ParseState.java?rev=793581&view=auto ============================================================================== --- felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/common/ParseState.java (added) +++ felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/common/ParseState.java Mon Jul 13 13:25:46 2009 @@ -0,0 +1,83 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.cauldron.sigil.model.common; + +import java.io.Serializable; + +/** + * @author dave + * + */ +class ParseState implements Serializable { + /** + * + */ + private static final long serialVersionUID = 1L; + + int pos; + + String str; + + ParseState(String str) { + this.str = str; + } + + public boolean lookingAt(String start) { + return str.substring(pos).startsWith(start); + } + + 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); + } + + public char read() { + char ch = str.charAt(pos); + if (pos < str.length()) { + pos++; + } + return ch; + } + + public char readAndSkipWhiteSpace() { + char ch = read(); + skipWhitespace(); + return ch; + } + + char peek() { + if (isEndOfString()) { + return (char) -1; + } + return str.charAt(pos); + } + + boolean isEndOfString() { + return pos == str.length(); + } + + void skipWhitespace() { + while (pos < str.length() && Character.isWhitespace(str.charAt(pos))) { + pos++; + } + } +} Added: felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/common/SimpleTerm.java URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/common/SimpleTerm.java?rev=793581&view=auto ============================================================================== --- felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/common/SimpleTerm.java (added) +++ felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/common/SimpleTerm.java Mon Jul 13 13:25:46 2009 @@ -0,0 +1,281 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.cauldron.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 { + + /** + * + */ + 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 Ops op; + private String name; + private String rval; + + public SimpleTerm(String name, Ops op, String value) { + this.op = op; + this.name = name.intern(); + this.rval = value.intern(); + } + + public String getName() { + return name; + } + + public Ops getOp() { + return op; + } + + public String getRval() { + return rval; + } + + public boolean eval(Map map) { + + Object lval = map.get(name); + if (lval == null) { + return false; + } + 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())) { + 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])) { + return true; + } + } + return false; + } + return check(lval); + } + + @SuppressWarnings("unchecked") + private boolean check(Object lval) { + if (lval == null) { + return false; + } + else if (Ops.EQ == op && WILDCARD_STRING.equals(lval)) { + return true; + } + + Object rhs = null; + + if (lval instanceof String) { + + if (Ops.APPROX == op) { + rhs = collapseWhiteSpace(rval); + lval = collapseWhiteSpace((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); + } + catch (Exception e) { + // log it + e.printStackTrace(); + return false; + } + } + + if (!(lval instanceof Comparable)) { + return Ops.EQ == op && lval.equals(rval); + } + else { + + Comparable lhs = (Comparable) 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) { + + String rhs; + 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) { + return true; + } + + boolean wc = false; + int j = 0; + for (int i = 0; i < patLength; i++) { + // trailing wildcards + char pc = rhs.charAt(i); + if (j == valLength) { + if (pc != SimpleTerm.WILDCARD) { + return false; + } + continue; + } + if (pc == SimpleTerm.WILDCARD) { + wc = true; + continue; + } + while (wc && j < valLength - 1 && lhs.charAt(j) != pc) { + j++; + } + if (lhs.charAt(j) != pc) { + return false; + } + else { + wc = false; + j++; + } + } + return (wc || j == valLength); + + } + + 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)) { + white = true; + } + else { + if (white) { + out.append(" "); + white = false; + } + out.append(ch); + } + } + return out.toString(); + } + + public void visit(ExprVisitor v) { + v.visitSimple(this); + } + + 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); + } + return false; + } + + @Override + 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); + } + } + return buf.toString(); + } +} Added: felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/common/Utils.java URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/common/Utils.java?rev=793581&view=auto ============================================================================== --- felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/common/Utils.java (added) +++ felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/common/Utils.java Mon Jul 13 13:25:46 2009 @@ -0,0 +1,71 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.cauldron.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 static String toString(Map attrs) { + if (attrs == null) { + return "NULL"; + } + + StringBuffer buf = new StringBuffer(128); + List keys = new ArrayList(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()); + } + + buf.append("}"); + + return buf.toString(); + } + + public static class MapBuilder { + private Map map = new HashMap(); + + public MapBuilder put(String name, Object value) { + map.put(name, value); + + return this; + } + + public Map toMap() { + return map; + } + } +} Added: felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/common/VersionRange.java URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/common/VersionRange.java?rev=793581&view=auto ============================================================================== --- felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/common/VersionRange.java (added) +++ felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/common/VersionRange.java Mon Jul 13 13:25:46 2009 @@ -0,0 +1,252 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.cauldron.sigil.model.common; + +import java.io.Serializable; + +import org.osgi.framework.Version; + +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); + + private boolean openFloor; + private Version floor; + private Version ceiling; + private boolean openCeiling; + + /** + * Interval constructor + * + * @param openFloor Whether the lower bound of the range is inclusive (false) or exclusive (true). + * @param floor The lower bound version of the range. + * @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) { + this.openFloor = openFloor; + this.floor = floor; + this.ceiling = ceiling; + this.openCeiling = openCeiling; + } + + /** + * atLeast constructor + * + * @param openFloor + * @param floor + */ + 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; + } + + boolean openFloor; + boolean openCeiling; + val = val.replaceAll("\\s", ""); + val = val.replaceAll("\"", ""); + int fst = val.charAt(0); + if (fst == '[') { + openFloor = false; + } + else if (fst == '(') { + openFloor = true; + } + else { + Version atLeast = Version.parseVersion(val); + return new VersionRange(atLeast); + } + + int lst = val.charAt(val.length() - 1); + if (lst == ']') { + openCeiling = false; + } + else if (lst == ')') { + openCeiling = true; + } + 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); + } + public Version getCeiling() { + return ceiling; + } + + public Version getFloor() { + return floor; + } + + public boolean isOpenCeiling() { + return openCeiling; + } + + public boolean isOpenFloor() { + return openFloor; + } + + 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)); + } + } + + @Override + 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); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final VersionRange other = (VersionRange) obj; + if (ceiling == null) { + if (other.ceiling != null) + return false; + } + else if (!ceiling.equals(other.ceiling)) + return false; + if (floor == null) { + if (other.floor != null) + return false; + } + else if (!floor.equals(other.floor)) + return false; + if (openCeiling != other.openCeiling) + return false; + 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); + } + + 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 ? ")" : "]"); + } + 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); + } +} Added: felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/common/VersionRangeBoundingRule.java URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/common/VersionRangeBoundingRule.java?rev=793581&view=auto ============================================================================== --- felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/common/VersionRangeBoundingRule.java (added) +++ felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/common/VersionRangeBoundingRule.java Mon Jul 13 13:25:46 2009 @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.cauldron.sigil.model.common; + +public enum VersionRangeBoundingRule { + Exact, Micro, Minor, Major, Any +} \ No newline at end of file Added: felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/eclipse/IDownloadJar.java URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/eclipse/IDownloadJar.java?rev=793581&view=auto ============================================================================== --- felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/eclipse/IDownloadJar.java (added) +++ felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/eclipse/IDownloadJar.java Mon Jul 13 13:25:46 2009 @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.cauldron.sigil.model.eclipse; + +import java.util.Set; + +import org.cauldron.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 getEntrys(); + + void clearEntries(); +} Added: felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/eclipse/ILibrary.java URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/eclipse/ILibrary.java?rev=793581&view=auto ============================================================================== --- felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/eclipse/ILibrary.java (added) +++ felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/eclipse/ILibrary.java Mon Jul 13 13:25:46 2009 @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.cauldron.sigil.model.eclipse; + +import java.util.Collection; + +import org.cauldron.sigil.model.IModelElement; +import org.cauldron.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 getImports(); +} Added: felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/eclipse/ILibraryImport.java URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/eclipse/ILibraryImport.java?rev=793581&view=auto ============================================================================== --- felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/eclipse/ILibraryImport.java (added) +++ felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/eclipse/ILibraryImport.java Mon Jul 13 13:25:46 2009 @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.cauldron.sigil.model.eclipse; + +import org.cauldron.sigil.model.IModelElement; +import org.cauldron.sigil.model.common.VersionRange; + +public interface ILibraryImport extends IModelElement { + String getLibraryName(); + void setLibraryName(String name); + VersionRange getVersions(); + void setVersions(VersionRange range); +} Added: felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/eclipse/INewtonSystem.java URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/eclipse/INewtonSystem.java?rev=793581&view=auto ============================================================================== --- felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/eclipse/INewtonSystem.java (added) +++ felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/eclipse/INewtonSystem.java Mon Jul 13 13:25:46 2009 @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.cauldron.sigil.model.eclipse; + +import org.cauldron.sigil.model.IModelElement; +import org.eclipse.core.runtime.IPath; + +/** + * @author dave + * + */ +public interface INewtonSystem extends IModelElement { + IPath getLocation(); + + void setLocation(IPath location); +} Added: felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/eclipse/ISCAComposite.java URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/eclipse/ISCAComposite.java?rev=793581&view=auto ============================================================================== --- felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/eclipse/ISCAComposite.java (added) +++ felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/eclipse/ISCAComposite.java Mon Jul 13 13:25:46 2009 @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.cauldron.sigil.model.eclipse; + +import org.cauldron.sigil.model.IModelElement; +import org.eclipse.core.runtime.IPath; + +/** + * @author dave + * + */ +public interface ISCAComposite extends IModelElement { + IPath getLocation(); + + void setLocation(IPath location); +} \ No newline at end of file Added: felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/eclipse/ISigilBundle.java URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/eclipse/ISigilBundle.java?rev=793581&view=auto ============================================================================== --- felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/eclipse/ISigilBundle.java (added) +++ felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/eclipse/ISigilBundle.java Mon Jul 13 13:25:46 2009 @@ -0,0 +1,141 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.cauldron.sigil.model.eclipse; + +import java.io.IOException; +import java.util.Set; + +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.cauldron.sigil.model.ICompoundModelElement; +import org.cauldron.sigil.model.osgi.IBundleModelElement; +import org.cauldron.sigil.model.osgi.IPackageExport; +import org.cauldron.sigil.model.osgi.IPackageImport; +import org.cauldron.sigil.model.osgi.IVersionedModelElement; + +/** + * @author dave + * + */ +public interface ISigilBundle extends ICompoundModelElement, IVersionedModelElement { + void synchronize(IProgressMonitor monitor) throws IOException; + + boolean isSynchronized(); + + IBundleModelElement getBundleInfo(); + + String getSymbolicName(); + + void setBundleInfo(IBundleModelElement bundle); + + IDownloadJar getDownloadJar(); + + void setDownloadJar(IDownloadJar download); + + void addComposite(ISCAComposite composite); + + void removeComposite(ISCAComposite composite); + + Set getComposites(); + + void addLibraryPath(IPath path); + + void removeLibraryPath(IPath path); + + Set getLibraryPaths(); + + void addSourcePath(IPath path); + + void removeSourcePath(IPath path); + + Set getSourcePaths(); + + void clearSourcePaths(); + + Set 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 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 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 Added: felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/osgi/IBundleModelElement.java URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/osgi/IBundleModelElement.java?rev=793581&view=auto ============================================================================== --- felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/osgi/IBundleModelElement.java (added) +++ felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/osgi/IBundleModelElement.java Mon Jul 13 13:25:46 2009 @@ -0,0 +1,114 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.cauldron.sigil.model.osgi; + +import java.net.URI; +import java.util.Collection; +import java.util.Set; + +import org.cauldron.sigil.model.ICompoundModelElement; +import org.cauldron.sigil.model.INamedModelElement; +import org.cauldron.sigil.model.eclipse.ILibraryImport; +import org.osgi.framework.Version; + +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 getExports(); + + void addExport(IPackageExport packageExport); + + void removeExport(IPackageExport packageExport); + + Set getImports(); + + void addImport(IPackageImport packageImport); + + void removeImport(IPackageImport packageImport); + + Set getRequiredBundles(); + + void addRequiredBundle(IRequiredBundle bundle); + + void removeRequiredBundle(IRequiredBundle bundle); + + void addLibraryImport(ILibraryImport library); + + void removeLibraryImport(ILibraryImport library); + + Set getLibraryImports(); + + URI getLicenseURI(); + + void setLicenseURI(URI licenseURI); + + URI getSourceLocation(); + + void setSourceLocation(URI sourceLocation); + + String getSymbolicName(); + + void setSymbolicName(String symbolicName); + + URI getUpdateLocation(); + + void setUpdateLocation(URI updateLocation); + + String getVendor(); + + void setVendor(String vendor); + + Version getVersion(); + + void setVersion(Version version); + + void setDescription(String elementText); + + String getDescription(); + + Collection getClasspaths(); + + void addClasspath(String path); + + void removeClasspath(String path); + + void setFragmentHost(IRequiredBundle fragmentHost); + + IRequiredBundle getFragmentHost(); +} \ No newline at end of file Added: felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/osgi/IPackageExport.java URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/osgi/IPackageExport.java?rev=793581&view=auto ============================================================================== --- felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/osgi/IPackageExport.java (added) +++ felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/osgi/IPackageExport.java Mon Jul 13 13:25:46 2009 @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.cauldron.sigil.model.osgi; + +import java.util.Collection; + +import org.osgi.framework.Version; + +public interface IPackageExport extends IPackageModelElement, IVersionedModelElement, Comparable { + void addUse(String uses); + + void removeUse(String uses); + + Collection getUses(); + + void setUses(Collection asList); + + Version getRawVersion(); +} \ No newline at end of file Added: felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/osgi/IPackageImport.java URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/osgi/IPackageImport.java?rev=793581&view=auto ============================================================================== --- felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/osgi/IPackageImport.java (added) +++ felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/osgi/IPackageImport.java Mon Jul 13 13:25:46 2009 @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.cauldron.sigil.model.osgi; + +import org.cauldron.sigil.model.IRequirementModelElement; + +public interface IPackageImport extends IPackageModelElement, IVersionRangeModelElement, IRequirementModelElement, Comparable { + /** + * 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 Added: felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/osgi/IPackageModelElement.java URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/osgi/IPackageModelElement.java?rev=793581&view=auto ============================================================================== --- felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/osgi/IPackageModelElement.java (added) +++ felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/osgi/IPackageModelElement.java Mon Jul 13 13:25:46 2009 @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.cauldron.sigil.model.osgi; + +import org.cauldron.sigil.model.IModelElement; + +public interface IPackageModelElement extends IModelElement { + + String getPackageName(); + + void setPackageName(String packageName); + +} Added: felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/osgi/IRequiredBundle.java URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/osgi/IRequiredBundle.java?rev=793581&view=auto ============================================================================== --- felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/osgi/IRequiredBundle.java (added) +++ felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/osgi/IRequiredBundle.java Mon Jul 13 13:25:46 2009 @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.cauldron.sigil.model.osgi; + +import org.cauldron.sigil.model.IModelElement; +import org.cauldron.sigil.model.IRequirementModelElement; +import org.cauldron.sigil.model.common.VersionRange; + +public interface IRequiredBundle extends IModelElement, IRequirementModelElement, Comparable { + String getSymbolicName(); + + void setSymbolicName(String symbolicName); + + VersionRange getVersions(); + + void setVersions(VersionRange versions); + + boolean isOptional(); + + void setOptional(boolean optional); +} \ No newline at end of file Added: felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/osgi/IVersionRangeModelElement.java URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/osgi/IVersionRangeModelElement.java?rev=793581&view=auto ============================================================================== --- felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/osgi/IVersionRangeModelElement.java (added) +++ felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/osgi/IVersionRangeModelElement.java Mon Jul 13 13:25:46 2009 @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.cauldron.sigil.model.osgi; + +import org.cauldron.sigil.model.common.VersionRange; + +public interface IVersionRangeModelElement { + + VersionRange getVersions(); + + void setVersions(VersionRange version); + +} Added: felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/osgi/IVersionedModelElement.java URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/osgi/IVersionedModelElement.java?rev=793581&view=auto ============================================================================== --- felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/osgi/IVersionedModelElement.java (added) +++ felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/model/osgi/IVersionedModelElement.java Mon Jul 13 13:25:46 2009 @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.cauldron.sigil.model.osgi; + +import org.osgi.framework.Version; + +public interface IVersionedModelElement { + + Version getVersion(); + + void setVersion(Version version); + +} Added: felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/repository/AbstractBundleRepository.java URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/repository/AbstractBundleRepository.java?rev=793581&view=auto ============================================================================== --- felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/repository/AbstractBundleRepository.java (added) +++ felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/repository/AbstractBundleRepository.java Mon Jul 13 13:25:46 2009 @@ -0,0 +1,380 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.cauldron.sigil.repository; + +import java.io.IOException; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashSet; +import java.util.jar.Attributes; +import java.util.jar.Manifest; + +import org.cauldron.bld.core.BldCore; +import org.cauldron.bld.core.licence.ILicenseManager; +import org.cauldron.bld.core.licence.ILicensePolicy; +import org.cauldron.bld.core.util.QuoteUtil; +import org.cauldron.sigil.model.IModelElement; +import org.cauldron.sigil.model.ModelElementFactory; +import org.cauldron.sigil.model.ModelElementFactoryException; +import org.cauldron.sigil.model.common.VersionRange; +import org.cauldron.sigil.model.eclipse.ILibrary; +import org.cauldron.sigil.model.eclipse.ISigilBundle; +import org.cauldron.sigil.model.osgi.IBundleModelElement; +import org.cauldron.sigil.model.osgi.IPackageExport; +import org.cauldron.sigil.model.osgi.IPackageImport; +import org.cauldron.sigil.model.osgi.IRequiredBundle; +import org.osgi.framework.Version; + +public abstract class AbstractBundleRepository implements IBundleRepository { + + private final String id; + private final HashSet listeners = new HashSet(); + + public AbstractBundleRepository(String id) { + this.id = id; + } + + public abstract void accept(IRepositoryVisitor visitor, int options); + + public void addBundleRepositoryListener(IBundleRepositoryListener listener) { + synchronized(listeners) { + listeners.add(listener); + } + } + + public void removeBundleRepositoryListener(IBundleRepositoryListener listener) { + synchronized(listeners) { + listeners.remove(listener); + } + } + + protected void notifyChange() { + for ( IBundleRepositoryListener l : listeners ) { + l.notifyChange(this); + } + } + + public String getId() { + return id; + } + + public void accept(IRepositoryVisitor visitor) { + accept( visitor, 0 ); + } + + public void writeOBR(OutputStream out) throws IOException { + throw new UnsupportedOperationException(); + } + + public Collection findProviders(final ILibrary library, int options) { + final ArrayList found = new ArrayList(); + + final ILicensePolicy policy = findPolicy(library); + + IRepositoryVisitor visitor = new IRepositoryVisitor() { + public boolean visit(ISigilBundle bundle) { + if (policy.accept(bundle)) { + IBundleModelElement info = bundle.getBundleInfo(); + for ( IPackageImport pi : library.getImports() ) { + for ( IPackageExport e : info.getExports() ) { + if ( pi.getPackageName().equals( e.getPackageName() ) && pi.getVersions().contains( e.getVersion() ) ) { + found.add(bundle); + break; + } + } + } + } + return true; + } + }; + + accept( visitor, options ); + + return found; + } + + public Collection findAllProviders(final IRequiredBundle req, int options) { + final ArrayList found = new ArrayList(); + + final ILicensePolicy policy = findPolicy(req); + + IRepositoryVisitor visitor = new IRepositoryVisitor() { + public boolean visit(ISigilBundle bundle) { + if (policy.accept(bundle)) { + IBundleModelElement info = bundle.getBundleInfo(); + if ( req.getSymbolicName().equals( info.getSymbolicName() ) && req.getVersions().contains( info.getVersion() ) ) { + found.add(bundle); + } + } + return true; + } + }; + + accept( visitor, options ); + + return found; + } + + public Collection findAllProviders(final IPackageImport pi, int options) { + final ArrayList found = new ArrayList(); + + final ILicensePolicy policy = findPolicy(pi); + + IRepositoryVisitor visitor = new IRepositoryVisitor() { + + public boolean visit(ISigilBundle bundle) { + if (policy.accept(bundle)) { + IBundleModelElement info = bundle.getBundleInfo(); + if ( info != null ) { + for ( IPackageExport e : info.getExports() ) { + if ( pi.getPackageName().equals( e.getPackageName() ) ) { + if ( pi.getVersions().contains( e.getVersion() ) ) { + found.add(bundle); + break; + } + } + } + } + } + return true; + } + + }; + + accept( visitor, options ); + + return found; + } + + public ISigilBundle findProvider(final IPackageImport pi, int options) { + final ArrayList found = new ArrayList(); + + final ILicensePolicy policy = findPolicy(pi); + + IRepositoryVisitor visitor = new IRepositoryVisitor() { + public boolean visit(ISigilBundle bundle) { + if (policy.accept(bundle)) { + IBundleModelElement info = bundle.getBundleInfo(); + for ( IPackageExport e : info.getExports() ) { + if ( pi.getPackageName().equals( e.getPackageName() ) && pi.getVersions().contains( e.getVersion() ) ) { + found.add( bundle ); + return false; + } + } + } + return true; + } + + }; + + accept( visitor, options ); + + return found.isEmpty() ? null : found.iterator().next(); + } + + public ISigilBundle findProvider(final IRequiredBundle req, int options) { + final ArrayList found = new ArrayList(); + + final ILicensePolicy policy = findPolicy(req); + + IRepositoryVisitor visitor = new IRepositoryVisitor() { + + public boolean visit(ISigilBundle bundle) { + if (policy.accept(bundle)) { + IBundleModelElement info = bundle.getBundleInfo(); + if ( req.getSymbolicName().equals( info.getSymbolicName() ) && req.getVersions().contains( info.getVersion() ) ) { + found.add( bundle ); + return false; + } + } + return true; + } + + }; + + accept( visitor, options ); + + return found.isEmpty() ? null : found.iterator().next(); + } + + public IBundleModelElement buildBundleModelElement(Manifest mf) { + IBundleModelElement info = null; + + if ( mf != null ) { + Attributes attrs = mf.getMainAttributes(); + String name = attrs.getValue("Bundle-SymbolicName"); + if (name == null) { + // framework.jar doesn't have Bundle-SymbolicName! + name = attrs.getValue("Bundle-Name"); + } + + if (name != null) { + try { + info = ModelElementFactory.getInstance().newModelElement( IBundleModelElement.class ); + info.setSymbolicName( name.split(";")[0] ); + info.setVersion( Version.parseVersion( attrs.getValue( "Bundle-Version" ) ) ); + info.setName( attrs.getValue( "Bundle-Name" ) ); + info.setDescription( attrs.getValue( "Bundle-Description" ) ); + info.setVendor( attrs.getValue( "Bundle-Vendor" ) ); + + String importStr = attrs.getValue( "Import-Package" ); + if ( importStr != null ) { + addImports( info, importStr ); + } + String exportStr = attrs.getValue( "Export-Package" ); + if ( exportStr != null ) { + addExports( info, exportStr ); + } + + String reqStr = attrs.getValue( "Require-Bundle" ); + if ( reqStr != null ) { + addRequires( info, reqStr ); + } + + String cpStr = attrs.getValue( "Bundle-Classpath" ); + + if ( cpStr != null ) { + addClasspath( info, cpStr ); + } + } + catch (RuntimeException e) { + BldCore.error( "Failed to read info from bundle " + name, e ); + // clear elements as clearly got garbage + info = null; + } + } + } + + return info; + } + + protected ILicensePolicy findPolicy(IModelElement elem) { + ILicenseManager man = BldCore.getLicenseManager(); + +/* ISigilProjectModel p = elem.getAncestor(ISigilProjectModel.class); + + ILicensePolicy policy = null; + + if ( p != null ) { + policy = man.getPolicy(p); + } + else { + policy = man.getDefaultPolicy(); + } + + return policy; */ + + return man.getDefaultPolicy(); + } + + private void addClasspath(IBundleModelElement info, String cpStr) { + for ( String cp : cpStr.split( "," ) ) { + info.addClasspath( cp ); + } + } + + private void addExports(IBundleModelElement info, String exportStr) throws ModelElementFactoryException { + for ( String exp : QuoteUtil.split( exportStr ) ) { + try { + String[] parts = exp.split( ";" ); + IPackageExport pe = ModelElementFactory.getInstance().newModelElement(IPackageExport.class); + pe.setPackageName( parts[0].trim() ); + + if ( parts.length > 1 ) { + for (int i = 1; i < parts.length; i++ ) { + String check = parts[i]; + if ( check.toLowerCase().startsWith( "version=" ) ) { + pe.setVersion( parseVersion(check.substring("version=".length()))); + } + else if ( check.toLowerCase().startsWith( "specification-version=" ) ) { + pe.setVersion( parseVersion( check.substring("specification-version=".length()) ) ); + } + else if ( check.toLowerCase().startsWith( "uses:=" ) ) { + for (String use : parseUses( check.substring( "uses:=".length() ) ) ) { + pe.addUse(use); + } + } + } + } + info.addExport(pe); + } + catch (RuntimeException e) { + e.printStackTrace(); + } + } + } + + private Collection parseUses(String uses) { + if ( uses.startsWith( "\"") ) { + uses = uses.substring(1, uses.length() - 2 ); + } + + return Arrays.asList( uses.split(",") ); + } + + private Version parseVersion(String val) { + val = val.replaceAll("\"", ""); + return new Version(val); + } + + private void addImports(IBundleModelElement info, String importStr) throws ModelElementFactoryException { + for ( String imp : QuoteUtil.split( importStr ) ) { + String[] parts = imp.split( ";" ); + IPackageImport pi = ModelElementFactory.getInstance().newModelElement(IPackageImport.class); + pi.setPackageName( parts[0].trim() ); + + if ( parts.length > 1 ) { + for ( int i = 1; i < parts.length; i++ ) { + String p = parts[i]; + if ( p.toLowerCase().startsWith( "version=" ) ) { + pi.setVersions( VersionRange.parseVersionRange(p.substring("version=".length()))); + } + else if ( p.toLowerCase().startsWith( "specification-version=" ) ) { + pi.setVersions( VersionRange.parseVersionRange( p.substring("specification-version=".length()) )); + } + else if ( p.toLowerCase().startsWith( "resolution:=" ) ) { + pi.setOptional( p.toLowerCase().substring("resolution:=".length()).equals( "optional") ); + } + } + } + info.addImport(pi); + } + } + + private void addRequires(IBundleModelElement info, String reqStr) throws ModelElementFactoryException { + for ( String imp : QuoteUtil.split( reqStr ) ) { + String[] parts = imp.split( ";" ); + IRequiredBundle req = ModelElementFactory.getInstance().newModelElement(IRequiredBundle.class); + req.setSymbolicName( parts[0] ); + + if ( parts.length > 1 ) { + if ( parts[1].toLowerCase().startsWith( "version=" ) ) { + req.setVersions( VersionRange.parseVersionRange(parts[1].substring("version=".length()))); + } + else if ( parts[1].toLowerCase().startsWith( "specification-version=" ) ) { + req.setVersions( VersionRange.parseVersionRange( parts[1].substring("specification-version=".length()) )); + } + } + info.addRequiredBundle(req); + } + } +} Added: felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/repository/AbstractRepositoryManager.java URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/repository/AbstractRepositoryManager.java?rev=793581&view=auto ============================================================================== --- felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/repository/AbstractRepositoryManager.java (added) +++ felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/repository/AbstractRepositoryManager.java Mon Jul 13 13:25:46 2009 @@ -0,0 +1,330 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.cauldron.sigil.repository; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; + +import org.cauldron.bld.core.repository.BundleResolver; +import org.cauldron.sigil.model.IModelWalker; +import org.cauldron.sigil.model.eclipse.ILibrary; +import org.cauldron.sigil.model.eclipse.ILibraryImport; +import org.cauldron.sigil.model.eclipse.ISigilBundle; +import org.cauldron.sigil.repository.RepositoryChangeEvent.Type; + +public abstract class AbstractRepositoryManager implements IRepositoryManager, IBundleRepositoryListener { + + private HashSet listeners = new HashSet(); + + private boolean initialised; + + private HashMap repositories = new HashMap(); + private ArrayList order = new ArrayList(); + private TreeMap> levelMap = new TreeMap>(); + private int[] levels; + + private BundleResolver resolver = new BundleResolver(this); + + private ArrayList libraries = new ArrayList(); + + public void initialise() { + synchronized( repositories ) { + if ( !initialised ) { + initialised = true; + loadRepositories(); + } + } + } + + protected abstract void loadRepositories(); + + public void addRepositoryChangeListener(IRepositoryChangeListener listener) { + synchronized(listeners) { + listeners.add(listener); + } + } + + public void removeRepositoryChangeListener(IRepositoryChangeListener listener) { + synchronized(listeners) { + listeners.remove(listener); + } + } + + public void notifyChange(IBundleRepository repository) { + notifyListeners( new RepositoryChangeEvent(repository, Type.CHANGED ) ); + } + + private void notifyListeners(RepositoryChangeEvent event) { + ArrayList safe = null; + synchronized(listeners) { + safe = new ArrayList(listeners); + } + for ( IRepositoryChangeListener l : safe ) { + l.repositoryChanged(event); + } + } + + protected void setRepositories(IBundleRepository[] repos) { + synchronized( repositories ) { + repositories.clear(); + order.clear(); + levelMap.clear(); + resetLevels(); + if ( repos != null ) { + for ( int i = 0; i < repos.length; i++ ) { + addRepository(repos[i], i); + } + } + } + } + + protected void addRepository(IBundleRepository rep, int level) { + Type type = null; + + synchronized( repositories ) { + IBundleRepository old = repositories.put(rep.getId(), rep); + if ( old == null ) { + type = Type.ADDED; + rep.addBundleRepositoryListener(this); + } + else { + old.removeBundleRepositoryListener(this); + type = Type.CHANGED; + order.remove(old); + clearLevel(rep); + } + + order.add(rep); + + HashSet set = levelMap.get(level); + + if ( set == null ) { + set = new HashSet(); + levelMap.put( level, set ); + } + + set.add( rep ); + resetLevels(); + } + + notifyListeners( new RepositoryChangeEvent(rep, type ) ); + } + + protected void removeRepository(IBundleRepository rep) { + Type type = null; + + synchronized( repositories ) { + if ( repositories.remove(rep.getId()) != null ) { + order.remove(rep); + type = Type.REMOVED; + clearLevel(rep); + resetLevels(); + } + } + + if ( type != null ) { + notifyListeners( new RepositoryChangeEvent(rep, type ) ); + } + } + + private void clearLevel(IBundleRepository rep) { + for ( Iterator>> iter = levelMap.entrySet().iterator(); iter.hasNext(); ) { + Map.Entry> e = iter.next(); + if ( e.getValue().remove(rep) ) { + if ( e.getValue().isEmpty() ) { + iter.remove(); + } + break; + } + } + } + + /* (non-Javadoc) + * @see org.cauldron.sigil.internal.repository.IRepositoryManager#getRepositories() + */ + public Collection getRepositories() { + initialise(); + ArrayList safe = null; + + synchronized( repositories ) { + safe = new ArrayList( order ); + } + + return safe; + } + + private void resetLevels() { + Collections.sort(order, new Comparator() { + public int compare(IBundleRepository o1, IBundleRepository o2) { + int l1 = findLevel(o1); + int l2 = findLevel(o2); + + if ( l1 < l2 ) { + return -1; + } + else if ( l1 > l2 ) { + return 1; + } + else { + return 0; + } + } + + private int findLevel(IBundleRepository rep) { + for ( Map.Entry> e : levelMap.entrySet() ) { + if ( e.getValue().contains( rep ) ) { + return e.getKey(); + } + } + throw new IllegalStateException(); + } + }); + levels = new int[levelMap.size()]; + int i = 0; + for ( Integer v : levelMap.keySet() ) { + levels[i++] = v; + } + } + + + public int[] getPriorityLevels() { + initialise(); + synchronized( repositories ) { + return levels; + } + } + + public Collection getRepositories(int priorityLevel) { + initialise(); + List found = null; + + synchronized (repositories) { + HashSet b = levelMap.get(priorityLevel); + if ( b == null ) { + found = Collections.emptyList(); + } + else { + found = new ArrayList(b); + } + } + + return found; + } + + /* (non-Javadoc) + * @see org.cauldron.sigil.internal.repository.IRepositoryManager#addLibrary(org.cauldron.sigil.model.eclipse.ILibrary) + */ + public void addLibrary(ILibrary library) { + synchronized( libraries ) { + libraries.add(library); + } + } + + /* (non-Javadoc) + * @see org.cauldron.sigil.internal.repository.IRepositoryManager#removeLibrary(org.cauldron.sigil.model.eclipse.ILibrary) + */ + public void removeLibrary(ILibrary library) { + synchronized( libraries ) { + libraries.remove(library); + } + } + + /* (non-Javadoc) + * @see org.cauldron.sigil.internal.repository.IRepositoryManager#getLibraries() + */ + public Collection getLibraries() { + synchronized( libraries ) { + return libraries; + } + } + + /* (non-Javadoc) + * @see org.cauldron.sigil.internal.repository.IRepositoryManager#resolveLibrary(org.cauldron.sigil.model.eclipse.ILibraryImport) + */ + public ILibrary resolveLibrary(final ILibraryImport l) { + final ArrayList found = new ArrayList(1); + //ISigilProjectModel p = l.getAncestor(ISigilProjectModel.class); + // + //IModelWalker w = new IModelWalker() { + // public boolean visit(IModelElement element) { + // if ( element instanceof ILibrary ) { + // updateLibrary(l, (ILibrary) element, found); + // return false; + // } + // + // return true; + // } + //}; + + //p.visit( w ); + + //if ( found.isEmpty() ) { // no project specific libraries - check workspace definitions + synchronized( libraries ) { + for ( ILibrary lib : libraries ) { + if ( l.getLibraryName().equals( lib.getName() ) && l.getVersions().contains(lib.getVersion()) ) { + updateLibrary(l, lib, found); + } + } + } + //} + + return found.isEmpty() ? null : found.get(0); + } + + protected void updateLibrary(ILibraryImport li, ILibrary l, ArrayList found) { + if ( li.getLibraryName().equals( l.getName() ) && li.getVersions().contains(l.getVersion()) ) { + if ( found.isEmpty() ) { + found.add( l ); + } + else { + ILibrary c = found.get(0); + if ( l.getVersion().compareTo(c.getVersion()) > 0 ) { + found.remove(0); + found.add(l); + } + } + } + } + + public IBundleResolver getBundleResolver() { + return resolver; + } + + public void visit(final IModelWalker walker) { + for (IBundleRepository rep : getRepositories()) { + IRepositoryVisitor wrapper = new IRepositoryVisitor() { + public boolean visit(ISigilBundle bundle) { + bundle.visit(walker); + // return true as still want to visit other bundles + return true; + } + }; + rep.accept(wrapper); + } + } +} \ No newline at end of file Added: felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/repository/IBundleRepository.java URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/repository/IBundleRepository.java?rev=793581&view=auto ============================================================================== --- felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/repository/IBundleRepository.java (added) +++ felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/repository/IBundleRepository.java Mon Jul 13 13:25:46 2009 @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.cauldron.sigil.repository; + +import java.io.IOException; +import java.io.OutputStream; +import java.util.Collection; + +import org.cauldron.sigil.model.eclipse.ILibrary; +import org.cauldron.sigil.model.eclipse.ISigilBundle; +import org.cauldron.sigil.model.osgi.IPackageImport; +import org.cauldron.sigil.model.osgi.IRequiredBundle; + +public interface IBundleRepository { + static final int NORMAL_PRIORITY = 0; + static final int MAXIMUM_PRIORITY = -500; + static final int MINIMUM_PRIORITY = 500; + + String getId(); + + void addBundleRepositoryListener(IBundleRepositoryListener listener); + + void removeBundleRepositoryListener(IBundleRepositoryListener listener); + + void accept(IRepositoryVisitor visitor); + + void accept(IRepositoryVisitor visitor, int options); + + void writeOBR(OutputStream out) throws IOException; + + void refresh(); + + ISigilBundle findProvider(IPackageImport packageImport, int options); + + ISigilBundle findProvider(IRequiredBundle bundle, int options); + + Collection findAllProviders(IRequiredBundle bundle, int options); + + Collection findAllProviders(IPackageImport packageImport, int options); + + Collection findProviders(ILibrary library, int options); +} Added: felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/repository/IBundleRepositoryListener.java URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/repository/IBundleRepositoryListener.java?rev=793581&view=auto ============================================================================== --- felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/repository/IBundleRepositoryListener.java (added) +++ felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/repository/IBundleRepositoryListener.java Mon Jul 13 13:25:46 2009 @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.cauldron.sigil.repository; + +public interface IBundleRepositoryListener { + void notifyChange(IBundleRepository repository); +} Added: felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/repository/IBundleResolver.java URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/repository/IBundleResolver.java?rev=793581&view=auto ============================================================================== --- felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/repository/IBundleResolver.java (added) +++ felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/repository/IBundleResolver.java Mon Jul 13 13:25:46 2009 @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.cauldron.sigil.repository; + +import org.cauldron.sigil.model.IModelElement; + +public interface IBundleResolver { + IResolution resolve(IModelElement element, ResolutionConfig config, IResolutionMonitor monitor) throws ResolutionException; +} Added: felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/repository/IProviderChangeListener.java URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/repository/IProviderChangeListener.java?rev=793581&view=auto ============================================================================== --- felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/repository/IProviderChangeListener.java (added) +++ felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/repository/IProviderChangeListener.java Mon Jul 13 13:25:46 2009 @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.cauldron.sigil.repository; + +public interface IProviderChangeListener { + void notifyChange(IRepositoryProvider provider); +} Added: felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/repository/IRepositoryChangeListener.java URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/repository/IRepositoryChangeListener.java?rev=793581&view=auto ============================================================================== --- felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/repository/IRepositoryChangeListener.java (added) +++ felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/repository/IRepositoryChangeListener.java Mon Jul 13 13:25:46 2009 @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.cauldron.sigil.repository; + +public interface IRepositoryChangeListener { + void repositoryChanged(RepositoryChangeEvent event); +} Added: felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/repository/IRepositoryManager.java URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/repository/IRepositoryManager.java?rev=793581&view=auto ============================================================================== --- felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/repository/IRepositoryManager.java (added) +++ felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/repository/IRepositoryManager.java Mon Jul 13 13:25:46 2009 @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.cauldron.sigil.repository; + +import java.util.Collection; + +import org.cauldron.sigil.model.IModelWalker; +import org.cauldron.sigil.model.eclipse.ILibrary; +import org.cauldron.sigil.model.eclipse.ILibraryImport; +import org.eclipse.core.runtime.CoreException; + +public interface IRepositoryManager { + void addRepositoryChangeListener(IRepositoryChangeListener listener); + + void removeRepositoryChangeListener(IRepositoryChangeListener listener); + + Collection getRepositories(); + + Collection getRepositories(int level); + + void addLibrary(ILibrary library); + + void removeLibrary(ILibrary library); + + Collection getLibraries(); + + ILibrary resolveLibrary(final ILibraryImport l); + + IBundleResolver getBundleResolver(); + + int[] getPriorityLevels(); + + void visit(IModelWalker modelWalker); +} \ No newline at end of file Added: felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/repository/IRepositoryProvider.java URL: http://svn.apache.org/viewvc/felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/repository/IRepositoryProvider.java?rev=793581&view=auto ============================================================================== --- felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/repository/IRepositoryProvider.java (added) +++ felix/trunk/sigil/org.cauldron.bld.core/src/org/cauldron/sigil/repository/IRepositoryProvider.java Mon Jul 13 13:25:46 2009 @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.cauldron.sigil.repository; + +import java.util.Properties; + +public interface IRepositoryProvider { + IBundleRepository createRepository(String id, Properties properties) throws RepositoryException; +}