Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
Webtools Releng
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eclipse Projects
webtools
Releng
Webtools Releng
Commits
a267c251
Commit
a267c251
authored
18 years ago
by
jeffliu
Browse files
Options
Downloads
Patches
Plain Diff
All usage reports to be combined into one
parent
f49d3070
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/src/org/eclipse/wtp/releng/tools/component/adopters/CombineClass2Reference.java
+73
-2
73 additions, 2 deletions
...leng/tools/component/adopters/CombineClass2Reference.java
with
73 additions
and
2 deletions
archive/releng.builder/tools/apitools/org.eclipse.wtp.releng.tools.component.core/src/org/eclipse/wtp/releng/tools/component/adopters/CombineClass2Reference.java
+
73
−
2
View file @
a267c251
...
...
@@ -12,14 +12,21 @@ package org.eclipse.wtp.releng.tools.component.adopters;
import
java.io.ByteArrayInputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileOutputStream
;
import
java.io.FileWriter
;
import
java.io.IOException
;
import
java.util.Collection
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.Map
;
import
org.eclipse.wtp.releng.tools.component.ILocation
;
import
org.eclipse.wtp.releng.tools.component.api.ComponentXMLVisitor
;
import
org.eclipse.wtp.releng.tools.component.internal.Location
;
import
org.eclipse.wtp.releng.tools.component.model.ComponentXML
;
import
org.eclipse.wtp.releng.tools.component.model.Package
;
import
org.eclipse.wtp.releng.tools.component.model.Plugin
;
import
org.eclipse.wtp.releng.tools.component.model.Type
;
import
org.eclipse.wtp.releng.tools.component.util.CommandOptionParser
;
import
org.eclipse.wtp.releng.tools.component.xsl.XSLUtil
;
...
...
@@ -35,6 +42,7 @@ public class CombineClass2Reference
ComponentLead
unknown
;
private
Collection
src
;
private
String
output
;
private
Collection
api
;
private
class
ComponentLead
{
...
...
@@ -102,8 +110,37 @@ public class CombineClass2Reference
this
.
output
=
output
;
}
public
Collection
getApi
()
{
return
api
;
}
public
void
setApi
(
Collection
api
)
{
this
.
api
=
api
;
}
public
void
execute
()
{
// Collect component.xml files
Map
pluginId2CompXML
=
new
HashMap
();
if
(
api
!=
null
)
{
for
(
Iterator
i
=
api
.
iterator
();
i
.
hasNext
();)
{
ILocation
apiLocation
=
Location
.
createLocation
(
new
File
((
String
)
i
.
next
()));
ComponentXMLVisitor
compXMLVisitor
=
new
ComponentXMLVisitor
();
apiLocation
.
accept
(
compXMLVisitor
);
for
(
Iterator
it
=
compXMLVisitor
.
getCompXMLs
().
iterator
();
it
.
hasNext
();)
{
ComponentXML
compXML
=
(
ComponentXML
)
it
.
next
();
for
(
Iterator
it2
=
compXML
.
getPlugins
().
iterator
();
it2
.
hasNext
();)
{
pluginId2CompXML
.
put
(((
Plugin
)
it2
.
next
()).
getId
(),
compXML
);
}
}
}
}
for
(
Iterator
it
=
src
.
iterator
();
it
.
hasNext
();)
{
FileInputStream
fis
=
null
;
...
...
@@ -117,6 +154,7 @@ public class CombineClass2Reference
int
pluginRefTotal
=
0
;
PluginRef
pluginRef
=
(
PluginRef
)
it2
.
next
();
String
pluginId
=
pluginRef
.
getId
();
ComponentXML
compXML
=
(
ComponentXML
)
pluginId2CompXML
.
get
(
pluginId
);
ComponentLead
compLead
=
unknown
;
for
(
Iterator
it3
=
plugin2complead
.
keySet
().
iterator
();
it3
.
hasNext
();)
{
...
...
@@ -131,6 +169,9 @@ public class CombineClass2Reference
{
ClassRef
classRef
=
(
ClassRef
)
it3
.
next
();
String
name
=
classRef
.
getName
();
String
pkgName
=
getPackageName
(
name
);
if
(
isAPI
(
compXML
,
pkgName
,
name
.
substring
(
pkgName
.
length
()
+
1
),
classRef
.
getRefCount
(),
classRef
.
getSubclassCount
(),
classRef
.
getImplementCount
(),
classRef
.
getInstantiateCount
()))
continue
;
int
refCount
=
classRef
.
getRefCount
();
pluginRefTotal
+=
refCount
;
Integer
refTotal
=
(
Integer
)
compLead
.
class2refCount
.
get
(
name
);
...
...
@@ -140,7 +181,6 @@ public class CombineClass2Reference
}
refTotal
=
new
Integer
(
refCount
+
refTotal
.
intValue
());
compLead
.
class2refCount
.
put
(
name
,
refTotal
);
String
pkgName
=
getPackageName
(
name
);
Integer
pkgRefTotal
=
(
Integer
)
compLead
.
pkg2refCount
.
get
(
pkgName
);
if
(
pkgRefTotal
==
null
)
{
...
...
@@ -173,6 +213,34 @@ public class CombineClass2Reference
genHTML
();
}
private
boolean
isAPI
(
ComponentXML
compXML
,
String
pkgName
,
String
localName
,
int
refCount
,
int
subclassCount
,
int
impleCount
,
int
instantiateCount
)
{
if
(
compXML
==
null
)
return
false
;
Package
pkg
=
compXML
.
getPackage
(
pkgName
);
if
(
pkg
==
null
)
return
false
;
else
{
Type
type
=
pkg
.
getType
(
localName
);
if
(
type
==
null
)
return
pkg
.
isApi
();
else
{
if
(
refCount
>
0
&&
!
type
.
isReference
())
return
false
;
else
if
(
subclassCount
>
0
&&
!
type
.
isSubclass
())
return
false
;
else
if
(
impleCount
>
0
&&
!
type
.
isImplement
())
return
false
;
else
if
(
instantiateCount
>
0
&&
!
type
.
isInstantiate
())
return
false
;
else
return
true
;
}
}
}
private
String
getPackageName
(
String
className
)
{
int
i
=
className
.
lastIndexOf
(
'.'
);
...
...
@@ -305,6 +373,7 @@ public class CombineClass2Reference
Map
options
=
optionParser
.
getOptions
();
Collection
src
=
(
Collection
)
options
.
get
(
"src"
);
Collection
output
=
(
Collection
)
options
.
get
(
"output"
);
Collection
api
=
(
Collection
)
options
.
get
(
"api"
);
if
(
src
==
null
||
output
==
null
||
src
.
isEmpty
()
||
output
.
isEmpty
())
{
printUsage
();
...
...
@@ -314,6 +383,7 @@ public class CombineClass2Reference
CombineClass2Reference
class2Ref
=
new
CombineClass2Reference
();
class2Ref
.
setSrc
(
src
);
class2Ref
.
setOutput
((
String
)
output
.
iterator
().
next
());
class2Ref
.
setApi
(
api
);
class2Ref
.
execute
();
}
...
...
@@ -323,5 +393,6 @@ public class CombineClass2Reference
System
.
out
.
println
(
""
);
System
.
out
.
println
(
"\t-src\t\t<src>\t\tlocation of your usage reports"
);
System
.
out
.
println
(
"\t-output\t<output>\t\tlocation of the output file"
);
System
.
out
.
println
(
"\t-api\t\t<api>\t\tlocation of your component.xml"
);
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment