[savara-commits] savara SVN: r323 - in trunk/tools: plugins and 1 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Thu Jul 8 14:11:45 EDT 2010
Author: objectiser
Date: 2010-07-08 14:11:45 -0400 (Thu, 08 Jul 2010)
New Revision: 323
Added:
trunk/tools/features/org.scribble.conversation.feature/
trunk/tools/features/org.scribble.experimental.feature/
trunk/tools/features/org.scribble.feature/
trunk/tools/features/org.scribble.java.feature/
trunk/tools/plugins/org.scribble.conformance/
trunk/tools/plugins/org.scribble.conversation.comparator/
trunk/tools/plugins/org.scribble.conversation.eclipse/
trunk/tools/plugins/org.scribble.conversation.export.text/
trunk/tools/plugins/org.scribble.conversation.model/
trunk/tools/plugins/org.scribble.conversation.parser/
trunk/tools/plugins/org.scribble.conversation.projector/
trunk/tools/plugins/org.scribble.conversation.validation/
trunk/tools/plugins/org.scribble.core/
trunk/tools/plugins/org.scribble.core/src/java/org/scribble/model/Annotations.java
trunk/tools/plugins/org.scribble.core/src/java/org/scribble/model/ModelObject.java
trunk/tools/plugins/org.scribble.core/src/java/org/scribble/model/TypeReference.java
trunk/tools/plugins/org.scribble.eclipse/
trunk/tools/plugins/org.scribble.expression.xpath/
trunk/tools/plugins/org.scribble.lang.comparator/
trunk/tools/plugins/org.scribble.lang.model/
Removed:
trunk/tools/plugins/org.scribble.core/src/java/org/scribble/model/Annotations.java
trunk/tools/plugins/org.scribble.core/src/java/org/scribble/model/ModelObject.java
trunk/tools/plugins/org.scribble.core/src/java/org/scribble/model/TypeReference.java
Log:
Move the scribble plugins/features.
Copied: trunk/tools/features/org.scribble.conversation.feature (from rev 306, trunk/tools/eclipse/org.scribble.conversation.feature)
Copied: trunk/tools/features/org.scribble.experimental.feature (from rev 306, trunk/tools/eclipse/org.scribble.experimental.feature)
Copied: trunk/tools/features/org.scribble.feature (from rev 306, trunk/tools/eclipse/org.scribble.feature)
Copied: trunk/tools/features/org.scribble.java.feature (from rev 306, trunk/tools/eclipse/org.scribble.java.feature)
Copied: trunk/tools/plugins/org.scribble.conformance (from rev 306, trunk/tools/eclipse/org.scribble.conformance)
Copied: trunk/tools/plugins/org.scribble.conversation.comparator (from rev 306, trunk/tools/eclipse/org.scribble.conversation.comparator)
Copied: trunk/tools/plugins/org.scribble.conversation.eclipse (from rev 306, trunk/tools/eclipse/org.scribble.conversation.eclipse)
Copied: trunk/tools/plugins/org.scribble.conversation.export.text (from rev 306, trunk/tools/eclipse/org.scribble.conversation.export.text)
Copied: trunk/tools/plugins/org.scribble.conversation.model (from rev 306, trunk/tools/eclipse/org.scribble.conversation.model)
Copied: trunk/tools/plugins/org.scribble.conversation.parser (from rev 306, trunk/tools/eclipse/org.scribble.conversation.parser)
Copied: trunk/tools/plugins/org.scribble.conversation.projector (from rev 306, trunk/tools/eclipse/org.scribble.conversation.projector)
Copied: trunk/tools/plugins/org.scribble.conversation.validation (from rev 306, trunk/tools/eclipse/org.scribble.conversation.validation)
Copied: trunk/tools/plugins/org.scribble.core (from rev 306, trunk/tools/eclipse/org.scribble.core)
Deleted: trunk/tools/plugins/org.scribble.core/src/java/org/scribble/model/Annotations.java
===================================================================
--- trunk/tools/eclipse/org.scribble.core/src/java/org/scribble/model/Annotations.java 2010-07-06 21:48:27 UTC (rev 306)
+++ trunk/tools/plugins/org.scribble.core/src/java/org/scribble/model/Annotations.java 2010-07-08 18:11:45 UTC (rev 323)
@@ -1,45 +0,0 @@
-/*
- * Copyright 2005-9 Pi4 Technologies Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- * Change History:
- * 20 Apr 2009 : Initial version created by gary
- */
-package org.scribble.model;
-
-/**
- * This class represents a map of named serializable
- * information that can be used to provide additional
- * details about a model component.
- */
-public class Annotations extends java.util.HashMap<String,java.io.Serializable> {
-
- private static final long serialVersionUID = -4594153737794956180L;
-
- /**
- * The default constructor.
- */
- public Annotations() {
- }
-
- /**
- * This is the copy constructor.
- *
- * @param annotations The annotations to copy
- */
- public Annotations(Annotations annotations) {
- putAll(annotations);
- }
-}
Copied: trunk/tools/plugins/org.scribble.core/src/java/org/scribble/model/Annotations.java (from rev 314, trunk/tools/eclipse/org.scribble.core/src/java/org/scribble/model/Annotations.java)
===================================================================
--- trunk/tools/plugins/org.scribble.core/src/java/org/scribble/model/Annotations.java (rev 0)
+++ trunk/tools/plugins/org.scribble.core/src/java/org/scribble/model/Annotations.java 2010-07-08 18:11:45 UTC (rev 323)
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2005-9 Pi4 Technologies Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+ * Change History:
+ * 20 Apr 2009 : Initial version created by gary
+ */
+package org.scribble.model;
+
+/**
+ * This class represents a map of named serializable
+ * information that can be used to provide additional
+ * details about a model component.
+ */
+public class Annotations extends java.util.HashMap<String,Object> {
+
+ private static final long serialVersionUID = -4594153737794956180L;
+
+ /**
+ * The default constructor.
+ */
+ public Annotations() {
+ }
+
+ /**
+ * This is the copy constructor.
+ *
+ * @param annotations The annotations to copy
+ */
+ public Annotations(Annotations annotations) {
+ putAll(annotations);
+ }
+}
Deleted: trunk/tools/plugins/org.scribble.core/src/java/org/scribble/model/ModelObject.java
===================================================================
--- trunk/tools/eclipse/org.scribble.core/src/java/org/scribble/model/ModelObject.java 2010-07-06 21:48:27 UTC (rev 306)
+++ trunk/tools/plugins/org.scribble.core/src/java/org/scribble/model/ModelObject.java 2010-07-08 18:11:45 UTC (rev 323)
@@ -1,355 +0,0 @@
-/*
- * Copyright 2007 Pi4 Technologies Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- * Change History:
- * 20 Oct 2007 : Initial version created by gary
- */
-package org.scribble.model;
-
-import java.util.logging.Logger;
-
-/**
- * This is the generic object from which all Scribble model objects
- * are derived.
- */
-public abstract class ModelObject implements java.io.Serializable {
-
- private static final long serialVersionUID = -8915435247669402908L;
-
- /**
- * This is the default constructor for the model object.
- */
- public ModelObject() {
- }
-
- /**
- * This is the constructor initialized with the source
- * reference.
- *
- * @param source The source reference
- */
- public ModelObject(int start, int end) {
- m_sourceRef.setStartPosition(start);
- m_sourceRef.setEndPosition(end);
- }
-
- /**
- * This method returns the source reference.
- *
- * @return The source reference
- */
- public SourceRef getSource() {
- return(m_sourceRef);
- }
-
- /**
- * This method returns the parent of this
- * model object.
- *
- * @return The parent, or null if top model
- * object
- */
- public ModelObject getParent() {
- return(m_parent);
- }
-
- /**
- * This method sets the parent model object.
- *
- * @param parent The parent
- */
- public void setParent(ModelObject parent) {
- m_parent = parent;
- }
-
- /**
- * This method establishes the necessary information to
- * indicate that the current model object is derived
- * from the supplied source model object.
- *
- * @param modelObj The source model object
- */
- public void derivedFrom(ModelObject modelObj) {
- if (modelObj != null) {
- m_sourceRef = new SourceRef(modelObj.getSource());
-
- m_annotations = new Annotations(modelObj.getAnnotations());
- }
- }
-
- /**
- * This method returns the annotations associated
- * with this model object.
- *
- * @return The annotations
- */
- public Annotations getAnnotations() {
- return(m_annotations);
- }
-
- /**
- * This method visits the model object using the supplied
- * visitor.
- *
- * @param visitor The visitor
- */
- public void visit(Visitor visitor) {
- boolean visitContained=visitor.visit(this);
-
- if (visitContained) {
-
- // Iterate over references and contained model objects
- java.beans.BeanInfo bi=null;
-
- try {
- bi = java.beans.Introspector.getBeanInfo(getClass());
- } catch(Exception e) {
- logger.log(java.util.logging.Level.SEVERE,
- "Failed to get bean info for class '"+
- getClass()+"'", e);
- }
-
- if (bi != null) {
- java.beans.PropertyDescriptor[] pds=bi.getPropertyDescriptors();
-
- for (int i=0; i < pds.length; i++) {
- if (pds[i].getReadMethod() != null) {
- org.scribble.model.Reference ref=
- (org.scribble.model.Reference)
- pds[i].getReadMethod().getAnnotation(
- org.scribble.model.Reference.class);
-
- if (ref != null && ref.containment()) {
- try {
- Object refObject=pds[i].getReadMethod().invoke(this, (Object[])null);
-
- if (refObject instanceof java.util.List) {
- java.util.List<?> list=(java.util.List<?>)refObject;
-
- for (int j=0; j < list.size(); j++) {
- if (list.get(j) instanceof ModelObject) {
-
- ((ModelObject)list.get(j)).visit(visitor);
-
- } else {
- logger.severe("Property '"+
- pds[i].getName()+"' on class '"+
- getClass()+
- "': Object in list is not a ModelObject");
- }
- }
- } else if (refObject instanceof ModelObject) {
- ((ModelObject)refObject).visit(visitor);
-
- } else if (refObject != null) {
- logger.severe("Property '"+pds[i].getName()+"' on class '"+
- getClass()+
- "': Contained object is not a ModelObject or list: "+
- refObject.getClass());
- }
- } catch(Exception e) {
- logger.severe("Failed to obtain property '"+
- pds[i].getName()+"' on class '"+
- getClass()+"': "+e);
- e.printStackTrace();
- }
- }
- }
- }
- }
- }
- }
-
- /**
- * This method sets the URI on the current model object, and
- * iterates through all contained model objects to set the
- * relative URI on them.
- *
- * @param uriPart The model object's URI part, relative to
- * its parent
- */
- protected void initializeURIPart(String uriPart) {
- String uri="";
-
- if (getParent() != null) {
- uri = getParent().getSource().getModelObjectURI();
- }
-
- uri += "/" + (uriPart == null ? "":uriPart);
-
- // Initialize the URI on the source reference
- getSource().setModelObjectURI(uri);
-
- // Iterate over references and contained model objects
- java.beans.BeanInfo bi=null;
-
- try {
- bi = java.beans.Introspector.getBeanInfo(getClass());
- } catch(Exception e) {
- logger.log(java.util.logging.Level.SEVERE,
- "Failed to get bean info for class '"+
- getClass()+"'", e);
- }
-
- if (bi != null) {
- java.beans.PropertyDescriptor[] pds=bi.getPropertyDescriptors();
-
- for (int i=0; i < pds.length; i++) {
- if (pds[i].getReadMethod() != null) {
- org.scribble.model.Reference ref=
- (org.scribble.model.Reference)
- pds[i].getReadMethod().getAnnotation(
- org.scribble.model.Reference.class);
-
- if (ref != null && ref.containment()) {
- try {
- Object refObject=pds[i].getReadMethod().invoke(this, (Object[])null);
-
- if (refObject instanceof java.util.List) {
- java.util.List<?> list=(java.util.List<?>)refObject;
-
- for (int j=0; j < list.size(); j++) {
- if (list.get(j) instanceof ModelObject) {
-
- ((ModelObject)list.get(j)).initializeURIPart(pds[i].getName()+"."+(j+1));
-
- } else {
- logger.severe("Property '"+
- pds[i].getName()+"' on class '"+
- getClass()+
- "': Object in list is not a ModelObject");
- }
- }
- } else if (refObject instanceof ModelObject) {
- ((ModelObject)refObject).initializeURIPart(pds[i].getName());
-
- } else if (refObject != null) {
- logger.severe("Property '"+pds[i].getName()+"' on class '"+
- getClass()+
- "': Contained object is not a ModelObject or list: "+
- refObject.getClass());
- }
- } catch(Exception e) {
- logger.severe("Failed to obtain property '"+
- pds[i].getName()+"' on class '"+
- getClass()+"': "+e);
- e.printStackTrace();
- }
- }
- }
- }
- }
- }
-
- /**
- * This method returns the child model object associated with
- * the supplied URI part.
- *
- * @param uriPart The URI part
- * @return The model object, or null if not found
- */
- protected ModelObject findChild(String uriPart) {
- ModelObject ret=null;
- int index=-1;
- int pos=-1;
-
- // Check if has an index
- if ((index=uriPart.indexOf('.')) != -1) {
- String num=uriPart.substring(index+1);
-
- uriPart = uriPart.substring(0, index);
-
- try {
- pos = Integer.parseInt(num);
- } catch(Exception e) {
- e.printStackTrace();
- }
- }
-
- // Find property
- java.beans.BeanInfo bi=null;
- java.beans.PropertyDescriptor pd=null;
-
- try {
- bi = java.beans.Introspector.getBeanInfo(getClass());
- } catch(Exception e) {
- logger.log(java.util.logging.Level.SEVERE,
- "Failed to get bean info for class '"+
- getClass()+"'", e);
- }
-
- if (bi != null) {
- java.beans.PropertyDescriptor[] pds=bi.getPropertyDescriptors();
-
- for (int i=0; pd == null && i < pds.length; i++) {
- if (pds[i].getName().equals(uriPart)) {
- pd = pds[i];
- }
- }
- }
-
- if (pd != null && pd.getReadMethod() != null) {
- try {
- Object refObject=pd.getReadMethod().invoke(this, (Object[])null);
-
- if (refObject instanceof java.util.List &&
- pos != -1) {
- java.util.List<?> list=(java.util.List<?>)refObject;
-
- ret = (ModelObject)list.get(pos-1);
- } else if (refObject instanceof ModelObject) {
- ret = (ModelObject)refObject;
-
- } else if (refObject != null) {
- logger.severe("Property '"+pd.getName()+"' on class '"+
- getClass()+
- "': Contained object is not a ModelObject or list: "+
- refObject.getClass());
- }
- } catch(Exception e) {
- logger.severe("Failed to obtain property '"+
- pd.getName()+"' on class '"+
- getClass()+"': "+e);
- e.printStackTrace();
- }
- }
-
- return(ret);
- }
-
- /* DON'T PROVIDE AN EQUALS IMPL, as this causes a problem with comparator rules
- * when checking for multiple paths - but can use equality of the source refs
- public boolean equals(Object obj) {
- boolean ret=false;
-
- if (obj instanceof ModelObject) {
- ModelObject other=(ModelObject)obj;
-
- if (m_sourceRef != null &&
- other.m_sourceRef != null) {
- ret = m_sourceRef.equals(other.m_sourceRef);
- }
- }
- return(ret);
- }
- */
-
- private static Logger logger = Logger.getLogger("org.scribble.model");
-
- private SourceRef m_sourceRef=new SourceRef();
- private ModelObject m_parent=null;
- private Annotations m_annotations=new Annotations();
-}
Copied: trunk/tools/plugins/org.scribble.core/src/java/org/scribble/model/ModelObject.java (from rev 314, trunk/tools/eclipse/org.scribble.core/src/java/org/scribble/model/ModelObject.java)
===================================================================
--- trunk/tools/plugins/org.scribble.core/src/java/org/scribble/model/ModelObject.java (rev 0)
+++ trunk/tools/plugins/org.scribble.core/src/java/org/scribble/model/ModelObject.java 2010-07-08 18:11:45 UTC (rev 323)
@@ -0,0 +1,355 @@
+/*
+ * Copyright 2007 Pi4 Technologies Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+ * Change History:
+ * 20 Oct 2007 : Initial version created by gary
+ */
+package org.scribble.model;
+
+import java.util.logging.Logger;
+
+/**
+ * This is the generic object from which all Scribble model objects
+ * are derived.
+ */
+public abstract class ModelObject {
+
+ private static final long serialVersionUID = -8915435247669402908L;
+
+ /**
+ * This is the default constructor for the model object.
+ */
+ public ModelObject() {
+ }
+
+ /**
+ * This is the constructor initialized with the source
+ * reference.
+ *
+ * @param source The source reference
+ */
+ public ModelObject(int start, int end) {
+ m_sourceRef.setStartPosition(start);
+ m_sourceRef.setEndPosition(end);
+ }
+
+ /**
+ * This method returns the source reference.
+ *
+ * @return The source reference
+ */
+ public SourceRef getSource() {
+ return(m_sourceRef);
+ }
+
+ /**
+ * This method returns the parent of this
+ * model object.
+ *
+ * @return The parent, or null if top model
+ * object
+ */
+ public ModelObject getParent() {
+ return(m_parent);
+ }
+
+ /**
+ * This method sets the parent model object.
+ *
+ * @param parent The parent
+ */
+ public void setParent(ModelObject parent) {
+ m_parent = parent;
+ }
+
+ /**
+ * This method establishes the necessary information to
+ * indicate that the current model object is derived
+ * from the supplied source model object.
+ *
+ * @param modelObj The source model object
+ */
+ public void derivedFrom(ModelObject modelObj) {
+ if (modelObj != null) {
+ m_sourceRef = new SourceRef(modelObj.getSource());
+
+ m_annotations = new Annotations(modelObj.getAnnotations());
+ }
+ }
+
+ /**
+ * This method returns the annotations associated
+ * with this model object.
+ *
+ * @return The annotations
+ */
+ public Annotations getAnnotations() {
+ return(m_annotations);
+ }
+
+ /**
+ * This method visits the model object using the supplied
+ * visitor.
+ *
+ * @param visitor The visitor
+ */
+ public void visit(Visitor visitor) {
+ boolean visitContained=visitor.visit(this);
+
+ if (visitContained) {
+
+ // Iterate over references and contained model objects
+ java.beans.BeanInfo bi=null;
+
+ try {
+ bi = java.beans.Introspector.getBeanInfo(getClass());
+ } catch(Exception e) {
+ logger.log(java.util.logging.Level.SEVERE,
+ "Failed to get bean info for class '"+
+ getClass()+"'", e);
+ }
+
+ if (bi != null) {
+ java.beans.PropertyDescriptor[] pds=bi.getPropertyDescriptors();
+
+ for (int i=0; i < pds.length; i++) {
+ if (pds[i].getReadMethod() != null) {
+ org.scribble.model.Reference ref=
+ (org.scribble.model.Reference)
+ pds[i].getReadMethod().getAnnotation(
+ org.scribble.model.Reference.class);
+
+ if (ref != null && ref.containment()) {
+ try {
+ Object refObject=pds[i].getReadMethod().invoke(this, (Object[])null);
+
+ if (refObject instanceof java.util.List) {
+ java.util.List<?> list=(java.util.List<?>)refObject;
+
+ for (int j=0; j < list.size(); j++) {
+ if (list.get(j) instanceof ModelObject) {
+
+ ((ModelObject)list.get(j)).visit(visitor);
+
+ } else {
+ logger.severe("Property '"+
+ pds[i].getName()+"' on class '"+
+ getClass()+
+ "': Object in list is not a ModelObject");
+ }
+ }
+ } else if (refObject instanceof ModelObject) {
+ ((ModelObject)refObject).visit(visitor);
+
+ } else if (refObject != null) {
+ logger.severe("Property '"+pds[i].getName()+"' on class '"+
+ getClass()+
+ "': Contained object is not a ModelObject or list: "+
+ refObject.getClass());
+ }
+ } catch(Exception e) {
+ logger.severe("Failed to obtain property '"+
+ pds[i].getName()+"' on class '"+
+ getClass()+"': "+e);
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * This method sets the URI on the current model object, and
+ * iterates through all contained model objects to set the
+ * relative URI on them.
+ *
+ * @param uriPart The model object's URI part, relative to
+ * its parent
+ */
+ protected void initializeURIPart(String uriPart) {
+ String uri="";
+
+ if (getParent() != null) {
+ uri = getParent().getSource().getModelObjectURI();
+ }
+
+ uri += "/" + (uriPart == null ? "":uriPart);
+
+ // Initialize the URI on the source reference
+ getSource().setModelObjectURI(uri);
+
+ // Iterate over references and contained model objects
+ java.beans.BeanInfo bi=null;
+
+ try {
+ bi = java.beans.Introspector.getBeanInfo(getClass());
+ } catch(Exception e) {
+ logger.log(java.util.logging.Level.SEVERE,
+ "Failed to get bean info for class '"+
+ getClass()+"'", e);
+ }
+
+ if (bi != null) {
+ java.beans.PropertyDescriptor[] pds=bi.getPropertyDescriptors();
+
+ for (int i=0; i < pds.length; i++) {
+ if (pds[i].getReadMethod() != null) {
+ org.scribble.model.Reference ref=
+ (org.scribble.model.Reference)
+ pds[i].getReadMethod().getAnnotation(
+ org.scribble.model.Reference.class);
+
+ if (ref != null && ref.containment()) {
+ try {
+ Object refObject=pds[i].getReadMethod().invoke(this, (Object[])null);
+
+ if (refObject instanceof java.util.List) {
+ java.util.List<?> list=(java.util.List<?>)refObject;
+
+ for (int j=0; j < list.size(); j++) {
+ if (list.get(j) instanceof ModelObject) {
+
+ ((ModelObject)list.get(j)).initializeURIPart(pds[i].getName()+"."+(j+1));
+
+ } else {
+ logger.severe("Property '"+
+ pds[i].getName()+"' on class '"+
+ getClass()+
+ "': Object in list is not a ModelObject");
+ }
+ }
+ } else if (refObject instanceof ModelObject) {
+ ((ModelObject)refObject).initializeURIPart(pds[i].getName());
+
+ } else if (refObject != null) {
+ logger.severe("Property '"+pds[i].getName()+"' on class '"+
+ getClass()+
+ "': Contained object is not a ModelObject or list: "+
+ refObject.getClass());
+ }
+ } catch(Exception e) {
+ logger.severe("Failed to obtain property '"+
+ pds[i].getName()+"' on class '"+
+ getClass()+"': "+e);
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * This method returns the child model object associated with
+ * the supplied URI part.
+ *
+ * @param uriPart The URI part
+ * @return The model object, or null if not found
+ */
+ protected ModelObject findChild(String uriPart) {
+ ModelObject ret=null;
+ int index=-1;
+ int pos=-1;
+
+ // Check if has an index
+ if ((index=uriPart.indexOf('.')) != -1) {
+ String num=uriPart.substring(index+1);
+
+ uriPart = uriPart.substring(0, index);
+
+ try {
+ pos = Integer.parseInt(num);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ // Find property
+ java.beans.BeanInfo bi=null;
+ java.beans.PropertyDescriptor pd=null;
+
+ try {
+ bi = java.beans.Introspector.getBeanInfo(getClass());
+ } catch(Exception e) {
+ logger.log(java.util.logging.Level.SEVERE,
+ "Failed to get bean info for class '"+
+ getClass()+"'", e);
+ }
+
+ if (bi != null) {
+ java.beans.PropertyDescriptor[] pds=bi.getPropertyDescriptors();
+
+ for (int i=0; pd == null && i < pds.length; i++) {
+ if (pds[i].getName().equals(uriPart)) {
+ pd = pds[i];
+ }
+ }
+ }
+
+ if (pd != null && pd.getReadMethod() != null) {
+ try {
+ Object refObject=pd.getReadMethod().invoke(this, (Object[])null);
+
+ if (refObject instanceof java.util.List &&
+ pos != -1) {
+ java.util.List<?> list=(java.util.List<?>)refObject;
+
+ ret = (ModelObject)list.get(pos-1);
+ } else if (refObject instanceof ModelObject) {
+ ret = (ModelObject)refObject;
+
+ } else if (refObject != null) {
+ logger.severe("Property '"+pd.getName()+"' on class '"+
+ getClass()+
+ "': Contained object is not a ModelObject or list: "+
+ refObject.getClass());
+ }
+ } catch(Exception e) {
+ logger.severe("Failed to obtain property '"+
+ pd.getName()+"' on class '"+
+ getClass()+"': "+e);
+ e.printStackTrace();
+ }
+ }
+
+ return(ret);
+ }
+
+ /* DON'T PROVIDE AN EQUALS IMPL, as this causes a problem with comparator rules
+ * when checking for multiple paths - but can use equality of the source refs
+ public boolean equals(Object obj) {
+ boolean ret=false;
+
+ if (obj instanceof ModelObject) {
+ ModelObject other=(ModelObject)obj;
+
+ if (m_sourceRef != null &&
+ other.m_sourceRef != null) {
+ ret = m_sourceRef.equals(other.m_sourceRef);
+ }
+ }
+ return(ret);
+ }
+ */
+
+ private static Logger logger = Logger.getLogger("org.scribble.model");
+
+ private SourceRef m_sourceRef=new SourceRef();
+ private ModelObject m_parent=null;
+ private Annotations m_annotations=new Annotations();
+}
Deleted: trunk/tools/plugins/org.scribble.core/src/java/org/scribble/model/TypeReference.java
===================================================================
--- trunk/tools/eclipse/org.scribble.core/src/java/org/scribble/model/TypeReference.java 2010-07-06 21:48:27 UTC (rev 306)
+++ trunk/tools/plugins/org.scribble.core/src/java/org/scribble/model/TypeReference.java 2010-07-08 18:11:45 UTC (rev 323)
@@ -1,53 +0,0 @@
-/*
- * Copyright 2007 Pi4 Technologies Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- * Change History:
- * 24 Oct 2007 : Initial version created by gary
- */
-package org.scribble.model;
-
-/**
- * This class represents a type reference.
- */
-public class TypeReference extends ModelReference {
-
- private static final long serialVersionUID = 6492984753933254949L;
-
- public static final String TYPE_SYSTEM="TypeSystem";
-
- public static final String TS_XSD_TYPE="XSDType";
- public static final String TS_XSD_ELEMENT="XSDElement";
-
- /**
- * This is the default constructor for the type reference.
- */
- public TypeReference() {
- super(TypeModel.TYPE);
- }
-
- /**
- * This method determines whether another reference, that
- * implements (or conforms to) this reference, can be
- * used.
- *
- * @return Whether to use an implementation of this
- * referenced model
- */
- public boolean useImplementations() {
- return(true);
- }
-
-}
Copied: trunk/tools/plugins/org.scribble.core/src/java/org/scribble/model/TypeReference.java (from rev 317, trunk/tools/eclipse/org.scribble.core/src/java/org/scribble/model/TypeReference.java)
===================================================================
--- trunk/tools/plugins/org.scribble.core/src/java/org/scribble/model/TypeReference.java (rev 0)
+++ trunk/tools/plugins/org.scribble.core/src/java/org/scribble/model/TypeReference.java 2010-07-08 18:11:45 UTC (rev 323)
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2007 Pi4 Technologies Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+ * Change History:
+ * 24 Oct 2007 : Initial version created by gary
+ */
+package org.scribble.model;
+
+/**
+ * This class represents a type reference.
+ */
+public class TypeReference extends ModelReference {
+
+ private static final long serialVersionUID = 6492984753933254949L;
+
+ /**
+ * This is the default constructor for the type reference.
+ */
+ public TypeReference() {
+ super(TypeModel.TYPE);
+ }
+
+ /**
+ * This method determines whether another reference, that
+ * implements (or conforms to) this reference, can be
+ * used.
+ *
+ * @return Whether to use an implementation of this
+ * referenced model
+ */
+ public boolean useImplementations() {
+ return(true);
+ }
+
+}
Copied: trunk/tools/plugins/org.scribble.eclipse (from rev 306, trunk/tools/eclipse/org.scribble.eclipse)
Copied: trunk/tools/plugins/org.scribble.expression.xpath (from rev 306, trunk/tools/eclipse/org.scribble.expression.xpath)
Copied: trunk/tools/plugins/org.scribble.lang.comparator (from rev 306, trunk/tools/eclipse/org.scribble.lang.comparator)
Copied: trunk/tools/plugins/org.scribble.lang.model (from rev 306, trunk/tools/eclipse/org.scribble.lang.model)
More information about the savara-commits
mailing list