Home » Modeling » UML2 » Programmatically create port
| |
Re: Programmatically create port [message #471752 is a reply to message #471750] |
Thu, 22 March 2007 08:24 |
Paolo Messages: 15 Registered: July 2009 |
Junior Member |
|
|
Thanks for your answer, James.
My problem is a little hard to explain: a work mate made an eclipse
plugin for basic uml modeling (e.g.: there are no aggregations), but
with a couple of features added like logic formulas, but these features
are not important at the moment. What I'm trying to do is to save the
created model through the uml2 tool. In particular I've got a vector of
"entities", every entity could be a class or an interface. I start from
the beginning, if it's a class, I call the createClass(..) method on the
package with the only parameters I need, I have no problem in setting
its attributes and methods, no problem in creating interfaces, but a lot
of problems in creating ports and connections.
For example, I created a classA and I created a ClassB, too. I'd like to
connect them, before setting the type of the connection and stuff, how I
create the right ports (port1 on classA and port2 on ClassB)?
In a few words I have to "translate" my mate code into uml2 tool code. I
tried to explain my problem in the best English I could, I hope it's
clear enough.
Regards,
Paolo.
James Bruck ha scritto:
> Hi Paolo,
>
> Let's take a step back... you cannot actually connect a class and an
> interface with a Connector via ports. You cannot create ports on
> Interfaces.
> You can create ports on EncapsulatedClassifiers ( Interfaces are not
> encapsulated classifiers). Connectors can only be drawn in the context of
> some structured classifier.
> From any EncapsultatedClassifier you can call createOwnedPort(..). to
> create a port.
>
> What is the original problem you are trying to solve?
>
> Regards,
> - James.
>
|
|
|
Re: Programmatically create port [message #471756 is a reply to message #471752] |
Thu, 22 March 2007 13:30 |
james bruck Messages: 1724 Registered: July 2009 |
Senior Member |
|
|
Paolo,
From what you describe, I doubt that ports and connectors are what you want
to use to "connect" your classes or interfaces.
But, to create ports, you can call
EncapsulatedClassifier#createOwnedPort(...)
Perhaps you might want to use associations? or dependencies?
Regards,
- James.
"Paolo" <superpex@virgilio.it> wrote in message
news:etteff$hkq$1@utils.eclipse.org...
>
> Thanks for your answer, James.
>
> My problem is a little hard to explain: a work mate made an eclipse
> plugin for basic uml modeling (e.g.: there are no aggregations), but
> with a couple of features added like logic formulas, but these features
> are not important at the moment. What I'm trying to do is to save the
> created model through the uml2 tool. In particular I've got a vector of
> "entities", every entity could be a class or an interface. I start from
> the beginning, if it's a class, I call the createClass(..) method on the
> package with the only parameters I need, I have no problem in setting
> its attributes and methods, no problem in creating interfaces, but a lot
> of problems in creating ports and connections.
> For example, I created a classA and I created a ClassB, too. I'd like to
> connect them, before setting the type of the connection and stuff, how I
> create the right ports (port1 on classA and port2 on ClassB)?
> In a few words I have to "translate" my mate code into uml2 tool code. I
> tried to explain my problem in the best English I could, I hope it's
> clear enough.
>
>
> Regards,
> Paolo.
>
>
>
>
>
> James Bruck ha scritto:
> > Hi Paolo,
> >
> > Let's take a step back... you cannot actually connect a class and an
> > interface with a Connector via ports. You cannot create ports on
> > Interfaces.
> > You can create ports on EncapsulatedClassifiers ( Interfaces are not
> > encapsulated classifiers). Connectors can only be drawn in the context
of
> > some structured classifier.
> > From any EncapsultatedClassifier you can call createOwnedPort(..). to
> > create a port.
> >
> > What is the original problem you are trying to solve?
> >
> > Regards,
> > - James.
> >
|
|
|
Re: Programmatically create port [message #471806 is a reply to message #471756] |
Sat, 24 March 2007 12:37 |
Paolo Messages: 15 Registered: July 2009 |
Junior Member |
|
|
I only need to create ports with connections, it's not necessary to have
even dependencies.
I'll try to call the org.eclipse.uml2.EncapsulatedClassifier
createOwnedPort(..) and I'll see what happen, I think I'll need to write
again in this thread because the ports I have to translate are stored in
a different vector and not as class "attributes". So I'm not sure I
understand how to do the association between classes and ports. But this
is not a problem of uml2 tool.
Suppose I correctly created two ports on two classes, how do I set a
connection between them? I read the docs and I guess I have to create a
connectionEnd for every port, associate them to the right ports and then
set the connector element, but I'm not sure it's right.
I really appreciate your help, James, thank you very much.
Paolo
James Bruck ha scritto:
> Paolo,
>
> From what you describe, I doubt that ports and connectors are what
you > want to use to "connect" your classes or interfaces.
> But, to create ports, you can call
> EncapsulatedClassifier#createOwnedPort(...)
>
> Perhaps you might want to use associations? or dependencies?
>
> Regards,
>
> - James.
>
|
|
|
Re: Programmatically create port [message #471808 is a reply to message #471806] |
Mon, 26 March 2007 15:24 |
james bruck Messages: 1724 Registered: July 2009 |
Senior Member |
|
|
Hi Paolo,
Yes that is correct, from your connector you would create 2 ends... call
Connector#createEnd().
Then from the connector end you can call setRole() and pass port1 and then,
on the other connector end call setRole() and pass port2.
You can also call setPartWithPort() property if the port is "on" a part. I
put "on" in quotes because the port would be owned by a classifier that
types the part, but on a composite structure diagram, the port would be
displayed on the part. The part with port is used to distinguish different
parts, when the underlying port is the same element ( ie owned by the
classifier typing the part ).
This is where using a tool to model these things is handy ;)
Regards,
- James.
"Paolo" <superpex@virgilio.it> wrote in message
news:eu3635$e5o$1@utils.eclipse.org...
> I only need to create ports with connections, it's not necessary to have
> even dependencies.
>
> I'll try to call the org.eclipse.uml2.EncapsulatedClassifier
> createOwnedPort(..) and I'll see what happen, I think I'll need to write
> again in this thread because the ports I have to translate are stored in
> a different vector and not as class "attributes". So I'm not sure I
> understand how to do the association between classes and ports. But this
> is not a problem of uml2 tool.
>
> Suppose I correctly created two ports on two classes, how do I set a
> connection between them? I read the docs and I guess I have to create a
> connectionEnd for every port, associate them to the right ports and then
> set the connector element, but I'm not sure it's right.
>
> I really appreciate your help, James, thank you very much.
> Paolo
>
> James Bruck ha scritto:
> > Paolo,
> >
> > From what you describe, I doubt that ports and connectors are what
> you > want to use to "connect" your classes or interfaces.
> > But, to create ports, you can call
> > EncapsulatedClassifier#createOwnedPort(...)
> >
> > Perhaps you might want to use associations? or dependencies?
> >
> > Regards,
> >
> > - James.
> >
|
|
| |
Re: Programmatically create port [message #603106 is a reply to message #471750] |
Thu, 22 March 2007 08:24 |
Paolo Messages: 15 Registered: July 2009 |
Junior Member |
|
|
Thanks for your answer, James.
My problem is a little hard to explain: a work mate made an eclipse
plugin for basic uml modeling (e.g.: there are no aggregations), but
with a couple of features added like logic formulas, but these features
are not important at the moment. What I'm trying to do is to save the
created model through the uml2 tool. In particular I've got a vector of
"entities", every entity could be a class or an interface. I start from
the beginning, if it's a class, I call the createClass(..) method on the
package with the only parameters I need, I have no problem in setting
its attributes and methods, no problem in creating interfaces, but a lot
of problems in creating ports and connections.
For example, I created a classA and I created a ClassB, too. I'd like to
connect them, before setting the type of the connection and stuff, how I
create the right ports (port1 on classA and port2 on ClassB)?
In a few words I have to "translate" my mate code into uml2 tool code. I
tried to explain my problem in the best English I could, I hope it's
clear enough.
Regards,
Paolo.
James Bruck ha scritto:
> Hi Paolo,
>
> Let's take a step back... you cannot actually connect a class and an
> interface with a Connector via ports. You cannot create ports on
> Interfaces.
> You can create ports on EncapsulatedClassifiers ( Interfaces are not
> encapsulated classifiers). Connectors can only be drawn in the context of
> some structured classifier.
> From any EncapsultatedClassifier you can call createOwnedPort(..). to
> create a port.
>
> What is the original problem you are trying to solve?
>
> Regards,
> - James.
>
|
|
|
Re: Programmatically create port [message #603128 is a reply to message #471752] |
Thu, 22 March 2007 13:30 |
james bruck Messages: 1724 Registered: July 2009 |
Senior Member |
|
|
Paolo,
From what you describe, I doubt that ports and connectors are what you want
to use to "connect" your classes or interfaces.
But, to create ports, you can call
EncapsulatedClassifier#createOwnedPort(...)
Perhaps you might want to use associations? or dependencies?
Regards,
- James.
"Paolo" <superpex@virgilio.it> wrote in message
news:etteff$hkq$1@utils.eclipse.org...
>
> Thanks for your answer, James.
>
> My problem is a little hard to explain: a work mate made an eclipse
> plugin for basic uml modeling (e.g.: there are no aggregations), but
> with a couple of features added like logic formulas, but these features
> are not important at the moment. What I'm trying to do is to save the
> created model through the uml2 tool. In particular I've got a vector of
> "entities", every entity could be a class or an interface. I start from
> the beginning, if it's a class, I call the createClass(..) method on the
> package with the only parameters I need, I have no problem in setting
> its attributes and methods, no problem in creating interfaces, but a lot
> of problems in creating ports and connections.
> For example, I created a classA and I created a ClassB, too. I'd like to
> connect them, before setting the type of the connection and stuff, how I
> create the right ports (port1 on classA and port2 on ClassB)?
> In a few words I have to "translate" my mate code into uml2 tool code. I
> tried to explain my problem in the best English I could, I hope it's
> clear enough.
>
>
> Regards,
> Paolo.
>
>
>
>
>
> James Bruck ha scritto:
> > Hi Paolo,
> >
> > Let's take a step back... you cannot actually connect a class and an
> > interface with a Connector via ports. You cannot create ports on
> > Interfaces.
> > You can create ports on EncapsulatedClassifiers ( Interfaces are not
> > encapsulated classifiers). Connectors can only be drawn in the context
of
> > some structured classifier.
> > From any EncapsultatedClassifier you can call createOwnedPort(..). to
> > create a port.
> >
> > What is the original problem you are trying to solve?
> >
> > Regards,
> > - James.
> >
|
|
|
Re: Programmatically create port [message #603159 is a reply to message #471756] |
Sat, 24 March 2007 12:37 |
Paolo Messages: 15 Registered: July 2009 |
Junior Member |
|
|
I only need to create ports with connections, it's not necessary to have
even dependencies.
I'll try to call the org.eclipse.uml2.EncapsulatedClassifier
createOwnedPort(..) and I'll see what happen, I think I'll need to write
again in this thread because the ports I have to translate are stored in
a different vector and not as class "attributes". So I'm not sure I
understand how to do the association between classes and ports. But this
is not a problem of uml2 tool.
Suppose I correctly created two ports on two classes, how do I set a
connection between them? I read the docs and I guess I have to create a
connectionEnd for every port, associate them to the right ports and then
set the connector element, but I'm not sure it's right.
I really appreciate your help, James, thank you very much.
Paolo
James Bruck ha scritto:
> Paolo,
>
> From what you describe, I doubt that ports and connectors are what
you > want to use to "connect" your classes or interfaces.
> But, to create ports, you can call
> EncapsulatedClassifier#createOwnedPort(...)
>
> Perhaps you might want to use associations? or dependencies?
>
> Regards,
>
> - James.
>
|
|
|
Re: Programmatically create port [message #603169 is a reply to message #471806] |
Mon, 26 March 2007 15:24 |
james bruck Messages: 1724 Registered: July 2009 |
Senior Member |
|
|
Hi Paolo,
Yes that is correct, from your connector you would create 2 ends... call
Connector#createEnd().
Then from the connector end you can call setRole() and pass port1 and then,
on the other connector end call setRole() and pass port2.
You can also call setPartWithPort() property if the port is "on" a part. I
put "on" in quotes because the port would be owned by a classifier that
types the part, but on a composite structure diagram, the port would be
displayed on the part. The part with port is used to distinguish different
parts, when the underlying port is the same element ( ie owned by the
classifier typing the part ).
This is where using a tool to model these things is handy ;)
Regards,
- James.
"Paolo" <superpex@virgilio.it> wrote in message
news:eu3635$e5o$1@utils.eclipse.org...
> I only need to create ports with connections, it's not necessary to have
> even dependencies.
>
> I'll try to call the org.eclipse.uml2.EncapsulatedClassifier
> createOwnedPort(..) and I'll see what happen, I think I'll need to write
> again in this thread because the ports I have to translate are stored in
> a different vector and not as class "attributes". So I'm not sure I
> understand how to do the association between classes and ports. But this
> is not a problem of uml2 tool.
>
> Suppose I correctly created two ports on two classes, how do I set a
> connection between them? I read the docs and I guess I have to create a
> connectionEnd for every port, associate them to the right ports and then
> set the connector element, but I'm not sure it's right.
>
> I really appreciate your help, James, thank you very much.
> Paolo
>
> James Bruck ha scritto:
> > Paolo,
> >
> > From what you describe, I doubt that ports and connectors are what
> you > want to use to "connect" your classes or interfaces.
> > But, to create ports, you can call
> > EncapsulatedClassifier#createOwnedPort(...)
> >
> > Perhaps you might want to use associations? or dependencies?
> >
> > Regards,
> >
> > - James.
> >
|
|
|
Goto Forum:
Current Time: Thu Apr 25 08:39:34 GMT 2024
Powered by FUDForum. Page generated in 0.04065 seconds
|